Skip to content

Commit

Permalink
Merge pull request appium#27 from admc/master
Browse files Browse the repository at this point in the history
Getting the shell working and system binary
  • Loading branch information
sourishkrout committed Jan 22, 2013
2 parents 826b736 + 985d047 commit 1020462
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 deletions.
59 changes: 59 additions & 0 deletions app/bin.js
Original file line number Diff line number Diff line change
@@ -1 +1,60 @@
#!/usr/bin/env node
"use strict";

var net = require('net')
, repl = require('repl')
, underscore = require('underscore')
, colors = require('colors')
, appium = require('../server')
, parser = require('./parser')
;

var startRepl = function() {
var help = function() {
console.log("\nWelcome to the Appium CLI".cyan);
console.log(" - Access the appium object via the object: 'appium'".grey);
console.log(" - appium.run is the function to start the server".grey);
console.log(" - args is the default params data structure".grey);
console.log(" - set args.app then run appium.run(args);\n".grey);
return 'Thanks for asking';
};

help();

var r = repl.start('(appium): ');
r.context.appium = appium;
r.context.parser = parser();
r.context.help = help;
r.context.args = {
app: '/path/to/test/app'
, verbose: '1'
, udid: null
, address: '127.0.0.1'
, port: 4723
, remove: true
};

var connections = 0;
var server = net.createServer(function (socket) {
connections += 1;
socket.setTimeout(5*60*1000, function() {
socket.destroy();
});
repl.start("(appium): ", socket);
}).listen(process.platform === "win32" ? "\\\\.\\pipe\\node-repl-sock-" + process.pid : "/tmp/node-repl-sock-" + process.pid);

r.on('exit', function () {
server.close();
process.exit();
});
};

if (process.argv[2] === "shell") {
startRepl();
}
else {
var args = parser().parseArgs();
args.verbose = 1;
console.log("Pre-flight check ...".grey);
appium.run(args, function() { console.log('Rock and roll.'.grey); });
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "appium",
"description": "Selenium for Apps.",
"description": "Automation for Apps.",
"tags": [
"automation",
"javascript"
Expand Down Expand Up @@ -31,7 +31,8 @@
"argparse": "~0.1.10",
"path": "~0.4.9",
"rimraf": "~2.1.1",
"uuid-js": "~0.7.4"
"uuid-js": "~0.7.4",
"winston": "~0.6.2"
},
"scripts": {
"test": "grunt lint unit"
Expand Down

0 comments on commit 1020462

Please sign in to comment.