Skip to content

Commit

Permalink
Replace generic _exec with action specific functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffano committed May 25, 2012
1 parent a8d1796 commit da398fe
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ function exec() {

function _exec(command) {
return function () {
new jenkins(url)[command](bag.cli.exit);
new jenkins(url)[command](bag.cli.exitCb());
};
}

/*
function _build() {
var args = Array.prototype.slice.call(_build['arguments']),
jobs = args.slice(0, args.length - 1);
Expand All @@ -24,7 +24,7 @@ function exec() {
new jenkins(url).build(job);
});
}

*/
function _dashboard() {
return function () {
new jenkins(url).dashboard(bag.cli.exitCb(null, function (result) {
Expand All @@ -39,14 +39,18 @@ function exec() {
};
}

function _job(job) {

function _version() {
return function () {
new jenkins(url).version(bag.cli.exitCb(null, function (result) {
console.log('Jenkins ver. %s', result);
}));
};
}

var commands = {
build: {
desc: 'Trigger one or more builds',
action: _build
action: _exec('build')
},
dashboard: {
desc: 'View status of all jobs',
Expand All @@ -62,15 +66,15 @@ function exec() {
},
job: {
desc: 'View job status',
action: _job
action: _exec('job')
},
queue: {
desc: 'View the build queue',
action: _exec('queue')
},
version: {
ver: {
desc: 'View Jenkins version number',
action: _exec('version')
action: _version()
}
};

Expand Down

0 comments on commit da398fe

Please sign in to comment.