Skip to content

Commit

Permalink
Renamed module command
Browse files Browse the repository at this point in the history
  • Loading branch information
Acconut committed May 3, 2013
1 parent 97e27b1 commit c5c95e5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
45 changes: 29 additions & 16 deletions bin/hoodie.js
Expand Up @@ -22,7 +22,7 @@ function exec(command, args, callback) {


program
.version("0.0.1")
.version("0.1.0")
.usage("<command> <parameters>");

program
Expand Down Expand Up @@ -91,24 +91,35 @@ program
});

program
.command("module <action> <name>")
.description("Un-/Intall a hoodie module")
.action(function(action, name) {
.command("install <name>")
.description("Install a hoodie module")
.action(function(name) {

var cmd;
if(action === "install") {
cmd = "install";
name = "git://github.com/hoodiehq/worker-" + name + ".git";
} else if(action === "uninstall") cmd = "remove";
else {
console.log("Use install or uninstall as <action>");
process.exit(1);
}
var url = "git://github.com/hoodiehq/worker-" + name + ".git";

exec(which("npm"), [cmd, name, "--save"], function(err) {
exec(which("npm"), ["install", url, "--save"], function(err) {

if(err) {
console.log("Error installing dependencies:");
console.log("Error installing module:");
throw err;
process.exit(1);
}

console.log("Successfully installed %s", name);

});

});

program
.command("uninstall <name>")
.description("Uninstall a hoodie module")
.action(function(name) {

exec(which("npm"), ["remove", name, "--save"], function(err) {

if(err) {
console.log("Error uninstalling module:");
throw err;
process.exit(1);
}
Expand All @@ -119,11 +130,13 @@ program

});


program
.command("*")
.action(function() {
console.log([
"Command not found",
"",
"\tCommand not found",
"",
"\tSee 'hoodie --help' for more information."
].join("\n"));
Expand Down
6 changes: 4 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "hoodie-cli",
"version": "0.0.1",
"version": "0.1.0",

"preferGlobal": true,

Expand All @@ -9,5 +9,7 @@
"which": "1.0.x"
},

"bin": "./bin/hoodie.js"
"bin": {
"hoodie": "./bin/hoodie.js"
}
}

0 comments on commit c5c95e5

Please sign in to comment.