1 | #!/usr/bin/env node
|
2 |
|
3 | var parseArgs = require('minimist'),
|
4 | paramedic = require('./paramedic');
|
5 |
|
6 | var plugins,
|
7 | platformId;
|
8 |
|
9 | var USAGE = "Error missing args. \n" +
|
10 | "cordova-paramedic --platform PLATFORM --plugin PATH [--justbuild --timeout MSECS --port PORTNUM --browserify]" +
|
11 | "`PLATFORM` : the platform id, currently only supports 'ios'\n" +
|
12 | "`PATH` : the relative or absolute path to a plugin folder\n" +
|
13 | "\texpected to have a 'tests' folder.\n" +
|
14 | "\tYou may specify multiple --plugin flags and they will all\n" +
|
15 | "\tbe installed and tested together.\n" +
|
16 | "`MSECS` : (optional) time in millisecs to wait for tests to pass|fail \n" +
|
17 | "\t(defaults to 10 minutes) \n" +
|
18 | "`PORTNUM` : (optional) port to use for posting results from emulator back to paramedic server\n" +
|
19 | "--justbuild : (optional) just builds the project, without running the tests \n" +
|
20 | "--browserify : (optional) plugins are browserified into cordova.js \n" +
|
21 | "--verbose : (optional) verbose mode. Display more information output";
|
22 |
|
23 | var argv = parseArgs(process.argv.slice(2));
|
24 |
|
25 | if(!argv.platform) {
|
26 | console.log(USAGE);
|
27 | process.exit(1);
|
28 | }
|
29 |
|
30 | var onComplete = function(resCode,resObj,logStr) {
|
31 | console.log("result code is : " + resCode);
|
32 | if(resObj) {
|
33 | console.log(JSON.stringify(resObj));
|
34 | }
|
35 | if(logStr) {
|
36 | console.log(logStr);
|
37 | }
|
38 | process.exit(resCode);
|
39 | };
|
40 |
|
41 | paramedic.run(argv.platform, argv.plugin, onComplete, argv.justbuild, argv.port, argv.timeout, argv.browserify, false, argv.verbose);
|
42 |
|