Skip to content

Commit 1020462

Browse files
committedJan 22, 2013
Merge pull request appium#27 from admc/master
Getting the shell working and system binary
2 parents 826b736 + 985d047 commit 1020462

File tree

2 files changed

+62
-2
lines changed

2 files changed

+62
-2
lines changed
 

‎app/bin.js

+59
Original file line numberDiff line numberDiff line change
@@ -1 +1,60 @@
11
#!/usr/bin/env node
2+
"use strict";
3+
4+
var net = require('net')
5+
, repl = require('repl')
6+
, underscore = require('underscore')
7+
, colors = require('colors')
8+
, appium = require('../server')
9+
, parser = require('./parser')
10+
;
11+
12+
var startRepl = function() {
13+
var help = function() {
14+
console.log("\nWelcome to the Appium CLI".cyan);
15+
console.log(" - Access the appium object via the object: 'appium'".grey);
16+
console.log(" - appium.run is the function to start the server".grey);
17+
console.log(" - args is the default params data structure".grey);
18+
console.log(" - set args.app then run appium.run(args);\n".grey);
19+
return 'Thanks for asking';
20+
};
21+
22+
help();
23+
24+
var r = repl.start('(appium): ');
25+
r.context.appium = appium;
26+
r.context.parser = parser();
27+
r.context.help = help;
28+
r.context.args = {
29+
app: '/path/to/test/app'
30+
, verbose: '1'
31+
, udid: null
32+
, address: '127.0.0.1'
33+
, port: 4723
34+
, remove: true
35+
};
36+
37+
var connections = 0;
38+
var server = net.createServer(function (socket) {
39+
connections += 1;
40+
socket.setTimeout(5*60*1000, function() {
41+
socket.destroy();
42+
});
43+
repl.start("(appium): ", socket);
44+
}).listen(process.platform === "win32" ? "\\\\.\\pipe\\node-repl-sock-" + process.pid : "/tmp/node-repl-sock-" + process.pid);
45+
46+
r.on('exit', function () {
47+
server.close();
48+
process.exit();
49+
});
50+
};
51+
52+
if (process.argv[2] === "shell") {
53+
startRepl();
54+
}
55+
else {
56+
var args = parser().parseArgs();
57+
args.verbose = 1;
58+
console.log("Pre-flight check ...".grey);
59+
appium.run(args, function() { console.log('Rock and roll.'.grey); });
60+
}

‎package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "appium",
3-
"description": "Selenium for Apps.",
3+
"description": "Automation for Apps.",
44
"tags": [
55
"automation",
66
"javascript"
@@ -31,7 +31,8 @@
3131
"argparse": "~0.1.10",
3232
"path": "~0.4.9",
3333
"rimraf": "~2.1.1",
34-
"uuid-js": "~0.7.4"
34+
"uuid-js": "~0.7.4",
35+
"winston": "~0.6.2"
3536
},
3637
"scripts": {
3738
"test": "grunt lint unit"

0 commit comments

Comments
 (0)
Please sign in to comment.