hb
Version:
Hummingbird generator & cli.
47 lines (40 loc) • 935 B
JavaScript
var ops = require('./operations.js');
/**
* Actions
*/
module.exports = {
/**
* Check if currently in hb app
*/
hb: function() {
var curent_hb = process.cwd() + "/package.json";
try {
return this_hb = require(current_hb);
} catch (e) {
console.log("Error: not a hummingbird application.");
process.exit(0);
}
},
/**
* Generate new hummingbird app
*/
generate: function(name) {
var hbdir = ops.dir(name);
console.log("Initializing new hummingbird app " + name + "...");
ops.mkDir(hbdir);
ops.install(hbdir, function(error,out) {
console.log("Installing dependencies...");
if (error) {
console.log(error);
} else {
ops.copyPackage(hbdir, function(error) {
if (error) {
console.log(error);
} else {
console.log("Done!");
}
});
}
});
}
};