#!/usr/bin/env node // vim: set filetype=javascript: var program = require('commander'); var fs = require('fs'); var lib = require('../src/Config'); // commander.command is a function that we don't need. keep it from conflicting program.command = null; program .option('--name ', 'name of the runtime as returned by getruntime.') .option('--command ', 'executable command to start the runtime server process. [none]') .option('--host ', 'hostname of server to connect to. [localhost]', String, 'localhost') .option('--port ', 'port of server to connect to. [8080]', Number, 8080) .option('--collection ', 'name of the collection in which to find the components required for testing. [core]', String, 'core') .option('--version ', 'protocol version to test against', String, '0.5') .parse(process.argv); if (!program.name) { console.error('Error: You must specify a name'); process.exit(1); } if (!program.command) { console.warn('You did not specify a command: you must start your runtime before running the tests'); } var values = { name: program.name, command: program.command, host: program.host, port: program.port, collection: program.collection, version: program.version }; lib.saveStored(values); console.log('Stored the following configuration to ' + lib.getStoredPath()); console.log(); for (var name in values) { console.log(name + ': ' + values[name]); } console.log(); console.log('To test, run `fbp-test` from this directory');