brunch
Version:
A lightweight approach to building HTML5 applications with emphasis on elegance and simplicity
104 lines (95 loc) • 3.06 kB
JavaScript
// Generated by CoffeeScript 1.6.2
(function() {
'use strict';
var argumentum, commandLineConfig, commands, fs, sysPath;
argumentum = require('argumentum');
fs = require('fs');
sysPath = require('path');
commands = require('./');
commandLineConfig = {
script: 'brunch',
commandRequired: true,
commands: {
"new": {
abbr: 'n',
help: 'Create new brunch project',
options: {
rootPath: {
position: 1,
help: 'root path of project',
metavar: 'ROOT_PATH',
required: true
},
skeleton: {
abbr: 's',
help: 'path to / git URL of application skeleton (template).'
}
},
callback: function(args) {
return commands["new"](args.skeleton, args.rootPath);
}
},
build: {
abbr: 'b',
help: 'Build a brunch project',
options: {
configPath: {
abbr: 'c',
help: 'path to config file',
metavar: 'CONFIG',
full: 'config'
},
optimize: {
abbr: 'o',
flag: true,
help: 'optimize result files (minify etc.)'
}
},
callback: commands.build
},
watch: {
abbr: 'w',
help: 'Watch brunch directory and rebuild if something changed',
options: {
configPath: {
abbr: 'c',
help: 'path to config file',
metavar: 'CONFIG',
full: 'config'
},
optimize: {
abbr: 'o',
flag: true,
help: 'optimize result files (minify etc.)'
},
server: {
abbr: 's',
flag: true,
help: 'run a simple http server that would serve public dir'
},
port: {
abbr: 'p',
help: 'if a `server` option was specified, define on which port\
the server would run',
metavar: 'PORT'
}
},
callback: commands.watch
}
}
};
exports.run = function() {
var command;
command = process.argv[2];
if (command === 'g' || command === 'd' || command === 'generate' || command === 'destroy') {
console.error('`brunch generate / destroy` command was removed.\n\nUse scaffolt (https://github.com/paulmillr/scaffolt)\nsuccessor or similar:\n npm install -g scaffolt\n scaffolt <type> <name> [options]\n scaffolt <type> <name> [options] --revert');
}
if (command === 't' || command === 'test') {
console.error('`brunch test` command was removed.\n\nUse mocha-phantomjs (http://metaskills.net/mocha-phantomjs/)\nsuccessor or similar:\n npm install -g mocha-phantomjs\n mocha-phantomjs [options] <your-html-file-or-url>');
}
if (command === '-v' || command === '--version') {
return console.log(require('../package.json').version);
}
return argumentum.load(commandLineConfig).parse();
};
}).call(this);