Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gh

Package Overview
Dependencies
Maintainers
3
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gh - npm Package Compare versions

Comparing version 1.11.10 to 1.11.11

20

lib/base.js

@@ -21,3 +21,3 @@ /*

exports.clone = function(o) {
exports.clone = function (o) {
return JSON.parse(JSON.stringify(o));

@@ -28,3 +28,3 @@ };

exports.load = function() {
exports.load = function () {
var config = configs.getConfig();

@@ -41,3 +41,3 @@

exports.asyncReadPackages = function(callback) {
exports.asyncReadPackages = function (callback) {
function async(err, data) {

@@ -53,3 +53,3 @@ if (err) {

configs.getPlugins().forEach(function(plugin) {
configs.getPlugins().forEach(function (plugin) {
fs.readFile(path.join(

@@ -60,3 +60,3 @@ configs.getNodeModulesGlobalPath(), plugin, 'package.json'), async);

exports.notifyVersion = function(pkg) {
exports.notifyVersion = function (pkg) {
var notifier = updateNotifier({pkg: pkg}),

@@ -77,7 +77,7 @@ update,

exports.checkVersion = function() {
exports.checkVersion = function () {
exports.asyncReadPackages(exports.notifyVersion);
};
exports.expandAliases = function(options) {
exports.expandAliases = function (options) {
var config = configs.getConfig();

@@ -92,4 +92,4 @@

exports.find = function(filepath, opt_pattern) {
return fs.readdirSync(filepath).filter(function(file) {
exports.find = function (filepath, opt_pattern) {
return fs.readdirSync(filepath).filter(function (file) {
return (opt_pattern || /.*/).test(file);

@@ -99,3 +99,3 @@ });

