1 | #!/usr/bin/env node
|
2 | // vim: set filetype=javascript:
|
3 | var program = require('commander');
|
4 | var fs = require('fs');
|
5 | var lib = require('../src/Config');
|
6 |
|
7 | // commander.command is a function that we don't need. keep it from conflicting
|
8 | program.command = null;
|
9 |
|
10 | program
|
11 | .option('--name <name>', 'name of the runtime as returned by getruntime.')
|
12 | .option('--command <command>', 'executable command to start the runtime server process. [none]')
|
13 | .option('--host <hostname>', 'hostname of server to connect to. [localhost]', String, 'localhost')
|
14 | .option('--port <port>', 'port of server to connect to. [8080]', Number, 8080)
|
15 | .option('--collection <collection>', 'name of the collection in which to find the components required for testing. [core]', String, 'core')
|
16 | .option('--version <version>', 'protocol version to test against', String, '0.7')
|
17 | .parse(process.argv);
|
18 |
|
19 | if (!program.name) {
|
20 | console.error('Error: You must specify a name');
|
21 | process.exit(1);
|
22 | }
|
23 |
|
24 | if (!program.command) {
|
25 | console.warn('You did not specify a command: you must start your runtime before running the tests');
|
26 | }
|
27 |
|
28 | var values = {
|
29 | name: program.name,
|
30 | command: program.command,
|
31 | host: program.host,
|
32 | port: program.port,
|
33 | collection: program.collection,
|
34 | version: program.version
|
35 | };
|
36 |
|
37 | lib.saveStored(values);
|
38 |
|
39 | console.log('Stored the following configuration to ' + lib.getStoredPath());
|
40 | console.log();
|
41 | for (var name in values) {
|
42 | console.log(name + ': ' + values[name]);
|
43 | }
|
44 | console.log();
|
45 | console.log('To test, run `fbp-test` from this directory');
|