Skip to content

Instantly share code, notes, and snippets.

@k33g
Created March 9, 2012 20:51
Show Gist options
  • Save k33g/2008635 to your computer and use it in GitHub Desktop.
Save k33g/2008635 to your computer and use it in GitHub Desktop.
generate express app with gimme
module.exports = mystack_cmd;
var fs = require('fs')
, path = require('path')
, exec = require('child_process').exec;
mystack_cmd.usage = "gimme mystack <appname>";
mystack_cmd.description = ['my personnal express.js boilerplate', "@k33g_org"];
function launch(cmd, cb) {
exec(cmd, function(err, stdout, stderr) {
if (err) {
console.log(err);
throw err;
}
else {
console.log(cmd+ " -> OK");
if(cb) cb();
}
});
}
function mystack_cmd (opts, cb) {
var appname = opts.argv.remain.slice(1)[0];
launch("express " + appname, function() {
launch("cd " + appname + " && npm install -d", function(){
launch("cd " + appname + " && npm install ejs", function() {
console.log(appname + " has been created.")
});
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment