Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

locking node-github version to avoid future breaking change

  • Loading branch information...
commit cd547ad44629f67a0d920ec6978a598d5cf4c3d3 1 parent 95fb4fc
@andrerod andrerod authored
View
94 lib/cli/cli.js
@@ -344,66 +344,69 @@ commander.Command.prototype.whiteListPowershell = function (whitelist) {
return this;
};
-// Allow cli.password to accept empty passwords
-commander.Command.prototype.password = function (str, mask, fn) {
+commander.Command.prototype.passwordOnce = function (currentStr, mask, callback) {
+ var self = this;
+ var buf = '';
+
// default mask
if ('function' === typeof mask) {
- fn = mask;
+ callback = mask;
mask = '';
}
- var getPassword = function (currentStr, callback) {
- var self = this;
- var buf = '';
+ if (!process.stdin.setRawMode) {
+ process.stdin.setRawMode = tty.setRawMode;
+ }
- if (!process.stdin.setRawMode) {
- process.stdin.setRawMode = tty.setRawMode;
+ process.stdin.resume();
+ process.stdin.setRawMode(true);
+ fs.writeSync(istty1 ? 1 : 2, currentStr);
+ process.stdin.on('data', function(char) {
+ // Exit on Ctrl+C keypress
+ char = char.toString();
+ if (char === '\003') {
+ console.log('%s', buf);
+ process.exit();
}
- process.stdin.resume();
- process.stdin.setRawMode(true);
- fs.writeSync(istty1 ? 1 : 2, currentStr);
- process.stdin.on('data', function(char) {
- // Exit on Ctrl+C keypress
- char = char.toString();
- if (char === '\003') {
- console.log('%s', buf);
- process.exit();
- }
+ // Return password in the buffer on enter key press
+ if (char === '\015') {
+ process.stdin.removeAllListeners('data');
+ process.stdout.write('\n');
+ process.stdin.setRawMode(false);
- // Return password in the buffer on enter key press
- if (char === '\015') {
- process.stdin.removeAllListeners('data');
- process.stdout.write('\n');
- process.stdin.setRawMode(false);
- callback(buf);
- return;
- }
-
- // Backspace handling
- // Windows usually sends '\b' (^H) while Linux sends '\x7f'
- if (char === '\b' || char === '\177') {
- if (buf) {
- buf = buf.slice(0, -1);
- for (var j = 0; j < mask.length; ++j) {
- process.stdout.write('\b \b'); // space the last char out
- }
+ callback(buf);
+ return;
+ }
+
+ // Backspace handling
+ // Windows usually sends '\b' (^H) while Linux sends '\x7f'
+ if (char === '\b' || char === '\177') {
+ if (buf) {
+ buf = buf.slice(0, -1);
+ for (var j = 0; j < mask.length; ++j) {
+ process.stdout.write('\b \b'); // space the last char out
}
- return;
}
- char = char.split('\015')[0]; // only use the first line if many (for paste)
- for(var i = 0; i < char.length; ++i) {
- process.stdout.write(mask); // output several chars (for paste)
- }
- buf += char;
+ return;
+ }
+ char = char.split('\015')[0]; // only use the first line if many (for paste)
+ for(var i = 0; i < char.length; ++i) {
+ process.stdout.write(mask); // output several chars (for paste)
+ }
+ buf += char;
- }).resume();
- };
+ }).resume();
+};
+
+// Allow cli.password to accept empty passwords
+commander.Command.prototype.password = function (str, mask, fn) {
+ var self = this;
// Prompt first time
- getPassword(str, function (pass) {
+ self.passwordOnce(str, mask, function (pass) {
// Prompt for confirmation
- getPassword('Confirm password: ', function (pass2) {
+ self.passwordOnce('Confirm password: ', mask, function (pass2) {
if (pass === pass2) {
fn (pass);
} else {
@@ -413,7 +416,6 @@ commander.Command.prototype.password = function (str, mask, fn) {
});
};
-
commander.Command.prototype.execute = function (fn) {
var self = this;
return self.action(function () {
View
50 lib/cli/commands/deployment.js
@@ -172,7 +172,7 @@ exports.init = function(cli) {
- scm.command("associate [name]").whiteListPowershell().usage("[options] [name]").description("Redeploy your git deployment").option("-s, --subscription <id>", "use the subscription id").option("-u, --username <username>", "The username").option("-p, --password <password>", "The password").execute(function __4(name, options, _) { var context;
+ scm.command("associate [name]").whiteListPowershell().usage("[options] [name]").description("Redeploy your git deployment").option("-s, --subscription <id>", "use the subscription id").option("-u, --username <user>", "The username").option("-up, --pass <pass>", "The password").execute(function __4(name, options, _) { var context;
@@ -195,20 +195,18 @@ exports.init = function(cli) {
function promptForCredentials(_) { var __frame = { name: "promptForCredentials", line: 197 }; return __func(_, this, arguments, promptForCredentials, 0, __frame, function __$promptForCredentials() {
- log.help("Enter your github credentials");
-
- console.log(options); return (function __$promptForCredentials(__then) {
+ log.help("Enter your github credentials"); return (function __$promptForCredentials(__then) {
if (options.username) {
context.username = options.username; __then(); } else {
- return prompt("Username: ", __cb(_, __frame, 8, 29, function ___(__0, __1) { context.username = __1; __then(); }, true)); } ; })(function __$promptForCredentials() { return (function __$promptForCredentials(__then) {
+ return prompt("Username: ", __cb(_, __frame, 6, 29, function ___(__0, __1) { context.username = __1; __then(); }, true)); } ; })(function __$promptForCredentials() { return (function __$promptForCredentials(__then) {
- if (options.password) {
- context.password = options.password; __then(); } else {
+ if (options.pass) {
+ context.password = options.pass; __then(); } else {
- return prompt("Password: ", __cb(_, __frame, 14, 29, function ___(__0, __2) { context.password = __2; __then(); }, true)); } ; })(function __$promptForCredentials() {
+ return promptPassword("Password: ", __cb(_, __frame, 12, 29, function ___(__0, __2) { context.password = __2; __then(); }, true)); } ; })(function __$promptForCredentials() {
context.github = new GitHubApi({ version: "3.0.0" });
@@ -219,7 +217,7 @@ exports.init = function(cli) {
- function promptForRepository(_) { var repositories, parsedRepositoryUri, pathParts, owner, name, localRepositories; var __frame = { name: "promptForRepository", line: 222 }; return __func(_, this, arguments, promptForRepository, 0, __frame, function __$promptForRepository() {
+ function promptForRepository(_) { var repositories, parsedRepositoryUri, pathParts, owner, name, localRepositories; var __frame = { name: "promptForRepository", line: 220 }; return __func(_, this, arguments, promptForRepository, 0, __frame, function __$promptForRepository() {
return scm.doGetRepositories(context, __cb(_, __frame, 1, 27, function ___(__0, __1) { repositories = __1;
return scm.doGetRemoteUri(context, __cb(_, __frame, 3, 28, function ___(__0, __2) { context.remoteUri = __2;
@@ -247,7 +245,7 @@ exports.init = function(cli) {
- function linkRemoteGitRepo(_) { var parsedRepositoryUri, hookUrl, hooks, existingHook; var __frame = { name: "linkRemoteGitRepo", line: 250 }; return __func(_, this, arguments, linkRemoteGitRepo, 0, __frame, function __$linkRemoteGitRepo() {
+ function linkRemoteGitRepo(_) { var parsedRepositoryUri, hookUrl, hooks, existingHook; var __frame = { name: "linkRemoteGitRepo", line: 248 }; return __func(_, this, arguments, linkRemoteGitRepo, 0, __frame, function __$linkRemoteGitRepo() {
parsedRepositoryUri = url.parse(context.repositoryUri);
parsedRepositoryUri.auth = context.repositoryAuth;
parsedRepositoryUri.pathname = "/deploy";
@@ -289,7 +287,7 @@ exports.init = function(cli) {
- function addRemoteToLocalGitRepo(_) { var gitUri; var __frame = { name: "addRemoteToLocalGitRepo", line: 292 }; return __func(_, this, arguments, addRemoteToLocalGitRepo, 0, __frame, function __$addRemoteToLocalGitRepo() {
+ function addRemoteToLocalGitRepo(_) { var gitUri; var __frame = { name: "addRemoteToLocalGitRepo", line: 290 }; return __func(_, this, arguments, addRemoteToLocalGitRepo, 0, __frame, function __$addRemoteToLocalGitRepo() {
if (context.remoteUri) { return _(null); } ;
@@ -302,7 +300,7 @@ exports.init = function(cli) {
- scm.doCreateHook = function scm_doCreateHook__5(context, _) { var progress; var __frame = { name: "scm_doCreateHook__5", line: 305 }; return __func(_, this, arguments, scm_doCreateHook__5, 1, __frame, function __$scm_doCreateHook__5() {
+ scm.doCreateHook = function scm_doCreateHook__5(context, _) { var progress; var __frame = { name: "scm_doCreateHook__5", line: 303 }; return __func(_, this, arguments, scm_doCreateHook__5, 1, __frame, function __$scm_doCreateHook__5() {
progress = cli.progress("Creating new hook"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$scm_doCreateHook__5() {
@@ -312,7 +310,7 @@ exports.init = function(cli) {
- scm.doUpdateHook = function scm_doUpdateHook__6(context, _) { var progress; var __frame = { name: "scm_doUpdateHook__6", line: 315 }; return __func(_, this, arguments, scm_doUpdateHook__6, 1, __frame, function __$scm_doUpdateHook__6() {
+ scm.doUpdateHook = function scm_doUpdateHook__6(context, _) { var progress; var __frame = { name: "scm_doUpdateHook__6", line: 313 }; return __func(_, this, arguments, scm_doUpdateHook__6, 1, __frame, function __$scm_doUpdateHook__6() {
progress = cli.progress("Updating hook"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$scm_doUpdateHook__6() {
@@ -322,7 +320,7 @@ exports.init = function(cli) {
- scm.doGetHooks = function scm_doGetHooks__7(context, _) { var progress; var __frame = { name: "scm_doGetHooks__7", line: 325 }; return __func(_, this, arguments, scm_doGetHooks__7, 1, __frame, function __$scm_doGetHooks__7() {
+ scm.doGetHooks = function scm_doGetHooks__7(context, _) { var progress; var __frame = { name: "scm_doGetHooks__7", line: 323 }; return __func(_, this, arguments, scm_doGetHooks__7, 1, __frame, function __$scm_doGetHooks__7() {
progress = cli.progress("Retrieving website hooks"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$scm_doGetHooks__7() {
@@ -340,7 +338,7 @@ exports.init = function(cli) {
- function getRemote(name, _) { var remotes, origin; var __frame = { name: "getRemote", line: 343 }; return __func(_, this, arguments, getRemote, 1, __frame, function __$getRemote() {
+ function getRemote(name, _) { var remotes, origin; var __frame = { name: "getRemote", line: 341 }; return __func(_, this, arguments, getRemote, 1, __frame, function __$getRemote() {
return exec("git remote -v", __cb(_, __frame, 1, 22, function ___(__0, __1) { remotes = __1;
origin = ((remotes.stdout + remotes.stderr)).split("\n").filter(function(item) {
return item.split(" ").some(function(it) {
@@ -352,7 +350,7 @@ exports.init = function(cli) {
return _(null, origin[0].split(" ")[1].split(" ")[0]); } ;
- return _(null, null); }, true)); }); }; var __frame = { name: "scm_doGetRemoteUri__8", line: 338 }; return __func(_, this, arguments, scm_doGetRemoteUri__8, 1, __frame, function __$scm_doGetRemoteUri__8() { progress = cli.progress("Retrieving local git repositories"); originUri = null; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$scm_doGetRemoteUri__8() {
+ return _(null, null); }, true)); }); }; var __frame = { name: "scm_doGetRemoteUri__8", line: 336 }; return __func(_, this, arguments, scm_doGetRemoteUri__8, 1, __frame, function __$scm_doGetRemoteUri__8() { progress = cli.progress("Retrieving local git repositories"); originUri = null; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$scm_doGetRemoteUri__8() {
return getRemote("azure", __cb(_, __frame, 20, 18, function ___(__0, __1) { originUri = __1; return (function __$scm_doGetRemoteUri__8(__then) {
@@ -366,7 +364,7 @@ exports.init = function(cli) {
return _(null, originUri); }); }); }); };
- scm.doGetRepositories = function scm_doGetRepositories__9(context, _) { var progress, userRepos, orgs, i, org; var __frame = { name: "scm_doGetRepositories__9", line: 369 }; return __func(_, this, arguments, scm_doGetRepositories__9, 1, __frame, function __$scm_doGetRepositories__9() {
+ scm.doGetRepositories = function scm_doGetRepositories__9(context, _) { var progress, userRepos, orgs, i, org; var __frame = { name: "scm_doGetRepositories__9", line: 367 }; return __func(_, this, arguments, scm_doGetRepositories__9, 1, __frame, function __$scm_doGetRepositories__9() {
progress = cli.progress("Retrieving repositories");
userRepos = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$scm_doGetRepositories__9() {
@@ -390,7 +388,7 @@ exports.init = function(cli) {
return _(null, userRepos); }); }); }); };
- scm.doDeploymentsGet = function scm_doDeploymentsGet__10(context, _) { var maxItems, channel, progress, deployments; var __frame = { name: "scm_doDeploymentsGet__10", line: 393 }; return __func(_, this, arguments, scm_doDeploymentsGet__10, 1, __frame, function __$scm_doDeploymentsGet__10() {
+ scm.doDeploymentsGet = function scm_doDeploymentsGet__10(context, _) { var maxItems, channel, progress, deployments; var __frame = { name: "scm_doDeploymentsGet__10", line: 391 }; return __func(_, this, arguments, scm_doDeploymentsGet__10, 1, __frame, function __$scm_doDeploymentsGet__10() {
maxItems = parseInt(context.maxItems, 10);
if ((!maxItems || (maxItems <= 0))) {
maxItems = 20; } ;
@@ -411,7 +409,7 @@ exports.init = function(cli) {
- scm.doDeploymentGet = function scm_doDeploymentGet__11(context, _) { var channel, progress; var __frame = { name: "scm_doDeploymentGet__11", line: 414 }; return __func(_, this, arguments, scm_doDeploymentGet__11, 1, __frame, function __$scm_doDeploymentGet__11() {
+ scm.doDeploymentGet = function scm_doDeploymentGet__11(context, _) { var channel, progress; var __frame = { name: "scm_doDeploymentGet__11", line: 412 }; return __func(_, this, arguments, scm_doDeploymentGet__11, 1, __frame, function __$scm_doDeploymentGet__11() {
channel = getScmChannel(context).path("deployments").path(context.id);
@@ -423,7 +421,7 @@ exports.init = function(cli) {
- scm.doDeploymentPut = function scm_doDeploymentPut__12(context, _) { var channel, progress; var __frame = { name: "scm_doDeploymentPut__12", line: 426 }; return __func(_, this, arguments, scm_doDeploymentPut__12, 1, __frame, function __$scm_doDeploymentPut__12() {
+ scm.doDeploymentPut = function scm_doDeploymentPut__12(context, _) { var channel, progress; var __frame = { name: "scm_doDeploymentPut__12", line: 424 }; return __func(_, this, arguments, scm_doDeploymentPut__12, 1, __frame, function __$scm_doDeploymentPut__12() {
channel = getScmChannel(context).path("deployments").path(context.id);
@@ -435,7 +433,7 @@ exports.init = function(cli) {
- scm.doLogGet = function scm_doLogGet__13(context, _) { var channel, progress, logs; var __frame = { name: "scm_doLogGet__13", line: 438 }; return __func(_, this, arguments, scm_doLogGet__13, 1, __frame, function __$scm_doLogGet__13() {
+ scm.doLogGet = function scm_doLogGet__13(context, _) { var channel, progress, logs; var __frame = { name: "scm_doLogGet__13", line: 436 }; return __func(_, this, arguments, scm_doLogGet__13, 1, __frame, function __$scm_doLogGet__13() {
@@ -449,7 +447,7 @@ exports.init = function(cli) {
- function listDeployments(context, _) { var deployments, authorLength, messageLength; var __frame = { name: "listDeployments", line: 452 }; return __func(_, this, arguments, listDeployments, 1, __frame, function __$listDeployments() {
+ function listDeployments(context, _) { var deployments, authorLength, messageLength; var __frame = { name: "listDeployments", line: 450 }; return __func(_, this, arguments, listDeployments, 1, __frame, function __$listDeployments() {
return scm.doDeploymentsGet(context, __cb(_, __frame, 1, 22, function ___(__0, __1) { deployments = __1;
authorLength = 0; messageLength = 0;
if ((deployments && deployments.length)) {
@@ -467,13 +465,13 @@ exports.init = function(cli) {
- function getLogDetails(context, _) { var results, logs, progress, i; var __frame = { name: "getLogDetails", line: 470 }; return __func(_, this, arguments, getLogDetails, 1, __frame, function __$getLogDetails() {
+ function getLogDetails(context, _) { var results, logs, progress, i; var __frame = { name: "getLogDetails", line: 468 }; return __func(_, this, arguments, getLogDetails, 1, __frame, function __$getLogDetails() {
return scm.doLogGet(context, __cb(_, __frame, 2, 15, function ___(__0, __2) { logs = __2; return (function __$getLogDetails(__then) {
if ((logs && logs.length)) {
progress = cli.progress("Retrieving log details"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$getLogDetails() {
- return async.map(logs, function __1(log, _) { var details; var __frame = { name: "__1", line: 476 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() { return (function __$__1(__then) {
+ return async.map(logs, function __1(log, _) { var details; var __frame = { name: "__1", line: 474 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() { return (function __$__1(__then) {
if (log.hasDetails) {
@@ -506,7 +504,7 @@ exports.init = function(cli) {
function promptPassword(label, callback) {
- cli.password(label, function(x) { callback(undefined, x); }); };
+ cli.passwordOnce(label, function(x) { callback(undefined, x); }); };
function choose(data, callback) {
@@ -566,7 +564,7 @@ exports.init = function(cli) {
- function ensureRepositoryUri(context, _) { var siteData, repositoryUri; var __frame = { name: "ensureRepositoryUri", line: 569 }; return __func(_, this, arguments, ensureRepositoryUri, 1, __frame, function __$ensureRepositoryUri() {
+ function ensureRepositoryUri(context, _) { var siteData, repositoryUri; var __frame = { name: "ensureRepositoryUri", line: 567 }; return __func(_, this, arguments, ensureRepositoryUri, 1, __frame, function __$ensureRepositoryUri() {
return site.lookupSiteNameAndWebSpace(context, __cb(_, __frame, 1, 19, function ___(__0, __1) { siteData = __1;
repositoryUri = (siteData && site.getRepositoryUri(siteData)); return (function __$ensureRepositoryUri(__then) {
if (!repositoryUri) {
View
12 lib/cli/commands/deployment_.js
@@ -177,8 +177,8 @@ exports.init = function (cli) {
.usage('[options] [name]')
.description('Redeploy your git deployment')
.option('-s, --subscription <id>', 'use the subscription id')
- .option('-u, --username <username>', 'The username')
- .option('-p, --password <password>', 'The password')
+ .option('-u, --username <user>', 'The username')
+ .option('-up, --pass <pass>', 'The password')
.execute(function (name, options, _) {
var context = {
subscription: cli.category('account').lookupSubscriptionId(options.subscription),
@@ -203,10 +203,10 @@ exports.init = function (cli) {
context.username = prompt('Username: ', _);
}
- if (options.password) {
- context.password = options.password;
+ if (options.pass) {
+ context.password = options.pass;
} else {
- context.password = prompt('Password: ', _);
+ context.password = promptPassword('Password: ', _);
}
context.github = new GitHubApi({ version: "3.0.0" });
@@ -504,7 +504,7 @@ exports.init = function (cli) {
}
function promptPassword(label, callback) {
- cli.password(label, function (x) { callback(undefined, x); });
+ cli.passwordOnce(label, function (x) { callback(undefined, x); });
}
function choose(data, callback) {
Please sign in to comment.
Something went wrong with that request. Please try again.