Comparing version 0.0.7 to 0.1.0
@@ -14,13 +14,10 @@ /* | ||
path = require('path'), | ||
prompt = require('cli-prompt'); | ||
prompt = require('cli-prompt'), | ||
logger = require('./logger'); | ||
exports.github = new github({ | ||
version: "3.0.0" | ||
version: "3.0.0", | ||
debug: false | ||
}); | ||
exports.logger = require('cli-log').init({ | ||
prefix: 'gh', | ||
prefixColor: 'magenta' | ||
}); | ||
exports.authorize = function(opt_callback) { | ||
@@ -36,7 +33,7 @@ var config; | ||
opt_callback = opt_callback && opt_callback(); | ||
opt_callback && opt_callback(); | ||
}; | ||
exports.createAuthorization = function(opt_callback) { | ||
exports.logger.log('node-gh needs authorization to use github api'); | ||
logger.log('node-gh needs authorization to use github api'); | ||
@@ -58,3 +55,3 @@ prompt('type your user: ', function(user) { | ||
if (err) { | ||
exports.logger.error('node-gh could not authenticate'); | ||
logger.error('node-gh could not authenticate'); | ||
} | ||
@@ -64,3 +61,3 @@ | ||
exports.writeGlobalConfigCredentials(user, res.token); | ||
exports.logger.success('token saved'); | ||
logger.success('token saved'); | ||
opt_callback = opt_callback && opt_callback(); | ||
@@ -95,4 +92,4 @@ process.exit(0); | ||
if (!fs.existsSync(configPath)) { | ||
exports.logger.warn('config file ' + configPath + ' not found'); | ||
exports.logger.info('creating ' + configPath); | ||
logger.warn('config file ' + configPath + ' not found'); | ||
logger.info('creating ' + configPath); | ||
fs.writeFileSync(configPath, '{}'); | ||
@@ -99,0 +96,0 @@ } |
@@ -13,8 +13,8 @@ /* | ||
clc = require('cli-color'), | ||
prompt = require('cli-prompt'); | ||
logger = require('../logger'), | ||
printed = {}; | ||
function Notifications(options, currentRepository, listEvents) { | ||
function Notifications(options, currentRepository) { | ||
this.options = options; | ||
this.currentRepository = currentRepository; | ||
this.listEvents = listEvents; | ||
} | ||
@@ -40,80 +40,86 @@ | ||
var instance = this, | ||
options = instance.options, | ||
config = base.getGlobalConfig(); | ||
options = instance.options; | ||
base.login(); | ||
options.user = options.user || config.github.user; | ||
options.user = options.user || base.getUser(); | ||
options.repo = options.repo || instance.currentRepository; | ||
if (options.latest) { | ||
instance.latest(options.user, options.repo); | ||
} else if (options.watch) { | ||
instance.watch(options.user, options.repo); | ||
instance.latest(); | ||
} | ||
if (options.watch) { | ||
instance.watch(); | ||
} | ||
}; | ||
Notifications.prototype.latest = function(user, repo) { | ||
Notifications.prototype.latest = function(opt_watch) { | ||
var instance = this, | ||
txt = ''; | ||
options = instance.options, | ||
operations, | ||
payload, | ||
listEvents, | ||
filteredListEvents = []; | ||
async.series([ | ||
function(mainCallback) { | ||
instance.loadNotifications_(user, repo, mainCallback); | ||
}], | ||
function() { | ||
for (var i = 0; i < instance.listEvents.length; i++) { | ||
txt = instance.getMessage_(i); | ||
instance.displayMessage_(txt, instance.listEvents[i], repo); | ||
} | ||
process.exit(0); | ||
} | ||
); | ||
}; | ||
operations = [ | ||
function(callback) { | ||
payload = { | ||
user: options.user, | ||
repo: options.repo | ||
}; | ||
Notifications.prototype.watch = function(user, repo) { | ||
var instance = this, | ||
txt = '', | ||
lastEventDate = '', | ||
intervalTime = 10000; | ||
base.github.events.getFromRepo(payload, function(err, data) { | ||
if (!err) { | ||
listEvents = data; | ||
} | ||
callback(err); | ||
}); | ||
}, | ||
function(callback) { | ||
listEvents.forEach(function(event) { | ||
event.txt = instance.getMessage_(event); | ||
setInterval(function() { | ||
async.series([ | ||
function(mainCallback) { | ||
instance.loadNotifications_(user, repo, mainCallback); | ||
}], | ||
function() { | ||
if (lastEventDate != instance.listEvents[0].created_at) { | ||
lastEventDate = instance.listEvents[0].created_at; | ||
txt = instance.getMessage_(0); | ||
instance.displayMessage_(txt, instance.listEvents[0], repo); | ||
if (options.watch) { | ||
if (!printed[event.created_at]) { | ||
filteredListEvents.push(event); | ||
} | ||
} | ||
} | ||
); | ||
}, intervalTime); | ||
}; | ||
else { | ||
filteredListEvents.push(event); | ||
} | ||
Notifications.prototype.loadNotifications_ = function(user, repo, mainCallback) { | ||
var instance = this; | ||
printed[event.created_at] = true; | ||
}); | ||
callback(); | ||
} | ||
]; | ||
base.github.events.getFromRepo({ | ||
user: user, | ||
repo: repo | ||
}, | ||
function(error, result) { | ||
if (error) { | ||
base.logger.error(error); | ||
process.exit(0); | ||
async.series(operations, function(err) { | ||
if (filteredListEvents.length) { | ||
logger.logTemplateFile('nt.handlebars', { | ||
user: options.user, | ||
repo: options.repo, | ||
latest: options.latest, | ||
watch: opt_watch, | ||
events: filteredListEvents | ||
}); | ||
} | ||
instance.listEvents = result; | ||
mainCallback(); | ||
}); | ||
}; | ||
Notifications.prototype.getMessage_ = function(i) { | ||
Notifications.prototype.watch = function() { | ||
var instance = this, | ||
intervalTime = 3000; | ||
instance.latest(); | ||
setInterval(function() { | ||
instance.latest(true); | ||
}, intervalTime); | ||
}; | ||
Notifications.prototype.getMessage_ = function(event) { | ||
var instance = this, | ||
txt = '', | ||
type = instance.listEvents[i].type, | ||
payload = instance.listEvents[i].payload; | ||
type = event.type, | ||
payload = event.payload; | ||
@@ -164,3 +170,3 @@ switch (type) { | ||
default: | ||
base.logger.error('event type not found: ' + clc.red(type)); | ||
logger.error('event type not found: ' + clc.red(type)); | ||
break; | ||
@@ -172,24 +178,2 @@ } | ||
Notifications.prototype.displayMessage_ = function(txt, event, repository) { | ||
var instance = this, | ||
time = clc.magenta(instance.getFormatTime_(event.created_at)), | ||
actor = clc.yellow(event.actor.login), | ||
repo = clc.cyanBright(repository); | ||
base.logger.info(time + ' - ' + actor + ' ' + txt + ' ' + repo); | ||
}; | ||
Notifications.prototype.getFormatTime_ = function(timestamp) { | ||
var time = '', | ||
findTime = timestamp.indexOf("T"); | ||
if (findTime !== -1) { | ||
time = timestamp.substring(11, 19); | ||
} else { | ||
base.logger.error('unable to parse date: ' + clc.red(timestamp)); | ||
} | ||
return time; | ||
}; | ||
exports.Impl = Notifications; |
@@ -17,16 +17,10 @@ /* | ||
mustache = require('mustache'), | ||
logger, | ||
logger = require('../logger'), | ||
stripNewLines, | ||
logWithPullNumber; | ||
logger = base.logger; | ||
logWithPullNumber = function(number, message, opt_type) { | ||
logger[opt_type || 'info'](message + ' [' + clc.magenta(number) + ']'); | ||
logger[opt_type || 'info'](clc.magenta('#' + number) + ' ' + message); | ||
}; | ||
stripNewLines = function(str) { | ||
return str.replace(/[\r\n\s]+/g, ' '); | ||
}; | ||
function PullRequest(options, currentRepository, currentBranch) { | ||
@@ -43,3 +37,2 @@ this.options = options; | ||
'close': Boolean, | ||
'comment': String, | ||
'detailed': Boolean, | ||
@@ -50,7 +43,10 @@ 'fetch': Boolean, | ||
'merge': Boolean, | ||
'message': String, | ||
'open': Boolean, | ||
'pull': Number, | ||
'rebase': Boolean, | ||
'repo': String, | ||
'state': [ 'open', 'closed' ], | ||
'submit': String | ||
'submit': String, | ||
'user': String | ||
}, | ||
@@ -61,12 +57,14 @@ shorthands: { | ||
'c': [ '--close' ], | ||
'C': [ '--comment' ], | ||
'd': [ '--detailed' ], | ||
'f': [ '--fetch' ], | ||
'l': [ '--list' ], | ||
'm': [ '--merge' ], | ||
'M': [ '--merge' ], | ||
'm': [ '--message' ], | ||
'o': [ '--open' ], | ||
'p': [ '--pull' ], | ||
'r': [ '--rebase' ], | ||
'R': [ '--rebase' ], | ||
'r': [ '--repo' ], | ||
'S': [ '--state' ], | ||
's': [ '--submit' ] | ||
's': [ '--submit' ], | ||
'u': [ '--user' ] | ||
}, | ||
@@ -77,10 +75,17 @@ description: 'Pull requests' | ||
PullRequest.FETCH_TYPE_CHECKOUT = 'checkout'; | ||
PullRequest.FETCH_TYPE_MERGE = 'merge'; | ||
PullRequest.FETCH_TYPE_REBASE = 'rebase'; | ||
PullRequest.FETCH_TYPE_SILENT = 'silent'; | ||
PullRequest.STATE_CLOSED = 'closed'; | ||
PullRequest.STATE_OPEN = 'open'; | ||
PullRequest.prototype.currentBranch = null; | ||
PullRequest.prototype.currentRepository = null; | ||
PullRequest.prototype.options = null; | ||
@@ -90,8 +95,8 @@ | ||
var instance = this, | ||
config, | ||
fetchType, | ||
options; | ||
options = instance.options, | ||
config = base.getGlobalConfig(), | ||
fetchType; | ||
config = base.getGlobalConfig(); | ||
options = instance.options; | ||
options.user = options.user || base.getUser(); | ||
options.repo = options.repo || instance.currentRepository; | ||
options.pull = options.pull || instance.getPullRequestNumberFromBranch_(); | ||
@@ -101,12 +106,12 @@ | ||
instance.close( | ||
options.pull, instance.currentBranch, | ||
options.branch || config.defaultbranch); | ||
instance.currentBranch, options.branch || config.defaultbranch); | ||
} | ||
if (options.comment) { | ||
instance.comment( | ||
instance.currentRepository, options.pull, options.comment); | ||
if (options.message) { | ||
instance.message(); | ||
} | ||
if (options.fetch) { | ||
fetchType = PullRequest.FETCH_TYPE_CHECKOUT; | ||
if (options.merge) { | ||
@@ -118,14 +123,8 @@ fetchType = PullRequest.FETCH_TYPE_MERGE; | ||
} | ||
else { | ||
fetchType = PullRequest.FETCH_TYPE_CHECKOUT; | ||
} | ||
instance.fetch( | ||
instance.currentRepository, options.pull, options.branch, fetchType); | ||
instance.fetch(fetchType); | ||
} | ||
if (options.fwd) { | ||
instance.forward( | ||
instance.currentRepository, options.pull, options.fwd, | ||
options.branch || config.defaultbranch); | ||
instance.forward(); | ||
} | ||
@@ -135,9 +134,6 @@ | ||
if (options.all) { | ||
instance.listFromAllRepositories( | ||
options.branch, options.detailed, options.state); | ||
instance.listFromAllRepositories(); | ||
} | ||
else { | ||
instance.list( | ||
instance.currentRepository, options.branch, options.detailed, | ||
options.state); | ||
instance.list(options.repo); | ||
} | ||
@@ -169,11 +165,7 @@ } | ||
PullRequest.prototype.addPullRequestExtras_ = function(number, opt_callback) { | ||
PullRequest.prototype.addPullRequestExtras_ = function(pull, opt_callback) { | ||
var instance = this, | ||
operations; | ||
operations = [ | ||
function(callback) { | ||
instance.formatPullRequestJson_(number, callback); | ||
} | ||
]; | ||
operations = []; | ||
@@ -183,50 +175,42 @@ async.series(operations, opt_callback); | ||
PullRequest.prototype.applyReplacements_ = function(output) { | ||
var config, | ||
regexPattern; | ||
PullRequest.prototype.close = function(pullBranch, branch, opt_callback) { | ||
var instance = this, | ||
options = instance.options, | ||
operations, | ||
pull; | ||
config = base.getGlobalConfig(); | ||
for (regexPattern in config.replace) { | ||
output = output.replace( | ||
new RegExp(regexPattern, "g"), config.replace[regexPattern]); | ||
} | ||
return output; | ||
}; | ||
PullRequest.prototype.close = function(number, pullBranch, branch) { | ||
var instance = this; | ||
if (!number) { | ||
if (!options.pull) { | ||
logger.error('unable to find the pull number, try --pull [number]'); | ||
} | ||
instance.getPullRequest_( | ||
base.getUser(), | ||
instance.currentRepository, | ||
number, | ||
function(err, pull) { | ||
instance.updatePullRequest_( | ||
instance.currentRepository, | ||
number, | ||
pull.title, | ||
pull.body, | ||
PullRequest.STATE_CLOSED, | ||
function(err) { | ||
operations = [ | ||
function(callback) { | ||
instance.getPullRequest( | ||
base.getUser(), instance.currentRepository, options.pull, function(err, data) { | ||
if (!err) { | ||
logWithPullNumber(number, PullRequest.STATE_CLOSED); | ||
git.checkout(branch, null, function(err) { | ||
if (!err) { | ||
git.exec('branch', [ '-D', pullBranch ], function(err) { | ||
if (!err) { | ||
logger.info('delete branch ' + pullBranch); | ||
} | ||
}); | ||
} | ||
}); | ||
pull = data; | ||
} | ||
callback(err); | ||
}); | ||
}); | ||
}, | ||
function(callback) { | ||
instance.updatePullRequest( | ||
instance.currentRepository, options.pull, pull.title, pull.body, | ||
PullRequest.STATE_CLOSED, callback); | ||
}, | ||
function(callback) { | ||
git.checkout(branch, null, callback); | ||
}, | ||
function(callback) { | ||
git.exec('branch', [ '-D', pullBranch ], callback); | ||
} | ||
]; | ||
async.series(operations, function(err, results) { | ||
if (err) { | ||
logger.error('unable to close', err); | ||
} | ||
opt_callback && opt_callback(err); | ||
}); | ||
}; | ||
@@ -261,124 +245,73 @@ | ||
PullRequest.prototype.comment = function(repository, number, body) { | ||
PullRequest.prototype.fetch = function(opt_type, opt_callback) { | ||
var instance = this, | ||
payload; | ||
body = instance.applyReplacements_(body); | ||
payload = { | ||
user: base.getUser(), | ||
repo: repository, | ||
number: number, | ||
body: body | ||
}; | ||
base.github.issues.createComment(payload, function(err) { | ||
if (err) { | ||
logger.error('unable to comment'); | ||
} | ||
logWithPullNumber(number, 'comment ' + clc.cyan(body)); | ||
}); | ||
}; | ||
PullRequest.prototype.fetch = function( | ||
repository, number, opt_branch, opt_fetchType, opt_callback) { | ||
var instance = this, | ||
options = instance.options, | ||
branch, | ||
headBranch, | ||
merge, | ||
operations1, | ||
operations2, | ||
operations, | ||
pull, | ||
repoUrl; | ||
opt_branch = opt_branch || instance.getPullRequestBranchName_(number); | ||
branch = options.branch || instance.getPullRequestBranchName_(options.pull); | ||
merge = function(rebase, abort, opt_mergeCallback) { | ||
git.merge(opt_branch, rebase, abort, function(err, data) { | ||
console.log(data); | ||
logWithPullNumber(number, (rebase ? 'rebasing' : 'merging') + ' into ' + instance.currentBranch); | ||
opt_mergeCallback && opt_mergeCallback(err, data); | ||
}); | ||
}; | ||
operations1 = [ | ||
operations = [ | ||
function(callback) { | ||
instance.getPullRequest_(base.getUser(), repository, number, callback); | ||
instance.getPullRequest(options.user, options.repo, options.pull, function(err, data) { | ||
if (!err) { | ||
pull = data; | ||
headBranch = pull.head.ref; | ||
repoUrl = pull.head.repo.git_url; | ||
} | ||
callback(err); | ||
}); | ||
}, | ||
function(callback) { | ||
git.exec('fetch', [ repoUrl, headBranch + ':' + branch ], callback); | ||
}, | ||
function(callback) { | ||
if (opt_type === PullRequest.FETCH_TYPE_REBASE) { | ||
git.merge(branch, true, true, callback); | ||
} | ||
else if (opt_type === PullRequest.FETCH_TYPE_MERGE) { | ||
git.merge(branch, false, true, callback); | ||
} | ||
else if (opt_type === PullRequest.FETCH_TYPE_CHECKOUT) { | ||
git.checkout(branch, null, callback); | ||
} | ||
else { | ||
callback(); | ||
} | ||
} | ||
]; | ||
async.series(operations1, function(err, results1) { | ||
pull = results1[0]; | ||
async.series(operations, function(err) { | ||
opt_callback && opt_callback(err); | ||
if (err) { | ||
logWithPullNumber(number, 'invalid pull request', 'error'); | ||
logger.error('unable to fetch'); | ||
} | ||
headBranch = pull.head.ref; | ||
repoUrl = pull.head.repo.git_url; | ||
git.exec('fetch', [ repoUrl, headBranch + ':' + opt_branch ], function(err) { | ||
operations2 = [ | ||
function(callback) { | ||
callback(err); | ||
}, | ||
function(callback) { | ||
if (opt_fetchType === PullRequest.FETCH_TYPE_REBASE) { | ||
merge(true, true, callback); | ||
} | ||
else if (opt_fetchType === PullRequest.FETCH_TYPE_MERGE) { | ||
merge(false, true, callback); | ||
} | ||
else if (opt_fetchType === PullRequest.FETCH_TYPE_CHECKOUT) { | ||
git.checkout(headBranch, opt_branch, function(err) { | ||
logger.info('checkout ' + opt_branch); | ||
callback(err); | ||
}); | ||
} | ||
else { | ||
callback(); | ||
} | ||
} | ||
]; | ||
async.series(operations2, function(err) { | ||
if (err) { | ||
logger.warn('unable to fetch'); | ||
} | ||
logWithPullNumber(number, 'fetch into branch ' + opt_branch); | ||
opt_callback && opt_callback(err); | ||
}); | ||
}); | ||
logWithPullNumber(options.pull, 'fetch into branch ' + branch); | ||
}); | ||
}; | ||
PullRequest.prototype.formatPullRequestJson_ = function(pull, opt_callback) { | ||
var created_at; | ||
created_at = pull.created_at; | ||
pull.body = stripNewLines(pull.body); | ||
pull.created_at = base.getDuration(created_at); | ||
pull.login = clc.green(pull.user.login); | ||
pull.number = clc.magenta(pull.number); | ||
pull.title = clc.cyan(pull.title); | ||
opt_callback = opt_callback && opt_callback(); | ||
}; | ||
PullRequest.prototype.forward = function(repository, number, toUser, toBranch) { | ||
PullRequest.prototype.forward = function() { | ||
var instance = this, | ||
operations, | ||
headBranch; | ||
options = instance.options, | ||
config = base.getGlobalConfig(), | ||
headBranch, | ||
operations; | ||
operations = [ | ||
function(callback) { | ||
instance.fetch( | ||
repository, number, null, PullRequest.FETCH_TYPE_SILENT, | ||
callback); | ||
instance.fetch(PullRequest.FETCH_TYPE_SILENT, callback); | ||
}, | ||
function(callback) { | ||
headBranch = instance.getPullRequestBranchName_(number); | ||
headBranch = instance.getPullRequestBranchName_(options.pull); | ||
instance.submit( | ||
toUser, instance.currentRepository, headBranch, toBranch, | ||
headBranch, callback); | ||
options.fwd, instance.currentRepository, headBranch, | ||
options.branch || config.defaultbranch, headBranch, callback); | ||
}, | ||
function(callback) { | ||
instance.close(headBranch, instance.currentBranch, callback); | ||
} | ||
@@ -394,3 +327,3 @@ ]; | ||
PullRequest.prototype.getPullRequest_ = function( | ||
PullRequest.prototype.getPullRequest = function( | ||
user, repository, number, opt_callback) { | ||
@@ -423,6 +356,5 @@ | ||
PullRequest.prototype.getPullRequestsFormattedJson_ = function( | ||
pulls, opt_branch, opt_callback) { | ||
PullRequest.prototype.getPullsTemplateJson_ = function(pulls, opt_callback) { | ||
var instance = this, | ||
options = instance.options, | ||
branch, | ||
@@ -442,8 +374,5 @@ branches, | ||
if (!opt_branch || opt_branch === branch) { | ||
// grouping pulls by branch | ||
if (!options.branch || options.branch === branch) { | ||
branches[branch] = branches[branch] || []; | ||
branches[branch].push(pull); | ||
// add extra asynchronous data to the pull request | ||
operations.push(function(callback) { | ||
@@ -463,46 +392,55 @@ instance.addPullRequestExtras_(pull, callback); | ||
async.parallel(operations, function() { | ||
opt_callback(formattedJson); | ||
async.parallel(operations, function(err) { | ||
opt_callback(err, formattedJson); | ||
}); | ||
}; | ||
PullRequest.prototype.getTemplate = function() { | ||
return fs.readFileSync(path.join(__dirname, 'templates', 'pr.mustache')).toString(); | ||
}; | ||
PullRequest.prototype.list = function( | ||
repository, opt_branch, opt_detailed, opt_state) { | ||
PullRequest.prototype.list = function(repo) { | ||
var instance = this, | ||
output, | ||
payload; | ||
options = instance.options, | ||
json, | ||
operations, | ||
payload, | ||
pulls; | ||
payload = { | ||
user: base.getUser(), | ||
repo: repository, | ||
state: opt_state | ||
repo: repo, | ||
state: options.state, | ||
user: options.user | ||
}; | ||
base.github.pullRequests.getAll(payload, function(err, pulls) { | ||
if (err || pulls.length === 0) { | ||
return; | ||
operations = [ | ||
function(callback) { | ||
base.github.pullRequests.getAll(payload, function(err, data) { | ||
if (!err) { | ||
pulls = data; | ||
if (!pulls.length) { | ||
err = 1; | ||
} | ||
} | ||
callback(err); | ||
}); | ||
}, | ||
function(callback) { | ||
instance.getPullsTemplateJson_(pulls, function(err, data) { | ||
if (!err) { | ||
json = data; | ||
} | ||
callback(err); | ||
}); | ||
} | ||
]; | ||
instance.getPullRequestsFormattedJson_( | ||
pulls, | ||
opt_branch, | ||
function(formattedJson) { | ||
formattedJson.detailed = opt_detailed; | ||
formattedJson.repository = repository; | ||
output = mustache.render(instance.getTemplate(), formattedJson); | ||
output = instance.applyReplacements_(output); | ||
console.log(output); | ||
}); | ||
async.series(operations, function(err) { | ||
if (!err) { | ||
json.repo = repo; | ||
json.user = options.user; | ||
json.detailed = options.detailed; | ||
logger.logTemplateFile('pr.handlebars', json); | ||
} | ||
}); | ||
}; | ||
PullRequest.prototype.listFromAllRepositories = function( | ||
opt_branch, opt_detailed, opt_state) { | ||
PullRequest.prototype.listFromAllRepositories = function() { | ||
var instance = this; | ||
@@ -512,3 +450,3 @@ | ||
repositories.forEach(function(repository) { | ||
instance.list(repository.name, opt_branch, opt_detailed, opt_state); | ||
instance.list(repository.name); | ||
}); | ||
@@ -549,11 +487,34 @@ }); | ||
} | ||
instance.close(number, pullBranch, branch); | ||
instance.close(pullBranch, branch); | ||
}); | ||
}; | ||
PullRequest.prototype.message = function() { | ||
var instance = this, | ||
options = instance.options, | ||
payload; | ||
message = base.applyReplacements(options.message); | ||
payload = { | ||
user: base.getUser(), | ||
repo: options.repo, | ||
number: options.pull, | ||
body: message | ||
}; | ||
base.github.issues.createComment(payload, function(err) { | ||
if (err) { | ||
logger.error('unable to message', err); | ||
} | ||
logWithPullNumber(options.pull, clc.cyan(message)); | ||
}); | ||
}; | ||
PullRequest.prototype.open = function(repository, number) { | ||
var instance = this; | ||
instance.getPullRequest_(base.getUser(), repository, number, function(err, pull) { | ||
instance.updatePullRequest_( | ||
instance.getPullRequest(base.getUser(), repository, number, function(err, pull) { | ||
instance.updatePullRequest( | ||
repository, | ||
@@ -593,6 +554,3 @@ number, | ||
function(callback) { | ||
logger.info('pushing branch'); | ||
git.exec('push', [ 'origin', headBranch ], function() { | ||
callback(); | ||
}); | ||
git.exec('push', [ 'origin', headBranch ], callback); | ||
}, | ||
@@ -609,5 +567,3 @@ function(callback) { | ||
head: user + ':' + headBranch | ||
}, function(err, pull) { | ||
callback(err, pull); | ||
}); | ||
}, callback); | ||
} | ||
@@ -636,3 +592,3 @@ ]; | ||
PullRequest.prototype.updatePullRequest_ = function( | ||
PullRequest.prototype.updatePullRequest = function( | ||
repository, number, title, opt_body, state, opt_callback) { | ||
@@ -644,3 +600,3 @@ | ||
if (opt_body) { | ||
opt_body = instance.applyReplacements_(opt_body); | ||
opt_body = base.applyReplacements(opt_body); | ||
} | ||
@@ -647,0 +603,0 @@ |
@@ -93,4 +93,4 @@ /* | ||
} | ||
opt_callback = opt_callback && opt_callback(err, data); | ||
opt_callback && opt_callback(err, data); | ||
}); | ||
}; |
{ | ||
"name": "gh", | ||
"description": "Github command line tools helps you improve using git and github from the terminal.", | ||
"version": "0.0.7", | ||
"version": "0.1.0", | ||
"author": { | ||
@@ -37,3 +37,3 @@ "name": "Eduardo Lundgren", | ||
"moment ": "2.0.0", | ||
"mustache ": "0.7.2", | ||
"handlebars ": "1.0.11", | ||
"git-wrapper": "0.1.1", | ||
@@ -40,0 +40,0 @@ "github": "0.1.8", |
@@ -1,2 +0,2 @@ | ||
# node-gh [![Build Status](https://secure.travis-ci.org/eduardolundgren/node-gh.png?branch=master)](https://travis-ci.org/eduardolundgren/node-gh) | ||
# node-gh [![Build Status](https://secure.travis-ci.org/eduardolundgren/node-gh.png?branch=master)](https://travis-ci.org/eduardolundgren/node-gh) [![NPM version](https://badge.fury.io/js/gh.png)](http://badge.fury.io/js/gh) | ||
@@ -73,6 +73,6 @@ Github command line tools helps you improve using Git and Github from the terminal. | ||
* Comment in a pull request. | ||
* Add a message in a pull request. | ||
``` | ||
gh pr --pull 1 --comment "Merged, thank you!". | ||
gh pr --pull 1 --message "Merged, thank you!" | ||
``` | ||
@@ -122,2 +122,22 @@ | ||
* Display/Watch the latest activities a certain repository. | ||
``` | ||
gh nt --latest --user eduardolundgren --repo node-gh | ||
``` | ||
### Issues | ||
* List all issues on the current repository. | ||
``` | ||
gh is --list | ||
``` | ||
* List all issues on a certain repository. | ||
``` | ||
gh is --list --user eduardolundgren --repo node-gh | ||
``` | ||
## Team | ||
@@ -131,2 +151,4 @@ | ||
* **v0.0.8** May 25, 2013 | ||
* Add Issues task | ||
* **v0.0.7** May 24, 2013 | ||
@@ -150,3 +172,3 @@ * Add pull request forward command | ||
* **v0.0.2** May 16, 2013 | ||
* Add fetch, open/close, comment | ||
* Add fetch, open/close, message | ||
* Use moment humanize utility | ||
@@ -153,0 +175,0 @@ * **v0.0.1** May 14, 2013 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41053
19
1092
176
8
+ Addedhandlebars @1.0.11
- Removedmustache @0.7.2