exports.getUser = function() {
exports.getUser = function () {
return configs.getConfig().github_user;

@@ -102,0 +102,0 @@ };

@@ -20,7 +20,7 @@ /*

CmdAnonymizer.prototype.extractArgument = function(word) {
CmdAnonymizer.prototype.extractArgument = function (word) {
return word.replace(/-{0,2}/, '');
};
CmdAnonymizer.prototype.isOptionValue = function(option, value) {
CmdAnonymizer.prototype.isOptionValue = function (option, value) {
var choice = this.options[option],

@@ -34,3 +34,3 @@ booleans = ['true', 'false'];

CmdAnonymizer.prototype.isValueInOptions = function(options, value) {
CmdAnonymizer.prototype.isValueInOptions = function (options, value) {
if (!(options instanceof Array)) {

@@ -40,3 +40,3 @@ return this.isOptionValue(options, value);

return options.some(function(each) {
return options.some(function (each) {
return this.isOptionValue(this.extractArgument(each), value);

@@ -46,3 +46,3 @@ }, this);

CmdAnonymizer.prototype.classify = function(word) {
CmdAnonymizer.prototype.classify = function (word) {
var arg = this.extractArgument(word),

@@ -86,3 +86,3 @@ whitelist = ['verbose', 'no-hooks'];

CmdAnonymizer.prototype.resolve = function(cmd) {
CmdAnonymizer.prototype.resolve = function (cmd) {
// quasi-strict white list approach (best-effort)

@@ -97,3 +97,3 @@

CmdAnonymizer.prototype.resolveToString = function(cmd) {
CmdAnonymizer.prototype.resolveToString = function (cmd) {
return this.resolve(cmd).join(' ');

@@ -100,0 +100,0 @@ };

@@ -30,3 +30,3 @@ /*

if (commands) {
return commands.some(function(c) {
return commands.some(function (c) {
return options[c] !== undefined;

@@ -64,3 +64,3 @@ });

commandFiles = base.find(commandDir, /\.js$/i);
commandFiles.every(function(file) {
commandFiles.every(function (file) {
commandPath = path.join(commandDir, file);

@@ -113,3 +113,3 @@ Command = require(commandPath).Impl;

operations.push(function(callback) {
operations.push(function (callback) {
base.checkVersion();

@@ -122,3 +122,3 @@

tracker.askPermission(null, function() {
tracker.askPermission(null, function () {
callback();

@@ -128,3 +128,3 @@ });

operations.push(function(callback) {
operations.push(function (callback) {
var module = remain[0];

@@ -169,6 +169,9 @@

async.series(operations, function() {
async.series(operations, function () {
var iterativeValues,
remoteUrl = git.getRemoteUrl(options.remote);
options.isTTY = {};
options.isTTY.in = Boolean(process.stdin.isTTY);
options.isTTY.out = Boolean(process.stdout.isTTY);
options.loggedUser = base.getUser();

@@ -196,3 +199,3 @@ options.remoteUser = git.getUserFromRemoteUrl(remoteUrl);

iterativeValues.forEach(function(value) {
iterativeValues.forEach(function (value) {
options = base.clone(options);

@@ -213,3 +216,3 @@

exports.run = function() {
exports.run = function () {
if (!fs.existsSync(configs.getUserHomePath())) {

@@ -216,0 +219,0 @@ configs.createGlobalConfig();

@@ -48,3 +48,3 @@ /*

},
payload: function(payload, options) {
payload: function (payload, options) {
if (payload[0]) {

@@ -62,3 +62,3 @@ options.add = payload[0];

Alias.prototype.run = function() {
Alias.prototype.run = function () {
var instance = this,

@@ -77,3 +77,3 @@ options = instance.options;

if (options.list) {
instance.list(function(err, data) {
instance.list(function (err, data) {
var item;

@@ -95,3 +95,3 @@

Alias.prototype.add = function() {
Alias.prototype.add = function () {
var instance = this,

@@ -103,7 +103,7 @@ options = instance.options;

Alias.prototype.list = function(opt_callback) {
Alias.prototype.list = function (opt_callback) {
opt_callback && opt_callback(null, config.alias);
};
Alias.prototype.remove = function() {
Alias.prototype.remove = function () {
var instance = this,

@@ -110,0 +110,0 @@ options = instance.options;

@@ -65,3 +65,3 @@ /*

},
payload: function(payload, options) {
payload: function (payload, options) {
options.list = true;

@@ -73,3 +73,3 @@ }

Gists.prototype.run = function() {
Gists.prototype.run = function () {
var instance = this,

@@ -89,3 +89,3 @@ operations,

if (options.delete) {
hooks.invoke('gists.delete', instance, function(afterHooksCallback) {
hooks.invoke('gists.delete', instance, function (afterHooksCallback) {
logger.log('Deleting gist ' + logger.colors.green(options.loggedUser + '/' + options.delete));

@@ -100,5 +100,5 @@

}
], function(answers) {
], function (answers) {
if (answers.confirmation.toLowerCase() === 'y') {
instance.delete(options.delete, function(err) {
instance.delete(options.delete, function (err) {
if (err) {

@@ -120,6 +120,6 @@ logger.error('Can\'t delete gist.');

if (options.fork) {
hooks.invoke('gists.fork', instance, function(afterHooksCallback) {
hooks.invoke('gists.fork', instance, function (afterHooksCallback) {
logger.log('Forking gist on ' + logger.colors.green(options.loggedUser));
instance.fork(options.fork, function(err, gist) {
instance.fork(options.fork, function (err, gist) {
if (err) {

@@ -139,3 +139,3 @@ logger.error(JSON.parse(err.message).message);

instance.list(options.user, function(err) {
instance.list(options.user, function (err) {
if (err) {

@@ -149,3 +149,3 @@ logger.error('Can\'t list gists for ' + options.user + '.');

if (options.new) {
hooks.invoke('gists.new', instance, function(afterHooksCallback) {
hooks.invoke('gists.new', instance, function (afterHooksCallback) {
var privacy = (options.private) ? 'private' : 'public';

@@ -159,3 +159,3 @@

instance.new(options.new, options.content, function(err, gist) {
instance.new(options.new, options.content, function (err, gist) {
if (gist) {

@@ -178,7 +178,7 @@ options.id = gist.id;

Gists.prototype.browser = function(gist) {
Gists.prototype.browser = function (gist) {
openUrl('https://gist.github.com/' + gist);
};
Gists.prototype.delete = function(id, opt_callback) {
Gists.prototype.delete = function (id, opt_callback) {
var payload = {

@@ -191,3 +191,3 @@ id: id

Gists.prototype.fork = function(id, opt_callback) {
Gists.prototype.fork = function (id, opt_callback) {
var payload = {

@@ -200,3 +200,3 @@ id: id

Gists.prototype.list = function(user, opt_callback) {
Gists.prototype.list = function (user, opt_callback) {
var instance = this,

@@ -209,3 +209,3 @@ payload;

base.github.gists.getFromUser(payload, function(err, gists) {
base.github.gists.getFromUser(payload, function (err, gists) {
instance.listCallback_(err, gists, opt_callback);

@@ -215,3 +215,3 @@ });

Gists.prototype.listCallback_ = function(err, gists, opt_callback) {
Gists.prototype.listCallback_ = function (err, gists, opt_callback) {
var instance = this,

@@ -225,3 +225,3 @@ options = instance.options;

if (gists && gists.length > 0) {
gists.forEach(function(gist) {
gists.forEach(function (gist) {
logger.log(logger.colors.yellow(gist.owner.login + '/' + gist.id) +

@@ -241,3 +241,3 @@ ' ' + logger.getDuration(gist.updated_at));

Gists.prototype.new = function(name, content, opt_callback) {
Gists.prototype.new = function (name, content, opt_callback) {
var instance = this,

@@ -244,0 +244,0 @@ file = {},

@@ -36,3 +36,3 @@ /*

},
payload: function(payload, options) {
payload: function (payload, options) {
options.world = true;

@@ -44,3 +44,3 @@ }

Hello.prototype.run = function() {
Hello.prototype.run = function () {
var instance = this,

@@ -54,3 +54,3 @@ options = instance.options;

Hello.prototype.world = function() {
Hello.prototype.world = function () {
logger.log('hello world :)');

@@ -57,0 +57,0 @@ };

@@ -47,3 +47,3 @@ /*

Help.prototype.run = function() {
Help.prototype.run = function () {
var instance = this,

@@ -64,3 +64,3 @@ commands = [],

plugins.forEach(function(plugin) {
plugins.forEach(function (plugin) {
try {

@@ -80,3 +80,3 @@ files.push(configs.getPluginPath(plugin));

files.forEach(function(dir) {
files.forEach(function (dir) {
var cmd = require(path.resolve(cmdDir, dir)),

@@ -122,7 +122,7 @@ alias = cmd.Impl.DETAILS.alias || '',

Help.prototype.listFlags_ = function(command) {
Help.prototype.listFlags_ = function (command) {
var flags = command.flags,
content = '';
flags.forEach(function(flag) {
flags.forEach(function (flag) {
content += ' ';

@@ -154,3 +154,3 @@

Help.prototype.listCommands_ = function(commands) {
Help.prototype.listCommands_ = function (commands) {
var content = 'usage: gh <command> [payload] [--flags] [--verbose] [--no-hooks]\n\n',

@@ -184,3 +184,3 @@ pos,

Help.prototype.groupOptions_ = function(details) {
Help.prototype.groupOptions_ = function (details) {
var instance = this,

@@ -195,7 +195,7 @@ cmd,

options.forEach(function(option) {
options.forEach(function (option) {
var foundShorthand,
type;
shorthands.forEach(function(shorthand) {
shorthands.forEach(function (shorthand) {
var shorthandValue = details.shorthands[shorthand][0];

@@ -222,3 +222,3 @@

Help.prototype.getType_ = function(type) {
Help.prototype.getType_ = function (type) {
var types,

@@ -274,3 +274,3 @@ separator = ', ';

Help.prototype.isCommand_ = function(details, option) {
Help.prototype.isCommand_ = function (details, option) {
if (details.commands && (details.commands.indexOf(option) > -1)) {

@@ -277,0 +277,0 @@ return true;

@@ -86,3 +86,3 @@ /*

},
payload: function(payload, options) {
payload: function (payload, options) {
if (payload[0]) {

@@ -110,3 +110,3 @@ if (/^\d+$/.test(payload[0])) {

Issue.prototype.run = function() {
Issue.prototype.run = function () {
var instance = this,

@@ -122,3 +122,3 @@ options = instance.options;

if (options.close) {
hooks.invoke('issue.close', instance, function(afterHooksCallback) {
hooks.invoke('issue.close', instance, function (afterHooksCallback) {
options.state = Issue.STATE_CLOSED;

@@ -129,3 +129,3 @@

instance.close(function(err, issue) {
instance.close(function (err, issue) {
if (err) {

@@ -145,3 +145,3 @@ logger.error('Can\'t close issue.');

instance.comment(function(err, issue) {
instance.comment(function (err, issue) {
if (err) {

@@ -161,3 +161,3 @@ logger.error('Can\'t add comment.');

instance.listFromAllRepositories(function(err) {
instance.listFromAllRepositories(function (err) {
if (err) {

@@ -173,3 +173,3 @@ logger.error('Can\'t list issues for ' + options.user + '.');

instance.list(options.user, options.repo, function(err) {
instance.list(options.user, options.repo, function (err) {
if (err) {

@@ -184,6 +184,6 @@ logger.error('Can\'t list issues on ' + options.user + '/' + options.repo);

if (options.new) {
hooks.invoke('issue.new', instance, function(afterHooksCallback) {
hooks.invoke('issue.new', instance, function (afterHooksCallback) {
logger.log('Creating a new issue on ' + logger.colors.green(options.user + '/' + options.repo));
instance.new(function(err, issue) {
instance.new(function (err, issue) {
if (err) {

@@ -205,7 +205,7 @@ logger.error('Can\'t create new issue.');

if (options.open) {
hooks.invoke('issue.open', instance, function(afterHooksCallback) {
hooks.invoke('issue.open', instance, function (afterHooksCallback) {
logger.log('Opening issue ' + logger.colors.green('#' + options.number) +
' on ' + logger.colors.green(options.user + '/' + options.repo));
instance.open(function(err, issue) {
instance.open(function (err, issue) {
if (err) {

@@ -224,3 +224,3 @@ logger.error('Can\'t open issue.');

Issue.prototype.browser = function(user, repo, number) {
Issue.prototype.browser = function (user, repo, number) {
if (!number) {

@@ -233,6 +233,6 @@ number = '';

Issue.prototype.close = function(opt_callback) {
Issue.prototype.close = function (opt_callback) {
var instance = this;
instance.getIssue_(function(err, issue) {
instance.getIssue_(function (err, issue) {
if (err) {

@@ -247,3 +247,3 @@ opt_callback && opt_callback(err);

Issue.prototype.comment = function(opt_callback) {
Issue.prototype.comment = function (opt_callback) {
var instance = this,

@@ -266,3 +266,3 @@ options = instance.options,

Issue.prototype.editIssue_ = function(title, state, opt_callback) {
Issue.prototype.editIssue_ = function (title, state, opt_callback) {
var instance = this,

@@ -288,3 +288,3 @@ options = instance.options,

Issue.prototype.getIssue_ = function(opt_callback) {
Issue.prototype.getIssue_ = function (opt_callback) {
var instance = this,

@@ -303,3 +303,3 @@ options = instance.options,

Issue.prototype.list = function(user, repo, opt_callback) {
Issue.prototype.list = function (user, repo, opt_callback) {
var instance = this,

@@ -326,7 +326,7 @@ options = instance.options,

if (options.milestone) {
operations.push(function(callback) {
operations.push(function (callback) {
base.github.issues.getAllMilestones({
repo: repo,
user: user
}, function(err, results) {
}, function (err, results) {
if (err) {

@@ -353,7 +353,7 @@ logger.warn(err.message);

operations.push(function(callback) {
operations.push(function (callback) {
base.github.issues.repoIssues(payload, callback);
});
async.series(operations, function(err, results) {
async.series(operations, function (err, results) {
var issues = [];

@@ -366,3 +366,3 @@

results.forEach(function(result) {
results.forEach(function (result) {
if (result) {

@@ -373,3 +373,3 @@ issues = issues.concat(result);

issues.sort(function(a, b) {
issues.sort(function (a, b) {
return a.number > b.number ? -1 : 1;

@@ -379,7 +379,7 @@ });

if (issues && issues.length > 0) {
issues.forEach(function(issue) {
issues.forEach(function (issue) {
var labels = issue.label || [];
logger.log(logger.colors.green('#' + issue.number) + ' ' + issue.title +
logger.colors.magenta('@' + user.login + ' (' + logger.getDuration(issues.created_at) + ')'));
logger.log(logger.colors.green('#' + issue.number) + ' ' + issue.title + ' ' +
logger.colors.magenta('@' + issue.user.login + ' (' + logger.getDuration(issues.created_at) + ')'));

@@ -391,3 +391,3 @@ if (options.detailed) {

labels.forEach(function(label) {
labels.forEach(function (label) {
labels.push(label.name);

@@ -414,3 +414,3 @@ });

Issue.prototype.listFromAllRepositories = function(opt_callback) {
Issue.prototype.listFromAllRepositories = function (opt_callback) {
var instance = this,

@@ -425,3 +425,3 @@ options = instance.options,

base.github.repos.getAll(payload, function(err, repositories) {
base.github.repos.getAll(payload, function (err, repositories) {
if (err) {

@@ -431,3 +431,3 @@ opt_callback && opt_callback(err);

else {
repositories.forEach(function(repository) {
repositories.forEach(function (repository) {
instance.list(repository.owner.login, repository.name, opt_callback);

@@ -439,3 +439,3 @@ });

Issue.prototype.new = function(opt_callback) {
Issue.prototype.new = function (opt_callback) {
var instance = this,

@@ -469,6 +469,6 @@ options = instance.options,

Issue.prototype.open = function(opt_callback) {
Issue.prototype.open = function (opt_callback) {
var instance = this;
instance.getIssue_(function(err, issue) {
instance.getIssue_(function (err, issue) {
if (err) {

@@ -475,0 +475,0 @@ opt_callback && opt_callback(err);

@@ -52,3 +52,3 @@ /*

},
payload: function(payload, options) {
payload: function (payload, options) {
options.latest = true;

@@ -60,3 +60,3 @@ }

Notifications.prototype.run = function() {
Notifications.prototype.run = function () {
var instance = this,

@@ -76,3 +76,3 @@ options = instance.options;

Notifications.prototype.latest = function(opt_watch) {
Notifications.prototype.latest = function (opt_watch) {
var instance = this,

@@ -87,3 +87,3 @@ options = instance.options,

function(callback) {
function (callback) {
payload = {

@@ -94,3 +94,3 @@ user: options.user,

base.github.events.getFromRepo(payload, function(err, data) {
base.github.events.getFromRepo(payload, function (err, data) {
if (!err) {

@@ -102,4 +102,4 @@ listEvents = data;

},
function(callback) {
listEvents.forEach(function(event) {
function (callback) {
listEvents.forEach(function (event) {
event.txt = instance.getMessage_(event);

@@ -122,3 +122,3 @@

async.series(operations, function(err) {
async.series(operations, function (err) {
if (err) {

@@ -134,3 +134,3 @@ logger.error('Can\'t get latest notifications.');

filteredListEvents.forEach(function(event) {
filteredListEvents.forEach(function (event) {
logger.log(logger.colors.magenta('@' + event.actor.login) + ' ' +

@@ -144,3 +144,3 @@ event.txt + ' ' + logger.colors.cyan(options.repo) + ' ' +

Notifications.prototype.watch = function() {
Notifications.prototype.watch = function () {
var instance = this,

@@ -151,3 +151,3 @@ intervalTime = 3000;

setInterval(function() {
setInterval(function () {
instance.latest(true);

@@ -157,3 +157,3 @@ }, intervalTime);

Notifications.prototype.getMessage_ = function(event) {
Notifications.prototype.getMessage_ = function (event) {
var txt = '',

@@ -160,0 +160,0 @@ type = event.type,

@@ -107,3 +107,3 @@ /*

},
payload: function(payload, options) {
payload: function (payload, options) {
if (payload[0]) {

@@ -135,3 +135,3 @@ options.fetch = true;

PullRequest.prototype.run = function() {
PullRequest.prototype.run = function () {
var instance = this,

@@ -200,3 +200,3 @@ options = instance.options;

PullRequest.prototype.addComplexityParamToPulls_ = function(pulls, opt_callback) {
PullRequest.prototype.addComplexityParamToPulls_ = function (pulls, opt_callback) {
var instance = this,

@@ -207,6 +207,6 @@ metrics,

operations = pulls.map(function(pull) {
return function(callback) {
operations = pulls.map(function (pull) {
return function (callback) {
options.number = pull.number;
instance.getPullRequest_(function(err, pull2) {
instance.getPullRequest_(function (err, pull2) {
if (!err) {

@@ -227,3 +227,3 @@ metrics = {

async.series(operations, function(err, results) {
async.series(operations, function (err, results) {
opt_callback(err, results);

@@ -233,7 +233,7 @@ });

PullRequest.prototype.browser = function(user, repo, number) {
PullRequest.prototype.browser = function (user, repo, number) {
openUrl('https://github.com/' + user + '/' + repo + '/pull/' + number);
};
PullRequest.prototype.calculateComplexity_ = function(metrics) {
PullRequest.prototype.calculateComplexity_ = function (metrics) {
var complexity,

@@ -255,3 +255,3 @@ weightAddition = 2,

PullRequest.prototype.close = function(opt_callback) {
PullRequest.prototype.close = function (opt_callback) {
var instance = this,

@@ -264,4 +264,4 @@ options = instance.options,

function(callback) {
instance.getPullRequest_(function(err, data) {
function (callback) {
instance.getPullRequest_(function (err, data) {
if (!err) {

@@ -273,7 +273,7 @@ pull = data;

},
function(callback) {
function (callback) {
instance.updatePullRequest_(
pull.title, pull.body, PullRequest.STATE_CLOSED, callback);
},
function(callback) {
function (callback) {
if (options.pullBranch === options.currentBranch) {

@@ -291,3 +291,3 @@ git.checkout(options.branch);

async.series(operations, function(err) {
async.series(operations, function (err) {
opt_callback && opt_callback(err, pull);

@@ -297,3 +297,3 @@ });

PullRequest.prototype.checkPullRequestIntegrity_ = function(originalError, user, opt_callback) {
PullRequest.prototype.checkPullRequestIntegrity_ = function (originalError, user, opt_callback) {
var instance = this,

@@ -310,5 +310,5 @@ options = instance.options,

base.github.pullRequests.getAll(payload, function(err, pulls) {
base.github.pullRequests.getAll(payload, function (err, pulls) {
if (!err) {
pulls.forEach(function(data) {
pulls.forEach(function (data) {
if ((data.base.ref === options.branch) &&

@@ -331,3 +331,3 @@ (data.head.ref === options.currentBranch) &&

PullRequest.prototype.fetch = function(opt_type, opt_callback) {
PullRequest.prototype.fetch = function (opt_type, opt_callback) {
var instance = this,

@@ -338,3 +338,3 @@ options = instance.options,

instance.getPullRequest_(function(err, pull) {
instance.getPullRequest_(function (err, pull) {
if (err) {

@@ -358,7 +358,7 @@ opt_callback && opt_callback(err);

PullRequest.prototype.filterPullsSentByMe_ = function(pulls) {
PullRequest.prototype.filterPullsSentByMe_ = function (pulls) {
var instance = this,
options = instance.options;
pulls = pulls.filter(function(pull) {
pulls = pulls.filter(function (pull) {
if (options.loggedUser === pull.user.login) {

@@ -372,3 +372,3 @@ return pull;

PullRequest.prototype.forward = function(opt_callback) {
PullRequest.prototype.forward = function (opt_callback) {
var instance = this,

@@ -382,4 +382,4 @@ options = instance.options,

function(callback) {
instance.fetch(PullRequest.FETCH_TYPE_SILENT, function(err, data) {
function (callback) {
instance.fetch(PullRequest.FETCH_TYPE_SILENT, function (err, data) {
pull = data;

@@ -389,3 +389,3 @@ callback(err);

},
function(callback) {
function (callback) {
options.title = pull.title;

@@ -395,3 +395,3 @@ options.description = pull.body;

instance.submit(options.fwd, function(err, data) {
instance.submit(options.fwd, function (err, data) {
if (err) {

@@ -410,3 +410,3 @@ callback(err);

async.series(operations, function(err) {
async.series(operations, function (err) {
opt_callback && opt_callback(err, submittedPull);

@@ -416,3 +416,3 @@ });

PullRequest.prototype.getPullRequest_ = function(opt_callback) {
PullRequest.prototype.getPullRequest_ = function (opt_callback) {
var instance = this,

@@ -431,3 +431,3 @@ options = instance.options,

PullRequest.prototype.getBranchNameFromPullNumber_ = function(number) {
PullRequest.prototype.getBranchNameFromPullNumber_ = function (number) {
if (number) {

@@ -438,3 +438,3 @@ return config.pull_branch_name_prefix + number;

PullRequest.prototype.getPullRequestNumberFromBranch_ = function() {
PullRequest.prototype.getPullRequestNumberFromBranch_ = function () {
var instance = this,

@@ -451,3 +451,3 @@ options = instance.options,

PullRequest.prototype.getPullsTemplateJson_ = function(pulls, opt_callback) {
PullRequest.prototype.getPullsTemplateJson_ = function (pulls, opt_callback) {
var instance = this,

@@ -464,3 +464,3 @@ options = instance.options,

pulls.forEach(function(pull) {
pulls.forEach(function (pull) {
branch = pull.base.ref;

@@ -474,3 +474,3 @@

Object.keys(branches).forEach(function(branch) {
Object.keys(branches).forEach(function (branch) {
json.branches.push({

@@ -486,3 +486,3 @@ name: branch,

PullRequest.prototype.printPullInfo_ = function(pull) {
PullRequest.prototype.printPullInfo_ = function (pull) {
var options = this.options;

@@ -510,3 +510,3 @@

PullRequest.prototype.get = function(user, repo, number) {
PullRequest.prototype.get = function (user, repo, number) {
var pr = this,

@@ -521,3 +521,3 @@ payload;

base.github.pullRequests.get(payload, function(err, pull) {
base.github.pullRequests.get(payload, function (err, pull) {
if (err) {

@@ -532,3 +532,3 @@ logger.warn('Can\'t get pull request ' + user + '/' + repo + '/' + number);

PullRequest.prototype.list = function(user, repo, opt_callback) {
PullRequest.prototype.list = function (user, repo, opt_callback) {
var instance = this,

@@ -558,4 +558,4 @@ options = instance.options,

function(callback) {
base.github.pullRequests.getAll(payload, function(err, data) {
function (callback) {
base.github.pullRequests.getAll(payload, function (err, data) {
pulls = [];

@@ -584,5 +584,5 @@

function(callback) {
function (callback) {
if (options.sort && options.sort === PullRequest.SORT_COMPLEXITY) {
instance.addComplexityParamToPulls_(pulls, function(err, data) {
instance.addComplexityParamToPulls_(pulls, function (err, data) {
if (!err) {

@@ -600,4 +600,4 @@ pulls = instance.sortPullsByComplexity_(data);

function(callback) {
instance.getPullsTemplateJson_(pulls, function(err, data) {
function (callback) {
instance.getPullsTemplateJson_(pulls, function (err, data) {
if (!err) {

@@ -611,7 +611,7 @@ json = data;

async.series(operations, function(err) {
async.series(operations, function (err) {
if (!err && pulls.length) {
logger.log(logger.colors.yellow(user + '/' + repo));
json.branches.forEach(function(branch) {
json.branches.forEach(function (branch) {
logger.log(branch.name + ' (' + branch.total + ')');

@@ -627,3 +627,3 @@

PullRequest.prototype.listFromAllRepositories = function(opt_callback) {
PullRequest.prototype.listFromAllRepositories = function (opt_callback) {
var instance = this,

@@ -646,3 +646,3 @@ options = instance.options,

base.github.repos[apiMethod](payload, function(err, repositories) {
base.github.repos[apiMethod](payload, function (err, repositories) {
if (err) {

@@ -652,3 +652,3 @@ opt_callback && opt_callback(err);

else {
repositories.forEach(function(repository) {
repositories.forEach(function (repository) {
instance.list(repository.owner.login, repository.name, opt_callback);

@@ -660,3 +660,3 @@ });

PullRequest.prototype.listFromAllOrgRepositories = function(opt_callback) {
PullRequest.prototype.listFromAllOrgRepositories = function (opt_callback) {
var instance = this,

@@ -672,3 +672,3 @@ options = instance.options,

base.github.repos.getFromOrg(payload, function(err, repositories) {
base.github.repos.getFromOrg(payload, function (err, repositories) {
if (err) {

@@ -678,3 +678,3 @@ opt_callback && opt_callback(err);

else {
repositories.forEach(function(repository) {
repositories.forEach(function (repository) {
instance.list(repository.owner.login, repository.name, opt_callback);

@@ -686,3 +686,3 @@ });

PullRequest.prototype.merge = function(opt_callback) {
PullRequest.prototype.merge = function (opt_callback) {
var instance = this,

@@ -703,6 +703,6 @@ options = instance.options,

PullRequest.prototype.open = function(opt_callback) {
PullRequest.prototype.open = function (opt_callback) {
var instance = this;
instance.getPullRequest_(function(err, pull) {
instance.getPullRequest_(function (err, pull) {
if (err) {

@@ -718,3 +718,3 @@ opt_callback && opt_callback(err);

PullRequest.prototype.setMergeCommentRequiredOptions_ = function(opt_callback) {
PullRequest.prototype.setMergeCommentRequiredOptions_ = function (opt_callback) {
var options = this.options,

@@ -735,7 +735,7 @@ lastCommitSHA = git.getLastCommitSHA(),

PullRequest.prototype.sortPullsByComplexity_ = function(data) {
PullRequest.prototype.sortPullsByComplexity_ = function (data) {
var instance = this,
options = instance.options;
data.sort(function(a, b) {
data.sort(function (a, b) {
if (a.complexity > b.complexity) {

@@ -759,3 +759,3 @@ return -1;

PullRequest.prototype.submit = function(user, opt_callback) {
PullRequest.prototype.submit = function (user, opt_callback) {
var instance = this,

@@ -770,7 +770,7 @@ options = instance.options,

function(callback) {
function (callback) {
git.push(config.default_remote, pullBranch);
callback();
},
function(callback) {
function (callback) {
if (!options.title) {

@@ -782,3 +782,3 @@ options.title = git.getLastCommitMessage(pullBranch);

},
function(callback) {
function (callback) {
var payload = {

@@ -803,3 +803,3 @@ base: options.branch,

async.series(operations, function(err, results) {
async.series(operations, function (err, results) {
if (err) {

@@ -814,3 +814,3 @@ instance.checkPullRequestIntegrity_(err, user, opt_callback);

PullRequest.prototype.updatePullRequest_ = function(title, opt_body, state, opt_callback) {
PullRequest.prototype.updatePullRequest_ = function (title, opt_body, state, opt_callback) {
var instance = this,

@@ -836,3 +836,3 @@ options = instance.options,

PullRequest.prototype._fetchHandler = function() {
PullRequest.prototype._fetchHandler = function () {
var instance = this,

@@ -849,3 +849,3 @@ options = this.options,

hooks.invoke('pull-request.fetch', instance, function(afterHooksCallback) {
hooks.invoke('pull-request.fetch', instance, function (afterHooksCallback) {
var operation = '',

@@ -868,3 +868,3 @@ branch = options.pullBranch;

instance.fetch(fetchType, function(err) {
instance.fetch(fetchType, function (err) {
if (err) {

@@ -880,3 +880,3 @@ logger.error('Can\'t fetch pull request ' + options.number + '.');

PullRequest.prototype._mergeHandler = function() {
PullRequest.prototype._mergeHandler = function () {
var instance = this,

@@ -886,3 +886,3 @@ options = this.options,

hooks.invoke('pull-request.merge', instance, function(afterHooksCallback) {
hooks.invoke('pull-request.merge', instance, function (afterHooksCallback) {
if (options.rebase) {

@@ -900,11 +900,11 @@ operation = 'Rebasing';

PullRequest.prototype._fwdHandler = function() {
PullRequest.prototype._fwdHandler = function () {
var instance = this,
options = this.options;
hooks.invoke('pull-request.fwd', instance, function(afterHooksCallback) {
hooks.invoke('pull-request.fwd', instance, function (afterHooksCallback) {
logger.log('Forwarding pull request ' +
logger.colors.green('#' + options.number) + ' to ' + logger.colors.magenta('@' + options.fwd));
instance.forward(function(err, pull) {
instance.forward(function (err, pull) {
if (err) {

@@ -925,10 +925,10 @@ logger.error('Can\'t forward pull request ' + options.number + ' to ' + options.fwd + '.');

PullRequest.prototype._closeHandler = function() {
PullRequest.prototype._closeHandler = function () {
var instance = this,
options = this.options;
hooks.invoke('pull-request.close', instance, function(afterHooksCallback) {
hooks.invoke('pull-request.close', instance, function (afterHooksCallback) {
logger.log('Closing pull request ' + logger.colors.green('#' + options.number));
instance.close(function(err, pull) {
instance.close(function (err, pull) {
if (err) {

@@ -946,3 +946,3 @@ logger.warn('Can\'t close pull request ' + options.number + '.');

PullRequest.prototype._commentHandler = function() {
PullRequest.prototype._commentHandler = function () {
var options = this.options;

@@ -952,3 +952,3 @@

this.issue.comment(function(err, pull) {
this.issue.comment(function (err, pull) {
if (err) {

@@ -963,7 +963,7 @@ logger.error('Can\'t comment on pull request ' + options.number + '.');

PullRequest.prototype._infoHandler = function() {
PullRequest.prototype._infoHandler = function () {
var instance = this,
options = this.options;
instance.get(options.user, options.repo, options.number, function(err) {
instance.get(options.user, options.repo, options.number, function (err) {
if (err) {

@@ -976,3 +976,3 @@ logger.error('Can\'t get pull requests.');

PullRequest.prototype._listHandler = function() {
PullRequest.prototype._listHandler = function () {
var instance = this,

@@ -994,3 +994,3 @@ options = this.options,

instance.listFromAllRepositories(function(err) {
instance.listFromAllRepositories(function (err) {
if (err) {

@@ -1012,3 +1012,3 @@ logger.error('Can\'t list all pull requests from repos.');

}
instance.list(options.user, options.repo, function(err) {
instance.list(options.user, options.repo, function (err) {
if (err) {

@@ -1022,10 +1022,10 @@ logger.error('Can\'t list pull requests.');

PullRequest.prototype._openHandler = function() {
PullRequest.prototype._openHandler = function () {
var instance = this,
options = this.options;
hooks.invoke('pull-request.open', instance, function(afterHooksCallback) {
hooks.invoke('pull-request.open', instance, function (afterHooksCallback) {
logger.log('Opening pull request ' + logger.colors.green('#' + options.number));
instance.open(function(err, pull) {
instance.open(function (err, pull) {
if (err) {

@@ -1042,10 +1042,10 @@ logger.error('Can\'t open pull request ' + options.number + '.');

PullRequest.prototype._submitHandler = function() {
PullRequest.prototype._submitHandler = function () {
var instance = this,
options = this.options;
hooks.invoke('pull-request.submit', instance, function(afterHooksCallback) {
hooks.invoke('pull-request.submit', instance, function (afterHooksCallback) {
logger.log('Submitting pull request to ' + logger.colors.magenta('@' + options.submit));
instance.submit(options.submit, function(err, pull) {
instance.submit(options.submit, function (err, pull) {
if (err) {

@@ -1052,0 +1052,0 @@ logger.error('Can\'t submit pull request. ' + JSON.parse(err.message).errors[0].message);

@@ -58,3 +58,3 @@ /*

'repo': String,
'type': ['all', 'member', 'owner', 'public', 'private'],
'type': ['all', 'forks', 'member', 'owner', 'public', 'private', 'sources'],
'user': String

@@ -76,3 +76,3 @@ },

},
payload: function(payload, options) {
payload: function (payload, options) {
options.browser = true;

@@ -83,2 +83,3 @@ }

Repo.TYPE_ALL = 'all';
Repo.TYPE_FORKS = 'forks';
Repo.TYPE_MEMBER = 'member';

@@ -88,6 +89,7 @@ Repo.TYPE_OWNER = 'owner';

Repo.TYPE_PUBLIC = 'public';
Repo.TYPE_SOURCES = 'sources';
// -- Commands -------------------------------------------------------------------------------------
Repo.prototype.run = function() {
Repo.prototype.run = function () {
var instance = this,

@@ -97,4 +99,2 @@ options = instance.options,

options.type = options.type || Repo.TYPE_ALL;
if (options.browser) {

@@ -105,3 +105,3 @@ instance.browser(options.user, options.repo);

if (options.delete) {
hooks.invoke('repo.delete', instance, function(afterHooksCallback) {
hooks.invoke('repo.delete', instance, function (afterHooksCallback) {
logger.log('Deleting repo ' + logger.colors.green(options.user + '/' + options.delete));

@@ -116,5 +116,5 @@

}
], function(answers) {
], function (answers) {
if (answers.confirmation.toLowerCase() === 'y') {
instance.delete(options.user, options.delete, function(err) {
instance.delete(options.user, options.delete, function (err) {
if (err) {

@@ -136,3 +136,3 @@ logger.error('Can\'t delete repo.');

if (options.fork) {
hooks.invoke('repo.fork', instance, function(afterHooksCallback) {
hooks.invoke('repo.fork', instance, function (afterHooksCallback) {
if (options.organization) {

@@ -147,3 +147,3 @@ user = options.organization;

instance.fork(function(err1, repo) {
instance.fork(function (err1, repo) {
if (err1) {

@@ -166,12 +166,17 @@ logger.error('Can\'t fork. ' + JSON.parse(err1).message);

if (options.list) {
user = options.user;
if (options.organization) {
user = options.organization;
options.type = options.type || Repo.TYPE_ALL;
} else {
user = options.user;
options.type = options.type || Repo.TYPE_OWNER;
}
logger.log('Listing ' + logger.colors.green(options.type) + ' repos for ' +
logger.colors.green(user));
if (options.isTTY.out) {
logger.log('Listing ' + logger.colors.green(options.type) + ' repos for ' +
logger.colors.green(user));
}
instance.list(user, function(err) {
instance.list(user, function (err) {
if (err) {

@@ -184,3 +189,3 @@ logger.error('Can\'t list repos.');

if (options.new) {
hooks.invoke('repo.new', instance, function(afterHooksCallback) {
hooks.invoke('repo.new', instance, function (afterHooksCallback) {
options.repo = options.new;

@@ -194,3 +199,3 @@

instance.new(function(err1, repo) {
instance.new(function (err1, repo) {
if (err1) {

@@ -213,7 +218,7 @@ logger.error('Can\'t create new repo. ' + JSON.parse(err1.message).message);

Repo.prototype.browser = function(user, repo) {
Repo.prototype.browser = function (user, repo) {
openUrl('https://github.com/' + user + '/' + repo);
};
Repo.prototype.clone_ = function(user, repo, repo_url) {
Repo.prototype.clone_ = function (user, repo, repo_url) {
logger.log('Cloning ' + logger.colors.green(user + '/' + repo));

@@ -223,3 +228,3 @@ git.clone(url.parse(repo_url).href, repo);

Repo.prototype.delete = function(user, repo, opt_callback) {
Repo.prototype.delete = function (user, repo, opt_callback) {
var payload;

@@ -235,3 +240,3 @@

Repo.prototype.list = function(user, opt_callback) {
Repo.prototype.list = function (user, opt_callback) {
var instance = this,

@@ -253,19 +258,17 @@ method = 'getFromUser',

if (options.type === 'public' || options.type === 'private') {
if (user !== options.user) {
logger.error('You can only list public and private repos of your own.');
if (user === options.user) {
method = 'getAll';
}
else {
base.github.repos.getAll(payload, function(err, repos) {
instance.listCallback_(err, repos, opt_callback);
});
logger.error('You can only list your own public and private repos of your own.');
return;
}
}
else {
base.github.repos[method](payload, function(err, repos) {
instance.listCallback_(err, repos, opt_callback);
});
}
base.github.repos[method](payload, function (err, repos) {
instance.listCallback_(err, repos, opt_callback);
});
};
Repo.prototype.listCallback_ = function(err, repos, opt_callback) {
Repo.prototype.listCallback_ = function (err, repos, opt_callback) {
var instance = this,

@@ -300,4 +303,6 @@ options = instance.options,

logger.log(logger.colors.green('forks: ' + repo.forks +
', stars: ' + repo.watchers + ', issues: ' + repo.open_issues) + '\n');
if (options.isTTY.out) {
logger.log(logger.colors.green('forks: ' + repo.forks +
', stars: ' + repo.watchers + ', issues: ' + repo.open_issues) + '\n');
}
}

@@ -310,3 +315,3 @@ }

Repo.prototype.fork = function(opt_callback) {
Repo.prototype.fork = function (opt_callback) {
var instance = this,

@@ -328,3 +333,3 @@ options = instance.options,

Repo.prototype.new = function(opt_callback) {
Repo.prototype.new = function (opt_callback) {
var instance = this,

@@ -331,0 +336,0 @@ options = instance.options,

@@ -43,3 +43,3 @@ /*

Track.prototype.run = function() {
Track.prototype.run = function () {
var options = this.options;

@@ -58,3 +58,3 @@

Track.prototype.isTracking = function() {
Track.prototype.isTracking = function () {
var status = 'enable',

@@ -73,7 +73,7 @@ next = 'opt-out',

Track.prototype.optIn = function() {
Track.prototype.optIn = function () {
tracker.optOut = false;
};
Track.prototype.optOut = function() {
Track.prototype.optOut = function () {
tracker.optOut = true;

@@ -80,0 +80,0 @@ };

@@ -49,3 +49,3 @@ /*

},
payload: function(payload, options) {
payload: function (payload, options) {
options.login = true;

@@ -57,3 +57,3 @@ }

User.prototype.run = function() {
User.prototype.run = function () {
var instance = this,

@@ -83,3 +83,3 @@ options = instance.options;

User.authorize = function() {
User.authorize = function () {
config = configs.getConfig();

@@ -93,3 +93,3 @@

User.authorizationCallback_ = function(user, err, res) {
User.authorizationCallback_ = function (user, err, res) {
if (err) {

@@ -109,3 +109,3 @@ logger.error(err);

User.createAuthorization = function(opt_callback) {
User.createAuthorization = function (opt_callback) {
logger.log('First we need authorization to use GitHub\'s API. Login with your GitHub account.');

@@ -125,3 +125,3 @@

}
], function(answers) {
], function (answers) {
var payload = {

@@ -139,3 +139,3 @@ note: 'Node GH (' + moment().format('MMMM Do YYYY, h:mm:ss a') + ')',

base.github.authorization.create(payload, function(err, res) {
base.github.authorization.create(payload, function (err, res) {
var isTwoFactorAuthentication = err && err.message && err.message.indexOf('OTP') > 0;

@@ -154,3 +154,3 @@

User.hasCredentials = function() {
User.hasCredentials = function () {
if (config.github_token && config.github_user) {

@@ -163,3 +163,3 @@ return true;

User.login = function(opt_callback) {
User.login = function (opt_callback) {
if (User.hasCredentials()) {

@@ -174,3 +174,3 @@ User.authorize();

User.logout = function() {
User.logout = function () {
configs.removeGlobalConfig('github_user');

@@ -180,3 +180,3 @@ configs.removeGlobalConfig('github_token');

User.twoFactorAuthenticator_ = function(payload, user, opt_callback) {
User.twoFactorAuthenticator_ = function (payload, user, opt_callback) {
inquirer.prompt(

@@ -189,3 +189,3 @@ [

}
], function(factor) {
], function (factor) {
if (!payload.headers) {

@@ -197,3 +197,3 @@ payload.headers = [];

base.github.authorization.create(payload, function(err, res) {
base.github.authorization.create(payload, function (err, res) {
User.authorizationCallback_(user, err, res);

@@ -200,0 +200,0 @@ opt_callback && opt_callback(err);

@@ -23,7 +23,7 @@ /*

Version.prototype.run = function() {
Version.prototype.run = function () {
base.asyncReadPackages(this.printVersion);
};
Version.prototype.printVersion = function(pkg) {
Version.prototype.printVersion = function (pkg) {
logger.log(pkg.name + ' ' + pkg.version);

@@ -30,0 +30,0 @@ };

@@ -24,3 +24,3 @@ /*

exports.getNodeModulesGlobalPath = function() {
exports.getNodeModulesGlobalPath = function () {
var result,

@@ -44,3 +44,3 @@ path = exports.getConfig()[PLUGINS_PATH_KEY];

exports.getUserHomePath = function() {
exports.getUserHomePath = function () {
return userhome('.gh.json');

@@ -57,7 +57,7 @@ };

Object.keys(globalConfig).forEach(function(key) {
Object.keys(globalConfig).forEach(function (key) {
result[key] = globalConfig[key];
});
Object.keys(projectConfig).forEach(function(key) {
Object.keys(projectConfig).forEach(function (key) {
result[key] = projectConfig[key];

@@ -79,3 +79,3 @@ });

exports.getConfig = function(opt_plugin) {
exports.getConfig = function (opt_plugin) {
var config = cache[opt_plugin];

@@ -91,3 +91,3 @@

exports.getGlobalConfig = function(opt_plugin) {
exports.getGlobalConfig = function (opt_plugin) {
var config,

@@ -106,3 +106,3 @@ configPath,

Object.keys(userConfig).forEach(function(key) {
Object.keys(userConfig).forEach(function (key) {
config[key] = userConfig[key];

@@ -112,3 +112,3 @@ });

if (opt_plugin) {
exports.getPlugins().forEach(function(plugin) {
exports.getPlugins().forEach(function (plugin) {
exports.addPluginConfig(config, plugin);

@@ -121,11 +121,11 @@ });

exports.getGlobalConfigPath = function() {
exports.getGlobalConfigPath = function () {
return path.join(__dirname, '../', 'default.gh.json');
};
exports.getProjectConfigPath = function() {
exports.getProjectConfigPath = function () {
return path.join(process.cwd(), '.gh.json');
};
exports.removeGlobalConfig = function(key) {
exports.removeGlobalConfig = function (key) {
var config = exports.getGlobalConfig();

@@ -139,3 +139,3 @@

exports.createGlobalConfig = function() {
exports.createGlobalConfig = function () {
exports.saveJsonConfig(exports.getUserHomePath(),

@@ -147,3 +147,3 @@ JSON.parse(fs.readFileSync(exports.getGlobalConfigPath()))

exports.writeGlobalConfig = function(jsonPath, value) {
exports.writeGlobalConfig = function (jsonPath, value) {
var config = exports.getGlobalConfig(),

@@ -167,3 +167,3 @@ i,

exports.saveJsonConfig = function(path, object) {
exports.saveJsonConfig = function (path, object) {
var options = {

@@ -176,3 +176,3 @@ mode: parseInt('0600', 8)

exports.writeGlobalConfigCredentials = function(user, token) {
exports.writeGlobalConfigCredentials = function (user, token) {
var configPath = exports.getUserHomePath();

@@ -187,3 +187,3 @@

exports.addPluginConfig = function(config, plugin) {
exports.addPluginConfig = function (config, plugin) {
var pluginConfig,

@@ -203,3 +203,3 @@ userConfig;

Object.keys(userConfig).forEach(function(key) {
Object.keys(userConfig).forEach(function (key) {
pluginConfig[key] = userConfig[key];

@@ -225,3 +225,3 @@ });

try {
plugins = fs.readdirSync(pluginsPath).filter(function(plugin) {
plugins = fs.readdirSync(pluginsPath).filter(function (plugin) {
return plugin.substring(0, 3) === 'gh-';

@@ -239,3 +239,3 @@ });

exports.getPlugins = function() {
exports.getPlugins = function () {
if (!plugins) {

@@ -248,3 +248,3 @@ plugins = getPlugins();

exports.getPlugin = function(plugin) {
exports.getPlugin = function (plugin) {
plugin = exports.getPluginBasename(plugin);

@@ -255,11 +255,11 @@

exports.getPluginPath = function(plugin) {
exports.getPluginPath = function (plugin) {
return which.sync(plugin);
};
exports.getPluginBasename = function(plugin) {
exports.getPluginBasename = function (plugin) {
return plugin && plugin.replace('gh-', '');
};
exports.isPluginIgnored = function(plugin) {
exports.isPluginIgnored = function (plugin) {
if (exports.getConfig().ignored_plugins.indexOf(exports.getPluginBasename(plugin)) > -1) {

@@ -266,0 +266,0 @@ return true;

@@ -16,3 +16,3 @@ /*

exports.spawnSync = function(cmd, args, options) {
exports.spawnSync = function (cmd, args, options) {
var exec;

@@ -31,3 +31,3 @@

exports.spawnSyncStream = function(cmd, args, options) {
exports.spawnSyncStream = function (cmd, args, options) {
var proc,

@@ -57,3 +57,3 @@ err;

exports.execSync = function(cmd, options) {
exports.execSync = function (cmd, options) {
if (!options) {

@@ -70,3 +70,3 @@ options = {};

exports.execSyncInteractiveStream = function(cmd, options) {
exports.execSyncInteractiveStream = function (cmd, options) {
if (!options) {

@@ -73,0 +73,0 @@ options = {};

@@ -16,3 +16,3 @@ /*

exports.checkout = function(branch, newBranch) {
exports.checkout = function (branch, newBranch) {
var args = ['checkout', branch];

@@ -27,3 +27,3 @@

exports.clone = function(url, folder) {
exports.clone = function (url, folder) {
var args = ['clone', url];

@@ -38,3 +38,3 @@

exports._merge = function(branch, type) {
exports._merge = function (branch, type) {
var res;

@@ -52,11 +52,11 @@

exports.merge = function(branch) {
exports.merge = function (branch) {
return this._merge(branch, 'merge');
};
exports.rebase = function(branch) {
exports.rebase = function (branch) {
return this._merge(branch, 'rebase');
};
exports.push = function(remote, branch) {
exports.push = function (remote, branch) {
var args = ['push', remote];

@@ -71,3 +71,3 @@

exports.fetch = function(repoUrl, headBranch, pullBranch) {
exports.fetch = function (repoUrl, headBranch, pullBranch) {
var args = ['fetch', repoUrl, headBranch + ':' + pullBranch];

@@ -78,3 +78,3 @@

exports.countUserAdjacentCommits = function() {
exports.countUserAdjacentCommits = function () {
var git,

@@ -104,3 +104,3 @@ params,

exports.deleteBranch = function(branch) {
exports.deleteBranch = function (branch) {
var git = exec.spawnSync(git_command, ['branch', '-d', branch]);

@@ -115,7 +115,7 @@

exports.findRoot = function() {
exports.findRoot = function () {
return exec.spawnSync(git_command, ['rev-parse', '--show-toplevel']).stdout;
};
exports.getCommitMessage = function(branch, number) {
exports.getCommitMessage = function (branch, number) {
var git,

@@ -146,3 +146,3 @@ params = ['log'];

exports.getConfig = function(key) {
exports.getConfig = function (key) {
var git = exec.spawnSync(git_command, ['config', '--get', key]);

@@ -157,3 +157,3 @@

exports.getCurrentBranch = function() {
exports.getCurrentBranch = function () {
var git = exec.spawnSync(git_command, ['symbolic-ref', '--short', 'HEAD']);

@@ -169,7 +169,7 @@

exports.getLastCommitMessage = function(branch) {
exports.getLastCommitMessage = function (branch) {
return exports.getCommitMessage(branch, 1);
};
exports.getLastCommitSHA = function() {
exports.getLastCommitSHA = function () {
var git = exec.spawnSync(git_command, ['rev-parse', '--short', 'HEAD']);

@@ -184,3 +184,3 @@

exports.getRemoteUrl = function(remote) {
exports.getRemoteUrl = function (remote) {
try {

@@ -195,3 +195,3 @@ return exports.getConfig('remote.' + remote + '.url');

exports.getRepoFromRemoteURL = function(url) {
exports.getRepoFromRemoteURL = function (url) {
var parsed = exports.parseRemoteUrl(url);

@@ -202,3 +202,3 @@

exports.getUserFromRemoteUrl = function(url) {
exports.getUserFromRemoteUrl = function (url) {
var parsed = exports.parseRemoteUrl(url);

@@ -209,11 +209,11 @@

exports.getRepo = function(remote) {
exports.getRepo = function (remote) {
return exports.getRepoFromRemoteURL(exports.getRemoteUrl(remote));
};
exports.getUser = function(remote) {
exports.getUser = function (remote) {
return exports.getUserFromRemoteUrl(exports.getRemoteUrl(remote));
};
exports.parseRemoteUrl = function(url) {
exports.parseRemoteUrl = function (url) {
var parsed = /[\/:]([\w-]+)\/(.*?)(?:\.git)?$/.exec(url);

@@ -220,0 +220,0 @@

@@ -19,3 +19,3 @@ /*

exports.createContext = function(scope) {
exports.createContext = function (scope) {
return {

@@ -27,3 +27,3 @@ options: scope.options,

exports.getHooksArrayFromPath_ = function(path, opt_config) {
exports.getHooksArrayFromPath_ = function (path, opt_config) {
var keys = path.split('.'),

@@ -45,3 +45,3 @@ key = keys.shift(),

exports.getHooksFromPath = function(path) {
exports.getHooksFromPath = function (path) {
var hooks,

@@ -56,3 +56,3 @@ plugins = configs.getPlugins(),

// core hooks array.
plugins.forEach(function(plugin) {
plugins.forEach(function (plugin) {
var pluginConfig;

@@ -75,3 +75,3 @@

exports.invoke = function(path, scope, opt_callback) {
exports.invoke = function (path, scope, opt_callback) {
var after = exports.getHooksFromPath(path + '.after'),

@@ -93,3 +93,3 @@ before = exports.getHooksFromPath(path + '.before'),

function(callback) {
function (callback) {
exports.setupPlugins_(context, 'setupBeforeHooks', callback);

@@ -99,3 +99,3 @@ }

before.forEach(function(cmd) {
before.forEach(function (cmd) {
beforeOperations.push(exports.wrapCommand_(cmd, context, 'before'));

@@ -106,3 +106,3 @@ });

function(callback) {
function (callback) {
exports.setupPlugins_(context, 'setupAfterHooks', callback);

@@ -112,7 +112,7 @@ }

after.forEach(function(cmd) {
after.forEach(function (cmd) {
afterOperations.push(exports.wrapCommand_(cmd, context, 'after'));
});
afterOperations.push(function(callback) {
afterOperations.push(function (callback) {
process.env.NODEGH_HOOK_IS_LOCKED = false;

@@ -124,4 +124,4 @@ callback();

async.series(beforeOperations, function() {
opt_callback && opt_callback(function() {
async.series(beforeOperations, function () {
opt_callback && opt_callback(function () {
async.series(afterOperations);

@@ -132,7 +132,7 @@ });

exports.setupPlugins_ = function(context, setupFn, opt_callback) {
exports.setupPlugins_ = function (context, setupFn, opt_callback) {
var plugins = configs.getPlugins(),
operations = [];
plugins.forEach(function(plugin) {
plugins.forEach(function (plugin) {
try {

@@ -146,3 +146,3 @@ plugin = configs.getPlugin(plugin);

if (plugin && plugin[setupFn]) {
operations.push(function(callback) {
operations.push(function (callback) {
plugin[setupFn](context, callback);

@@ -153,3 +153,3 @@ });

async.series(operations, function() {
async.series(operations, function () {
opt_callback && opt_callback();

@@ -159,4 +159,4 @@ });

exports.wrapCommand_ = function(cmd, context, when) {
return function(callback) {
exports.wrapCommand_ = function (cmd, context, when) {
return function (callback) {
var raw = logger.compileTemplate(cmd, context);

@@ -163,0 +163,0 @@

@@ -25,3 +25,3 @@ /*

logger.debug = function() {
logger.debug = function () {
if (process.env.GH_VERBOSE) {

@@ -33,3 +33,3 @@ arguments[0] = 'DEBUG: ' + arguments[0];

logger.error = function() {
logger.error = function () {
arguments[0] = 'fatal: ' + arguments[0];

@@ -40,3 +40,3 @@ console.error.apply(this, arguments);

logger.warn = function() {
logger.warn = function () {
arguments[0] = 'warning: ' + arguments[0];

@@ -46,7 +46,7 @@ console.error.apply(this, arguments);

logger.log = function() {
logger.log = function () {
console.log.apply(this, arguments);
};
logger.getDuration = function(start, opt_end) {
logger.getDuration = function (start, opt_end) {
if (opt_end === undefined) {

@@ -59,3 +59,3 @@ opt_end = Date.now();

logger.applyReplacements = function(output, replaceMap) {
logger.applyReplacements = function (output, replaceMap) {
var regexPattern;

@@ -73,3 +73,3 @@

logger.getErrorMessage = function(err) {
logger.getErrorMessage = function (err) {
var msg;

@@ -113,3 +113,3 @@

logger.compileTemplate = function(source, map) {
logger.compileTemplate = function (source, map) {
var template = handlebars.compile(source);

@@ -120,7 +120,7 @@

logger.logTemplate = function(source, map) {
logger.logTemplate = function (source, map) {
console.log(logger.compileTemplate(source, map || {}));
};
logger.logTemplateFile = function(file, map) {
logger.logTemplateFile = function (file, map) {
var templatePath,

@@ -140,12 +140,12 @@ source;

logger.registerHelper = function(name, callback) {
logger.registerHelper = function (name, callback) {
handlebars.registerHelper(name, callback);
};
logger.registerHelpers_ = function() {
handlebars.registerHelper('date', function(date) {
logger.registerHelpers_ = function () {
handlebars.registerHelper('date', function (date) {
return logger.getDuration(date);
});
handlebars.registerHelper('compareLink', function() {
handlebars.registerHelper('compareLink', function () {
return 'https://github.com/' + this.options.user + '/' + this.options.repo +

@@ -155,3 +155,3 @@ '/compare/' + this.options.pullHeadSHA + '...' + this.options.currentSHA;

handlebars.registerHelper('forwardedLink', function() {
handlebars.registerHelper('forwardedLink', function () {
return 'https://github.com/' + this.options.fwd + '/' + this.options.repo + '/pull/' +

@@ -161,3 +161,3 @@ this.options.forwardedPull;

handlebars.registerHelper('link', function() {
handlebars.registerHelper('link', function () {
return 'https://github.com/' + this.options.user + '/' + this.options.repo + '/pull/' +

@@ -167,3 +167,3 @@ this.options.number;

handlebars.registerHelper('submittedLink', function() {
handlebars.registerHelper('submittedLink', function () {
return 'https://github.com/' + this.options.submit + '/' + this.options.repo + '/pull/' +

@@ -173,3 +173,3 @@ this.options.submittedPull;

handlebars.registerHelper('issueLink', function() {
handlebars.registerHelper('issueLink', function () {
return 'https://github.com/' + this.options.user + '/' + this.options.repo + '/issues/' +

@@ -179,11 +179,11 @@ this.options.number;

handlebars.registerHelper('gistLink', function() {
handlebars.registerHelper('gistLink', function () {
return 'https://gist.github.com/' + this.options.loggedUser + '/' + this.options.id;
});
handlebars.registerHelper('repoLink', function() {
handlebars.registerHelper('repoLink', function () {
return 'https://github.com/' + this.options.user + '/' + this.options.repo;
});
handlebars.registerHelper('wordwrap', function(text, padding, stripNewLines) {
handlebars.registerHelper('wordwrap', function (text, padding, stripNewLines) {
var gutter = '';

@@ -190,0 +190,0 @@

@@ -23,3 +23,3 @@ /*

tracker.resolveCommand = function(cmd, commandDetails) {
tracker.resolveCommand = function (cmd, commandDetails) {
var cmdAnonymizer;

@@ -36,3 +36,3 @@

tracker.trackCommand = function(cmd, commandDetails) {
tracker.trackCommand = function (cmd, commandDetails) {
var tracking = pkg.name + ' ' + this.resolveCommand(cmd, commandDetails);

@@ -39,0 +39,0 @@

{
"name": "gh",
"description": "GitHub command line tools.",
"version": "1.11.10",
"version": "1.11.11",
"homepage": "http://nodegh.io",

@@ -44,12 +44,12 @@ "author": {

"dependencies": {
"async": "^1.0.0",
"colors": "^1.1.0",
"async": "^1.4.2",
"colors": "^1.1.2",
"github": "^0.2.4",
"handlebars": "^3.0.3",
"inquirer": "^0.8.5",
"insight": "^0.5.2",
"moment": "^2.10.3",
"handlebars": "^4.0.2",
"inquirer": "^0.10.0",
"insight": "^0.7.0",
"moment": "^2.10.6",
"nopt": "^3.0.2",
"open": "^0.0.5",
"truncate": "^1.0.4",
"truncate": "^2.0.0",
"update-notifier": "^0.5.0",

@@ -61,12 +61,12 @@ "userhome": "^1.0.0",

"devDependencies": {
"gulp": "^3.8.11",
"gulp-mocha": "^2.0.0",
"gulp-istanbul": "^0.9.0",
"gulp": "^3.9.0",
"gulp-mocha": "^2.1.3",
"gulp-istanbul": "^0.10.0",
"gulp-complexity": "^0.3.0",
"gulp-jshint": "^1.11.0",
"gulp-jscs": "^1.6.0",
"gulp-jshint": "^1.11.2",
"gulp-jscs": "^2.0.0",
"plato": "^1.5.0",
"jshint-stylish": "^2.0.0",
"rewire": "^2.3.3",
"run-sequence": "^1.1.0"
"jshint-stylish": "^2.0.1",
"rewire": "^2.3.4",
"run-sequence": "^1.1.3"
},

@@ -73,0 +73,0 @@ "engines": {

@@ -29,3 +29,3 @@ 'use strict';

methods.forEach(function(item) {
methods.forEach(function (item) {
if (spacing < item.length) {

@@ -36,3 +36,3 @@ spacing = item.length + 1;

methods.forEach(function(item) {
methods.forEach(function (item) {
output += ' ' + colors.cyan(item) +

@@ -39,0 +39,0 @@ new Array(spacing - item.length + 2).join(' ') +

@@ -20,6 +20,6 @@ /*

describe('Git Module Tests', function() {
describe('Function parseRemoteUrl', function() {
describe('ssh clone url', function() {
it('should parse remote url with score on repo name', function() {
describe('Git Module Tests', function () {
describe('Function parseRemoteUrl', function () {
describe('ssh clone url', function () {
it('should parse remote url with score on repo name', function () {
var p = git.parseRemoteUrl(

@@ -32,3 +32,3 @@ 'git@github.com:eduardolundgren/node-gh.git');

it('should parse remote url with score on username', function() {
it('should parse remote url with score on username', function () {
var p = git.parseRemoteUrl(

@@ -42,4 +42,4 @@ 'git@github.com:elixir-lang/elixir.git');

describe('https clone url', function() {
it('should parse remote url with score on repo name', function() {
describe('https clone url', function () {
it('should parse remote url with score on repo name', function () {
var p = git.parseRemoteUrl(

@@ -52,3 +52,3 @@ 'https://github.com/eduardolundgren/node-gh.git');

it('should parse remote url with score on username', function() {
it('should parse remote url with score on username', function () {
var p = git.parseRemoteUrl(

@@ -55,0 +55,0 @@ 'https://github.com/elixir-lang/elixir.git');

@@ -16,12 +16,12 @@ /*

describe('Logger Module Tests', function() {
it('should log debug', function() {
describe('Logger Module Tests', function () {
it('should log debug', function () {
logger.debug('message ignored');
logger.__with__({
console: {
log: function() {
log: function () {
assert.fail(arguments);
}
}
})(function() {
})(function () {
logger.debug('messages');

@@ -37,3 +37,3 @@ });

console: {
log: function() {
log: function () {
assert.strictEqual(arguments.length, 1);

@@ -43,3 +43,3 @@ assert.strictEqual(arguments[0], 'DEBUG: help');

}
})(function() {
})(function () {
logger.debug('help');

@@ -49,6 +49,6 @@ });

it('should log errors', function() {
it('should log errors', function () {
logger.__with__({
process: {
exit: function() {
exit: function () {
assert.strictEqual(arguments.length, 1);

@@ -59,3 +59,3 @@ assert.strictEqual(arguments[0], 1);

console: {
error: function() {
error: function () {
assert.strictEqual(arguments.length, 1);

@@ -65,3 +65,3 @@ assert.strictEqual(arguments[0], 'fatal: help');

}
})(function() {
})(function () {
logger.error('help');

@@ -71,6 +71,6 @@ });

it('should log warnings', function() {
it('should log warnings', function () {
logger.__with__({
console: {
error: function() {
error: function () {
assert.strictEqual(arguments.length, 1);

@@ -80,3 +80,3 @@ assert.strictEqual(arguments[0], 'warning: help');

}
})(function() {
})(function () {
logger.warn('help');

@@ -86,6 +86,6 @@ });

it('should log', function() {
it('should log', function () {
logger.__with__({
console: {
log: function() {
log: function () {
assert.strictEqual(arguments.length, 1);

@@ -95,3 +95,3 @@ assert.strictEqual(arguments[0], 'help');

}
})(function() {
})(function () {
logger.log('help');

@@ -98,0 +98,0 @@ });

@@ -18,4 +18,4 @@ /*

describe('Pull Requests Module Tests', function() {
it('should fail to get pull request', function() {
describe('Pull Requests Module Tests', function () {
it('should fail to get pull request', function () {
var pr = new pullRequest.Impl({

@@ -26,6 +26,6 @@ repo: 'senna.js'

pullRequest.__with__({
'logger.log': function() {
'logger.log': function () {
assert.fail('Expected test to fail.');
},
'logger.warn': function() {
'logger.warn': function () {
},

@@ -35,3 +35,3 @@ base: {

pullRequests: {
get: function(payload, callback) {
get: function (payload, callback) {
callback(new Error('Should fail to get pull request.'), undefined);

@@ -42,3 +42,3 @@ }

}
})(function() {
})(function () {
pr.get('liferay', 'senna.js', '36');

@@ -48,3 +48,3 @@ });

it('should get pull request with mergeable state clean', function() {
it('should get pull request with mergeable state clean', function () {
var cleanLogFound = false,

@@ -58,3 +58,3 @@ pr = new pullRequest.Impl({

pullRequest.__with__({
'logger.log': function() {
'logger.log': function () {
// only evaluate that the clean has a green log message

@@ -67,3 +67,3 @@ if (arguments[0].indexOf('clean') > 1) {

},
'logger.warn': function() {
'logger.warn': function () {
assert.fail('Expected test to pass.');

@@ -74,3 +74,3 @@ },

pullRequests: {
get: function(payload, callback) {
get: function (payload, callback) {
callback(undefined, pullRequestsInfo);

@@ -81,3 +81,3 @@ }

}
})(function() {
})(function () {
pr.get('liferay', 'senna.js', '36');

@@ -91,3 +91,3 @@ });

it('should get pull request with mergeable state unstable', function() {
it('should get pull request with mergeable state unstable', function () {
var pr = new pullRequest.Impl({

@@ -100,5 +100,5 @@ repo: 'senna.js'

pullRequest.__with__({
'logger.log': function() {
'logger.log': function () {
},
'logger.warn': function() {
'logger.warn': function () {
assert.strictEqual(arguments[0], '\u001B[31mNot mergeable (unstable)\u001b[39m');

@@ -109,3 +109,3 @@ },

pullRequests: {
get: function(payload, callback) {
get: function (payload, callback) {
callback(undefined, pullRequestsUnstable);

@@ -116,3 +116,3 @@ }

}
})(function() {
})(function () {
pr.get('liferay', 'senna.js', '78');

@@ -119,0 +119,0 @@ });

@@ -16,5 +16,5 @@ /*

describe('Version Module Tests', function() {
it('should load Version', function() {
assert.doesNotThrow(function() {
describe('Version Module Tests', function () {
it('should load Version', function () {
assert.doesNotThrow(function () {
assert(typeof new version.Impl() === 'object');

@@ -24,3 +24,3 @@ });

it('should print versions', function() {
it('should print versions', function () {
var pkgMock,

@@ -36,3 +36,3 @@ baseMock,

baseMock = {
asyncReadPackages: function(callback) {
asyncReadPackages: function (callback) {
callback(pkgMock);

@@ -43,3 +43,3 @@ }

loggerMock = {
log: function(message) {
log: function (message) {
var parts = message.split(' ');

@@ -46,0 +46,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc