UNPKG

1.53 kBPlain TextView Raw
1#!/usr/bin/env node
2// vim: set filetype=javascript:
3var program = require('commander');
4var fs = require('fs');
5var lib = require('../src/Config');
6
7// commander.command is a function that we don't need. keep it from conflicting
8program.command = null;
9
10program
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
19if (!program.name) {
20 console.error('Error: You must specify a name');
21 process.exit(1);
22}
23
24if (!program.command) {
25 console.warn('You did not specify a command: you must start your runtime before running the tests');
26}
27
28var 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
37lib.saveStored(values);
38
39console.log('Stored the following configuration to ' + lib.getStoredPath());
40console.log();
41for (var name in values) {
42 console.log(name + ': ' + values[name]);
43}
44console.log();
45console.log('To test, run `fbp-test` from this directory');