Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
desc: 'disables colors'
});
if (optimist.argv.hasOwnProperty('colors') && !optimist.argv.colors) {
Base.useColors = false;
colors.mode = 'none';
}
if (!process.env.APPC_COV) {
console.log('Unit Test Tool'.cyan.bold + ' - Copyright (c) 2012-' + (new Date).getFullYear() + ', Appcelerator, Inc. All Rights Reserved.');
}
// display the help, if needed
if (optimist.argv.help || optimist.argv.h) {
console.log('\nUsage: ' + 'forge test [] [options]'.cyan + '\n');
console.log(optimist.help());
process.exit(0);
}
// load the config, if specified
global.conf = {};
var confFile = optimist.argv.conf || optimist.argv.c;
if (confFile) {
if (!fs.existsSync(confFile = path.resolve(confFile))) {
console.error(('\nERROR: Config file "' + confFile + '" does not exist').red + '\n');
process.exit(1);
}
try {
global.conf = JSON.parse(fs.readFileSync(confFile));
} catch (ex) {
console.error(('\nERROR: Unable to parse config file "' + confFile).red + '"\n');
var util = require('util'),
http = require('http'),
argv = require('optimist').argv;
var port = argv.p || argv.port || 8000;
http.createServer(function (req, res) {
console.log(req.method + ' request: ' + req.url);
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('hello, i know nodejitsu.');
res.end();
}).listen(port);
/* server started */
util.puts('> hello world running on port ' + port);
require('./logging.js').init("Core");
// Print usage information, command line parameters
var configs = require('./config.js');
var optimist = require('optimist').usage('Usage: $0 [options]')
.options("h",{alias:"help"}).describe("h","Show this help")
.options("v",{alias:"version"}).describe("v","Show version and other information as parsable json")
.options("d",{alias:"debug"}).describe("d","Activate profiling and debug output")
.options("i",{alias:"import"}).describe("i","Import json files from path")
.options("o",{alias:"override"}).describe("o","Override existing documents when importing files with the same id+type")
.options("e",{alias:"exit"}).describe("e","Do not enter the mainloop and exit after init")
.options("drop",{}).describe("drop","Drop database content. Warning! This can't be undone! Only works with additional -e flag.")
.options("dbname",{default:configs.runtimeconfig.databasename}).describe("dbname","Database name")
.options("cport",{default:configs.runtimeconfig.controlport}).describe("cport","TCP Controlsocket port")
.options("wport",{default:configs.runtimeconfig.websocketport}).describe("wport","Websocket Controlsocket port"),
argv = optimist.argv;
// Show Help or Version info?
if (argv.help) {
console.log(configs.aboutconfig.ABOUT_SERVICENAME+" "+configs.aboutconfig.ABOUT_VERSION);
console.log("Please visit http://davidgraeff.github.com/scenecontrol for more information");
'use strict';
var mcversion = require('./mcversion.js');
var minecraft_protocol = require('minecraft-protocol/src');
var autoVersionForge = require('minecraft-protocol-forge').autoVersionForge;
var minecraft_data = require('minecraft-data')(mcversion);
var protodef = require('protodef');
var readVarInt = protodef.types.varint[0];
var writeVarInt = protodef.types.varint[1];
var sizeOfVarInt = protodef.types.varint[2];
var hex = require('hex');
var WebSocketServer = (require('ws')).Server;
var websocket_stream = require('websocket-stream');
var argv = (require('optimist'))
.default('wshost', '')
.default('wsport', 24444)
.default('mchost', 'localhost')
.default('mcport', 25565)
.default('prefix', 'webuser-')
.argv;
var PACKET_DEBUG = process.env.NODE_DEBUG && /wsmc/.test(process.env.NODE_DEBUG);
var FIXED_MC_VERSION = false; // either a version string, or false to auto-detect
console.log('WS('+argv.wshost+':'+argv.wsport+') <--> MC('+argv.mchost+':'+argv.mcport+')');
var ids = minecraft_data.protocol.states.play.toClient;
var sids = minecraft_data.protocol.states.play.toServer;
explorer: 'elementExplorer'
},
strings: { 'capabilities.tunnel-identifier': '' }
};
optimist.usage('Usage: protractor [configFile] [options]\n' +
'configFile defaults to protractor.conf.js\n' +
'The [options] object will override values from the config file.\n' +
'See the reference config for a full list of options.');
for (let key of Object.keys(optimistOptions.describes)) {
optimist.describe(key, optimistOptions.describes[key]);
}
for (let key of Object.keys(optimistOptions.aliases)) {
optimist.alias(key, optimistOptions.aliases[key]);
}
for (let key of Object.keys(optimistOptions.strings)) {
optimist.string(key);
}
optimist.check(function (arg) {
if (arg._.length > 1) {
throw new Error('Error: more than one config file specified');
}
});
let argv = optimist.parse(args);
if (argv.help) {
optimist.showHelp();
process.exit(0);
}
if (argv.version) {
console.log('Version ' + require(path.resolve(__dirname, '../package.json')).version);
process.exit(0);
}
// Check to see if additional flags were used.
function main(folder, args) {
folder = (folder || "").replace(/^[\/\\]+|[\/\\]+$/, "");
if (!folder) {
console.log(Optimist.help());
process.exit(1);
}
// Load settings file
var settings = JSON.parse(Fs.readFileSync(Path.join(__dirname, folder, "build.json")));
settings.folder = folder;
settings.minifyJS = args["minify-js"];
settings.combineJS = args["combine-js"];
settings.openInBrowser = args.open;
// Remove the output.
rmTree(Path.join(__dirname, folder, "output"));
// We may not want to do this...
rmTree(Path.join(__dirname, ".builder", "jetpack-sdk", "_" + folder));
function processArgs (argv, options, fs, path) {
if (argv.help) {
console.log(optimist.help())
process.exit(0)
}
if (argv.version) {
console.log(`Karma version: ${constant.VERSION}`)
process.exit(0)
}
// TODO(vojta): warn/throw when unknown argument (probably mispelled)
Object.getOwnPropertyNames(argv).forEach(function (name) {
let argumentValue = argv[name]
if (name !== '_' && name !== '$0') {
assert(!name.includes('_'), `Bad argument: ${name} did you mean ${name.replace('_', '-')}`)
if (Array.isArray(argumentValue)) {
argumentValue = argumentValue.pop() // If the same argument is defined multiple times, override.
var common = require('../common');
var register = require('../register').register;
/**
* Command line.
*/
var argv = require('optimist')
.usage('basil init [project-dir]')
.describe('help', 'Show options.').alias('help', 'h').boolean('help')
.describe('template', 'Pick a template to start building your game').alias('template', 't')
.argv;
if (argv.help) {
require('optimist').showHelp();
process.exit(0);
}
function createUUID (a) {
return a
? (a ^ Math.random() * 16 >> a / 4).toString(16)
: ([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g, createUUID);
}
//initialise an empty repo
exports.init = function(args, cb) {
// basil init
// basil init ./cake
if (!args[0]) {
console.log('Usage: basil init [folder path]');
function setup() {
'use strict';
// Check OS (We only work on raspberry)
if (os.type() != "Linux") {
console.error("You are not running Linux. Exiting ... \n".red);
// TODO: uncomment this at the end
//process.exit(0);
}
process.title = 'PiDashboard.js';
// Help display
if (optimist.help || optimist.h) {
require('./lib/help_log.js');
process.exit(0);
}
var cert = "", // Path to cert and key
key = "";
// Prepare keys and certs if we run https
if (optimist.cert || optimist.key || config.forceSSL) {
config.forceSSL = true;
if (optimist.cert) cert = optimist.cert; // If provided from cmd
if (optimist.key) key = optimist.key;
if (!cert.length) cert = config.paths.cert; //else grab the default
const configPaths = {};
const configPath = argv.config || argv.c || 'docs.json';
let outputPath = argv.out || argv.o;
// --html-file
// The file name for generated html
const htmlFile = argv['html-file'] || 'index.html';
const tsConfig = argv.tsconfig;
const tsTarget = argv.tstarget;
const previewMode = argv.preview || argv.p;
const packagePath = argv.package || 'package.json';
// --skip-public-assets
// Do not copy `public` assets as it can be shared
const skipPublicAssets = argv['skip-public-assets'] || false;
const showHelp =
argv.help || argv.h || !(outputPath || previewMode) || outputPath === true;
/*
* Display help text
*/
if (showHelp) {
console.log(fs.readFileSync(path.join(__dirname, 'help.txt'), 'utf8'));
process.exit();
}
/*
* Config
*/
debug('Config arg: %s', configPath);
configPaths.configPath = path.resolve(process.cwd(), configPath);