Skip to content
Browse files

Fixing wrong reference.

  • Loading branch information...
1 parent cef24f9 commit 5577072105d34320b80556fa8d04f4e309d308a6 @andrerod andrerod committed
View
6 lib/cli/commands/githubdeployment.js
@@ -44,7 +44,9 @@ exports.init = function(cli) {
- function promptForGithubCredentials(_) { var __frame = { name: "promptForGithubCredentials", line: 47 }; return __func(_, this, arguments, promptForGithubCredentials, 0, __frame, function __$promptForGithubCredentials() {
+
+
+ function promptForGithubCredentials(_) { var __frame = { name: "promptForGithubCredentials", line: 49 }; return __func(_, this, arguments, promptForGithubCredentials, 0, __frame, function __$promptForGithubCredentials() {
log.help("Enter your github credentials"); return (function __$promptForGithubCredentials(__then) {
if (options.username) {
@@ -60,7 +62,7 @@ exports.init = function(cli) {
context.lvcClient = LinkedRevisionControl.createClient(cli, "github");
- context.lvcClient.authenticate(context.username, context.password); _(); }); }); }); }; var __frame = { name: "__1", line: 33 }; return __func(_, this, arguments, __1, 2, __frame, function __$__1() { context = { subscription: cli.category("account").lookupSubscriptionId(options.subscription), site: { name: name } }; return scm.ensureRepositoryUri(context, __cb(_, __frame, 9, 6, function __$__1() { return promptForGithubCredentials(__cb(_, __frame, 10, 6, function __$__1() { return context.lvcClient.init(context, __cb(_, __frame, 11, 6, function __$__1() { return context.lvcClient.deploy(context, __cb(_, __frame, 12, 6, _, true)); }, true)); }, true)); }, true)); }); });
+ context.lvcClient.authenticate(context.username, context.password); _(); }); }); }); }; var __frame = { name: "__1", line: 33 }; return __func(_, this, arguments, __1, 2, __frame, function __$__1() { context = { subscription: cli.category("account").lookupSubscriptionId(options.subscription), site: { name: name } }; return scm.ensureRepositoryUri(context, __cb(_, __frame, 9, 6, function __$__1() { return promptForGithubCredentials(__cb(_, __frame, 10, 6, function __$__1() { context.flags = { forceRepositorySelection: true }; return context.lvcClient.init(context, __cb(_, __frame, 13, 6, function __$__1() { return context.lvcClient.deploy(context, __cb(_, __frame, 14, 6, _, true)); }, true)); }, true)); }, true)); }); });
View
2 lib/cli/commands/githubdeployment_.js
@@ -41,6 +41,8 @@ exports.init = function (cli) {
// Fetch site and repository data
scm.ensureRepositoryUri(context, _);
promptForGithubCredentials(_);
+
+ context.flags = { forceRepositorySelection: true };
context.lvcClient.init(context, _);
context.lvcClient.deploy(context, _);
View
72 lib/cli/commands/site.js
@@ -239,25 +239,27 @@ exports.init = function(cli) {
function promptForGithubCredentials(_) { var __frame = { name: "promptForGithubCredentials", line: 241 }; return __func(_, this, arguments, promptForGithubCredentials, 0, __frame, function __$promptForGithubCredentials() {
- log.help("Enter your github credentials"); return (function __$promptForGithubCredentials(__then) {
+ if ((!options.username || !options.pass)) {
+ log.help("Enter your github credentials"); } ; return (function __$promptForGithubCredentials(__then) {
+
if (options.username) {
context.username = options.username; __then(); } else {
- return prompt("Username: ", __cb(_, __frame, 6, 33, function ___(__0, __1) { context.username = __1; __then(); }, true)); } ; })(function __$promptForGithubCredentials() { return (function __$promptForGithubCredentials(__then) {
+ return prompt("Username: ", __cb(_, __frame, 8, 33, function ___(__0, __1) { context.username = __1; __then(); }, true)); } ; })(function __$promptForGithubCredentials() { return (function __$promptForGithubCredentials(__then) {
if (options.pass) {
context.password = options.pass; __then(); } else {
- return promptPassword("Password: ", __cb(_, __frame, 12, 33, function ___(__0, __2) { context.password = __2; __then(); }, true)); } ; })(function __$promptForGithubCredentials() {
+ return promptPassword("Password: ", __cb(_, __frame, 14, 33, function ___(__0, __2) { context.password = __2; __then(); }, true)); } ; })(function __$promptForGithubCredentials() {
context.lvcClient = LinkedRevisionControl.createClient(cli, "github");
context.lvcClient.authenticate(context.username, context.password); _(); }); }); }); };
- function copyIisNodeWhenServerJsPresent(_) { var sourcePath; var __frame = { name: "copyIisNodeWhenServerJsPresent", line: 260 }; return __func(_, this, arguments, copyIisNodeWhenServerJsPresent, 0, __frame, function __$copyIisNodeWhenServerJsPresent() {
+ function copyIisNodeWhenServerJsPresent(_) { var sourcePath; var __frame = { name: "copyIisNodeWhenServerJsPresent", line: 262 }; return __func(_, this, arguments, copyIisNodeWhenServerJsPresent, 0, __frame, function __$copyIisNodeWhenServerJsPresent() {
log.silly("copyWebConfigWhenServerJsPresent"); return (function __$copyIisNodeWhenServerJsPresent(__then) {
if ((!utils.pathExistsSync("iisnode.yml") && ((utils.pathExistsSync("server.js") || utils.pathExistsSync("app.js"))))) {
log.info("Creating default iisnode.yml file");
@@ -266,7 +268,7 @@ exports.init = function(cli) {
- function updateLocalConfigWithSiteName(_) { var cfg; var __frame = { name: "updateLocalConfigWithSiteName", line: 269 }; return __func(_, this, arguments, updateLocalConfigWithSiteName, 0, __frame, function __$updateLocalConfigWithSiteName() {
+ function updateLocalConfigWithSiteName(_) { var cfg; var __frame = { name: "updateLocalConfigWithSiteName", line: 271 }; return __func(_, this, arguments, updateLocalConfigWithSiteName, 0, __frame, function __$updateLocalConfigWithSiteName() {
log.silly("updateLocalConfigWithSiteName"); return (function __$updateLocalConfigWithSiteName(__then) {
if (context.flags.isGitWorkingTree) {
return site.readConfig(__cb(_, __frame, 3, 24, function ___(__0, __1) { cfg = __1;
@@ -276,14 +278,14 @@ exports.init = function(cli) {
- function createSite(_) { var __frame = { name: "createSite", line: 279 }; return __func(_, this, arguments, createSite, 0, __frame, function __$createSite() {
+ function createSite(_) { var __frame = { name: "createSite", line: 281 }; return __func(_, this, arguments, createSite, 0, __frame, function __$createSite() {
log.silly("createSite"); return (function __$createSite(__then) {
if (!context.flags.siteExists) {
return site.doSitesPost(context, __cb(_, __frame, 3, 14, __then, true)); } else { __then(); } ; })(_); }); };
- function initializeRemoteRepo(_) { var __frame = { name: "initializeRemoteRepo", line: 286 }; return __func(_, this, arguments, initializeRemoteRepo, 0, __frame, function __$initializeRemoteRepo() {
+ function initializeRemoteRepo(_) { var __frame = { name: "initializeRemoteRepo", line: 288 }; return __func(_, this, arguments, initializeRemoteRepo, 0, __frame, function __$initializeRemoteRepo() {
log.silly("InitializeRemoteRepo"); return (function __$initializeRemoteRepo(__then) {
if (!context.flags.siteExists) {
return site.doRepositoryPost(context, __cb(_, __frame, 3, 14, function __$initializeRemoteRepo() {
@@ -299,7 +301,7 @@ exports.init = function(cli) {
log.silly("context.repo", context.repo); _(); }); }); };
- function addRemoteToLocalGitRepo(_) { var remotes, azureExists, gitUri; var __frame = { name: "addRemoteToLocalGitRepo", line: 302 }; return __func(_, this, arguments, addRemoteToLocalGitRepo, 0, __frame, function __$addRemoteToLocalGitRepo() {
+ function addRemoteToLocalGitRepo(_) { var remotes, azureExists, gitUri; var __frame = { name: "addRemoteToLocalGitRepo", line: 304 }; return __func(_, this, arguments, addRemoteToLocalGitRepo, 0, __frame, function __$addRemoteToLocalGitRepo() {
log.silly("addRemoteToLocalGitRepo");
if (!context.flags.isGitWorkingTree) {
log.info((("To create a local git repository to publish to the remote site, please rerun this command with the --git flag: \"azure site create " + ((((context.site && context.site.name)) || "{site name}"))) + " --git\".")); return _(null); } ; return (function __$addRemoteToLocalGitRepo(__then) {
@@ -326,7 +328,7 @@ exports.init = function(cli) {
return exec(("git remote add azure " + gitUri), __cb(_, __frame, 24, 12, _, true)); }); }, true)); }); }); };
- function ensureRepositoryUri(_) { var siteData, repositoryUri; var __frame = { name: "ensureRepositoryUri", line: 329 }; return __func(_, this, arguments, ensureRepositoryUri, 0, __frame, function __$ensureRepositoryUri() {
+ function ensureRepositoryUri(_) { var siteData, repositoryUri; var __frame = { name: "ensureRepositoryUri", line: 331 }; return __func(_, this, arguments, ensureRepositoryUri, 0, __frame, function __$ensureRepositoryUri() {
return site.lookupSiteNameAndWebSpace(context, __cb(_, __frame, 1, 27, function ___(__0, __1) { siteData = __1;
repositoryUri = (siteData && site.getRepositoryUri(siteData)); return (function __$ensureRepositoryUri(__then) {
if (!repositoryUri) {
@@ -341,7 +343,7 @@ exports.init = function(cli) {
- function portalCreateSiteInstruction(context, _) { var href; var __frame = { name: "portalCreateSiteInstruction", line: 344 }; return __func(_, this, arguments, portalCreateSiteInstruction, 1, __frame, function __$portalCreateSiteInstruction() {
+ function portalCreateSiteInstruction(context, _) { var href; var __frame = { name: "portalCreateSiteInstruction", line: 346 }; return __func(_, this, arguments, portalCreateSiteInstruction, 1, __frame, function __$portalCreateSiteInstruction() {
log.help("You must create your first web site using the Windows Azure portal.");
log.help("Please follow these steps in the portal:");
log.help("1. At the bottom of the page, click on New > Web Site > Quick Create");
@@ -360,7 +362,7 @@ exports.init = function(cli) {
- function getPublishingUser(context, _) { var publishingUsers, filters; var __frame = { name: "getPublishingUser", line: 363 }; return __func(_, this, arguments, getPublishingUser, 1, __frame, function __$getPublishingUser() {
+ function getPublishingUser(context, _) { var publishingUsers, filters; var __frame = { name: "getPublishingUser", line: 365 }; return __func(_, this, arguments, getPublishingUser, 1, __frame, function __$getPublishingUser() {
publishingUsers = toArray(context.publishingUsers);
filters = publishingUsers.filter(function(item) {
return ((typeof item === "string") && (item.length <= 64)); }); return (function __$getPublishingUser(__then) {
@@ -378,7 +380,7 @@ exports.init = function(cli) {
return prompt("Publishing username: ", __cb(_, __frame, 15, 11, _, true)); }); }); };
- function portalGitInitInstruction(context, _) { var href; var __frame = { name: "portalGitInitInstruction", line: 381 }; return __func(_, this, arguments, portalGitInitInstruction, 1, __frame, function __$portalGitInitInstruction() {
+ function portalGitInitInstruction(context, _) { var href; var __frame = { name: "portalGitInitInstruction", line: 383 }; return __func(_, this, arguments, portalGitInitInstruction, 1, __frame, function __$portalGitInitInstruction() {
log.help("You must create your git publishing credentials using the Windows Azure portal.");
log.help("Please follow these steps in the portal:");
log.help("1. In the menu on the left select \"Web Sites\"");
@@ -398,7 +400,7 @@ exports.init = function(cli) {
var location = site.category("location").description("Commands to manage your Azure locations");
- location.command("list").whiteListPowershell().description("List locations available for your account").execute(function __3(options, _) { var context, spaces, s; var __frame = { name: "__3", line: 404 }; return __func(_, this, arguments, __3, 1, __frame, function __$__3() {
+ location.command("list").whiteListPowershell().description("List locations available for your account").execute(function __3(options, _) { var context, spaces, s; var __frame = { name: "__3", line: 406 }; return __func(_, this, arguments, __3, 1, __frame, function __$__3() {
@@ -420,7 +422,7 @@ exports.init = function(cli) {
- site.command("portal [name]").whiteListPowershell().description("Opens the portal in a browser to manage your web sites").option("-r, --realm <realm>", "specifies organization used for login").execute(function __4(name, options, _) { var href; var __frame = { name: "__4", line: 427 }; return __func(_, this, arguments, __4, 2, __frame, function __$__4() {
+ site.command("portal [name]").whiteListPowershell().description("Opens the portal in a browser to manage your web sites").option("-r, --realm <realm>", "specifies organization used for login").execute(function __4(name, options, _) { var href; var __frame = { name: "__4", line: 429 }; return __func(_, this, arguments, __4, 2, __frame, function __$__4() {
@@ -440,7 +442,7 @@ exports.init = function(cli) {
common.launchBrowser(targetUrl); _(); }); });
- site.command("browse [name]").whiteListPowershell().description("Open your web site in a browser.").option("-s, --subscription <id>", "use the subscription id").execute(function __5(name, options, _) { var context, cache, siteData, href; var __frame = { name: "__5", line: 447 }; return __func(_, this, arguments, __5, 2, __frame, function __$__5() {
+ site.command("browse [name]").whiteListPowershell().description("Open your web site in a browser.").option("-s, --subscription <id>", "use the subscription id").execute(function __5(name, options, _) { var context, cache, siteData, href; var __frame = { name: "__5", line: 449 }; return __func(_, this, arguments, __5, 2, __frame, function __$__5() {
@@ -454,14 +456,14 @@ exports.init = function(cli) {
return lookupSiteNameAndWebSpace(context, __cb(_, __frame, 9, 22, function ___(__0, __2) { cache = __2; return (function __$__5(_) {
- var __1 = cache; if (__1) { return _(null, __1); } ; return site.doSiteGet(context, __cb(_, __frame, 10, 40, _, true)); })(__cb(_, __frame, -446, 17, function ___(__0, __3) { siteData = clean(__3);
+ var __1 = cache; if (__1) { return _(null, __1); } ; return site.doSiteGet(context, __cb(_, __frame, 10, 40, _, true)); })(__cb(_, __frame, -448, 17, function ___(__0, __3) { siteData = clean(__3);
href = ("http://" + toArray(siteData.HostNames)[0]);
common.launchBrowser(href); _(); }, true)); }, true)); }); });
- site.command("show [name]").whiteListPowershell().description("Show details for a web site").option("-s, --subscription <id>", "use the subscription id").execute(function __6(name, options, _) { var context, result, repositoryUri, gitUri, settings, data, index; var __frame = { name: "__6", line: 468 }; return __func(_, this, arguments, __6, 2, __frame, function __$__6() {
+ site.command("show [name]").whiteListPowershell().description("Show details for a web site").option("-s, --subscription <id>", "use the subscription id").execute(function __6(name, options, _) { var context, result, repositoryUri, gitUri, settings, data, index; var __frame = { name: "__6", line: 470 }; return __func(_, this, arguments, __6, 2, __frame, function __$__6() {
@@ -478,9 +480,9 @@ exports.init = function(cli) {
log.info("Showing details for site");
log.verbose("Parameters", context);
- return async.parallel([function __1(_) { var __frame = { name: "__1", line: 482 }; return __func(_, this, arguments, __1, 0, __frame, function __$__1() {
+ return async.parallel([function __1(_) { var __frame = { name: "__1", line: 484 }; return __func(_, this, arguments, __1, 0, __frame, function __$__1() {
return site.doSiteGet(context, __cb(_, __frame, 0, 34, _, true)); });
- },function __2(_) { var __frame = { name: "__2", line: 483 }; return __func(_, this, arguments, __2, 0, __frame, function __$__2() { return site.doSiteConfigGet(context, __cb(_, __frame, 0, 34, _, true)); }); },], __cb(_, __frame, 13, 23, function ___(__0, __3) { result = __3;
+ },function __2(_) { var __frame = { name: "__2", line: 485 }; return __func(_, this, arguments, __2, 0, __frame, function __$__2() { return site.doSiteConfigGet(context, __cb(_, __frame, 0, 34, _, true)); }); },], __cb(_, __frame, 13, 23, function ___(__0, __3) { result = __3;
@@ -512,7 +514,7 @@ exports.init = function(cli) {
- function lookupSiteName(context, _) { var cfg; var __frame = { name: "lookupSiteName", line: 515 }; return __func(_, this, arguments, lookupSiteName, 1, __frame, function __$lookupSiteName() {
+ function lookupSiteName(context, _) { var cfg; var __frame = { name: "lookupSiteName", line: 517 }; return __func(_, this, arguments, lookupSiteName, 1, __frame, function __$lookupSiteName() {
if ((context.site.name !== undefined)) { return _(null); } ;
@@ -533,7 +535,7 @@ exports.init = function(cli) {
- function lookupSiteWebSpace(context, _) { var sites, index; var __frame = { name: "lookupSiteWebSpace", line: 536 }; return __func(_, this, arguments, lookupSiteWebSpace, 1, __frame, function __$lookupSiteWebSpace() {
+ function lookupSiteWebSpace(context, _) { var sites, index; var __frame = { name: "lookupSiteWebSpace", line: 538 }; return __func(_, this, arguments, lookupSiteWebSpace, 1, __frame, function __$lookupSiteWebSpace() {
log.verbose("Attempting to locate site ", context.site.name);
return site.doSitesGet(context, __cb(_, __frame, 2, 16, function ___(__0, __1) { sites = __1;
for (index in sites) {
@@ -547,7 +549,7 @@ exports.init = function(cli) {
- function lookupSiteNameAndWebSpace(context, _) { var cache; var __frame = { name: "lookupSiteNameAndWebSpace", line: 550 }; return __func(_, this, arguments, lookupSiteNameAndWebSpace, 1, __frame, function __$lookupSiteNameAndWebSpace() {
+ function lookupSiteNameAndWebSpace(context, _) { var cache; var __frame = { name: "lookupSiteNameAndWebSpace", line: 552 }; return __func(_, this, arguments, lookupSiteNameAndWebSpace, 1, __frame, function __$lookupSiteNameAndWebSpace() {
return lookupSiteName(context, __cb(_, __frame, 1, 4, function __$lookupSiteNameAndWebSpace() {
return cacheUtils.readSite(context, __cb(_, __frame, 2, 16, function ___(__0, __1) { cache = __1;
if ((cache || context.site.webspace)) {
@@ -621,7 +623,7 @@ exports.init = function(cli) {
site.getRepositoryAuth = getRepositoryAuth;
- site.command("delete [name]").whiteListPowershell().description("Delete a web site").option("-s, --subscription <id>", "use the subscription id").option("-q, --quiet", "quiet mode, do not ask for delete confirmation").execute(function __7(name, options, _) { var context, progress, result; var __frame = { name: "__7", line: 629 }; return __func(_, this, arguments, __7, 2, __frame, function __$__7() {
+ site.command("delete [name]").whiteListPowershell().description("Delete a web site").option("-s, --subscription <id>", "use the subscription id").option("-q, --quiet", "quiet mode, do not ask for delete confirmation").execute(function __7(name, options, _) { var context, progress, result; var __frame = { name: "__7", line: 631 }; return __func(_, this, arguments, __7, 2, __frame, function __$__7() {
@@ -637,7 +639,7 @@ exports.init = function(cli) {
return lookupSiteNameAndWebSpace(context, __cb(_, __frame, 8, 10, function __$__7() {
log.info("Deleting site", context.site.name); return (function __$__7(_) {
- var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return confirm((("Delete " + context.site.name) + " site? (y/n) "), __cb(_, __frame, 11, 33, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -628, 17, function ___(__0, __2) { return (function __$__7(__then) { if (__2) { return _(null); } else { __then(); } ; })(function __$__7() {
+ var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return confirm((("Delete " + context.site.name) + " site? (y/n) "), __cb(_, __frame, 11, 33, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -630, 17, function ___(__0, __2) { return (function __$__7(__then) { if (__2) { return _(null); } else { __then(); } ; })(function __$__7() {
@@ -660,7 +662,7 @@ exports.init = function(cli) {
- site.command("start [name]").whiteListPowershell().description("Start a web site").option("-s, --subscription <id>", "use the subscription id").execute(function __8(name, options, _) { var context, progress, result; var __frame = { name: "__8", line: 667 }; return __func(_, this, arguments, __8, 2, __frame, function __$__8() {
+ site.command("start [name]").whiteListPowershell().description("Start a web site").option("-s, --subscription <id>", "use the subscription id").execute(function __8(name, options, _) { var context, progress, result; var __frame = { name: "__8", line: 669 }; return __func(_, this, arguments, __8, 2, __frame, function __$__8() {
@@ -711,7 +713,7 @@ exports.init = function(cli) {
log.info((("Site " + context.site.name) + " has been started")); _(); }); }); }, true)); }); });
- site.command("stop [name]").whiteListPowershell().description("Stop a web site").option("-s, --subscription <id>", "use the subscription id").execute(function __9(name, options, _) { var context, progress, result; var __frame = { name: "__9", line: 718 }; return __func(_, this, arguments, __9, 2, __frame, function __$__9() {
+ site.command("stop [name]").whiteListPowershell().description("Stop a web site").option("-s, --subscription <id>", "use the subscription id").execute(function __9(name, options, _) { var context, progress, result; var __frame = { name: "__9", line: 720 }; return __func(_, this, arguments, __9, 2, __frame, function __$__9() {
@@ -766,19 +768,19 @@ exports.init = function(cli) {
- site.readConfig = function site_readConfig__10(_) { var __frame = { name: "site_readConfig__10", line: 769 }; return __func(_, this, arguments, site_readConfig__10, 0, __frame, function __$site_readConfig__10() {
+ site.readConfig = function site_readConfig__10(_) { var __frame = { name: "site_readConfig__10", line: 771 }; return __func(_, this, arguments, site_readConfig__10, 0, __frame, function __$site_readConfig__10() {
return site.readConfigValue("azure.site.name", __cb(_, __frame, 2, 12, function ___(__0, __2) {
return site.readConfigValue("azure.site.webspace", __cb(_, __frame, 3, 16, function ___(__0, __3) { var __1 = { name: __2, webspace: __3 }; return _(null, __1); }, true)); }, true)); }); };
- site.writeConfig = function site_writeConfig__11(cfg, _) { var __frame = { name: "site_writeConfig__11", line: 776 }; return __func(_, this, arguments, site_writeConfig__11, 1, __frame, function __$site_writeConfig__11() {
+ site.writeConfig = function site_writeConfig__11(cfg, _) { var __frame = { name: "site_writeConfig__11", line: 778 }; return __func(_, this, arguments, site_writeConfig__11, 1, __frame, function __$site_writeConfig__11() {
return site.writeConfigValue("azure.site.name", cfg.name, __cb(_, __frame, 1, 4, function __$site_writeConfig__11() {
return site.writeConfigValue("azure.site.webspace", cfg.webspace, __cb(_, __frame, 2, 4, _, true)); }, true)); }); };
- site.readConfigValue = function site_readConfigValue__12(name, _) { var result; var __frame = { name: "site_readConfigValue__12", line: 781 }; return __func(_, this, arguments, site_readConfigValue__12, 1, __frame, function __$site_readConfigValue__12() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$site_readConfigValue__12() {
+ site.readConfigValue = function site_readConfigValue__12(name, _) { var result; var __frame = { name: "site_readConfigValue__12", line: 783 }; return __func(_, this, arguments, site_readConfigValue__12, 1, __frame, function __$site_readConfigValue__12() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$site_readConfigValue__12() {
return exec(("git config --get " + name), __cb(_, __frame, 2, 19, function ___(__0, __1) { result = __1;
return _(null, ((result.stdout + result.stderr)).trim()); }, true)); }); })(function ___(err, __result) { __tryCatch(_, function __$site_readConfigValue__12() { if (err) {
@@ -789,7 +791,7 @@ exports.init = function(cli) {
- site.writeConfigValue = function site_writeConfigValue__13(name, value, _) { var __frame = { name: "site_writeConfigValue__13", line: 792 }; return __func(_, this, arguments, site_writeConfigValue__13, 2, __frame, function __$site_writeConfigValue__13() {
+ site.writeConfigValue = function site_writeConfigValue__13(name, value, _) { var __frame = { name: "site_writeConfigValue__13", line: 794 }; return __func(_, this, arguments, site_writeConfigValue__13, 2, __frame, function __$site_writeConfigValue__13() {
return exec(((("git config " + name) + " ") + value), __cb(_, __frame, 1, 4, _, true)); }); };
@@ -887,7 +889,7 @@ exports.init = function(cli) {
- site.doSpacesGet = function site_doSpacesGet__14(options, _) { var progress, result, spaces; var __frame = { name: "site_doSpacesGet__14", line: 890 }; return __func(_, this, arguments, site_doSpacesGet__14, 1, __frame, function __$site_doSpacesGet__14() {
+ site.doSpacesGet = function site_doSpacesGet__14(options, _) { var progress, result, spaces; var __frame = { name: "site_doSpacesGet__14", line: 892 }; return __func(_, this, arguments, site_doSpacesGet__14, 1, __frame, function __$site_doSpacesGet__14() {
log.verbose("Subscription", options.subscription);
progress = cli.progress("Enumerating locations"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$site_doSpacesGet__14() {
@@ -909,7 +911,7 @@ exports.init = function(cli) {
- site.doSitesGet = function site_doSitesGet__15(options, _) { var spaces, channel, progress, result, sites; var __frame = { name: "site_doSitesGet__15", line: 912 }; return __func(_, this, arguments, site_doSitesGet__15, 1, __frame, function __$site_doSitesGet__15() {
+ site.doSitesGet = function site_doSitesGet__15(options, _) { var spaces, channel, progress, result, sites; var __frame = { name: "site_doSitesGet__15", line: 914 }; return __func(_, this, arguments, site_doSitesGet__15, 1, __frame, function __$site_doSitesGet__15() {
log.verbose("Subscription", options.subscription);
return site.doSpacesGet(options, __cb(_, __frame, 3, 17, function ___(__0, __2) { spaces = __2;
@@ -921,7 +923,7 @@ exports.init = function(cli) {
progress = cli.progress("Enumerating sites"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$site_doSitesGet__15() {
- return async.map(spaces, function __1(webspace, _) { var __frame = { name: "__1", line: 926 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() {
+ return async.map(spaces, function __1(webspace, _) { var __frame = { name: "__1", line: 928 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() {
@@ -1000,12 +1002,12 @@ exports.init = function(cli) {
- site.doRepositoryGet = function site_doRepositoryGet__16(options, _) { var siteData; var __frame = { name: "site_doRepositoryGet__16", line: 1003 }; return __func(_, this, arguments, site_doRepositoryGet__16, 1, __frame, function __$site_doRepositoryGet__16() {
+ site.doRepositoryGet = function site_doRepositoryGet__16(options, _) { var siteData; var __frame = { name: "site_doRepositoryGet__16", line: 1005 }; return __func(_, this, arguments, site_doRepositoryGet__16, 1, __frame, function __$site_doRepositoryGet__16() {
return site.doSiteGet(options, __cb(_, __frame, 1, 19, function ___(__0, __1) { siteData = __1;
return _(null, getRepositoryUri(siteData)); }, true)); }); };
- site.doPublishingUsersGet = function site_doPublishingUsersGet__17(options, _) { var progress, publishingUsers; var __frame = { name: "site_doPublishingUsersGet__17", line: 1008 }; return __func(_, this, arguments, site_doPublishingUsersGet__17, 1, __frame, function __$site_doPublishingUsersGet__17() {
+ site.doPublishingUsersGet = function site_doPublishingUsersGet__17(options, _) { var progress, publishingUsers; var __frame = { name: "site_doPublishingUsersGet__17", line: 1010 }; return __func(_, this, arguments, site_doPublishingUsersGet__17, 1, __frame, function __$site_doPublishingUsersGet__17() {
progress = cli.progress("Retrieving user information"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$site_doPublishingUsersGet__17() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$site_doPublishingUsersGet__17() {
View
4 lib/cli/commands/site_.js
@@ -239,7 +239,9 @@ exports.init = function (cli) {
}
function promptForGithubCredentials(_) {
- log.help('Enter your github credentials');
+ if (!options.username || !options.pass) {
+ log.help('Enter your github credentials');
+ }
if (options.username) {
context.username = options.username;
View
98 lib/cli/linkedrevisioncontrol.js
@@ -116,7 +116,7 @@ GithubClient.prototype.init = function GithubClient_prototype_init__5(context, _
return __this.getRepositories(context.username, __cb(_, __frame, 4, 21, function ___(__0, __1) { repositories = __1;
return __this._getRemoteUri(__cb(_, __frame, 6, 22, function ___(__0, __2) { context.remoteUri = __2;
- if (context.remoteUri) {
+ if ((!context.flags.forceRepositorySelection && context.remoteUri)) {
parsedRepositoryUri = url.parse(context.remoteUri);
pathParts = parsedRepositoryUri.pathname.split("/");
if ((pathParts.length === 3)) {
@@ -145,40 +145,60 @@ GithubClient.prototype.deploy = function GithubClient_prototype_deploy__6(contex
parsedRepositoryUri.auth = context.repositoryAuth;
parsedRepositoryUri.pathname = "/deploy";
hookUrl = url.format(parsedRepositoryUri);
+ return context.lvcClient.createOrUpdateHook(context.repository.owner.login, context.repository.name, hookUrl, __cb(_, __frame, 5, 2, function __$GithubClient_prototype_deploy__6() {
- return context.lvcClient.createOrUpdateHook(context.repository.owner.login, context.repository.name, hookUrl, __cb(_, __frame, 6, 2, function __$GithubClient_prototype_deploy__6() { return (function __$GithubClient_prototype_deploy__6(__then) {
+ gitUri = context.repository.git_url; return (function __$GithubClient_prototype_deploy__6(__then) {
+ if ((context.remoteUri && (context.remoteUri.toLowerCase() !== gitUri.toLowerCase()))) {
+ __this.cli.output.verbose("Removing existing azure remote alias");
+ return __this._exec("git remote rm azure", __cb(_, __frame, 13, 4, function __$GithubClient_prototype_deploy__6() {
+ context.remoteUri = null; __then(); }, true)); } else { __then(); } ; })(function __$GithubClient_prototype_deploy__6() { return (function __$GithubClient_prototype_deploy__6(__then) {
- if (!context.remoteUri) {
- gitUri = context.repository.git_url;
+ if (!context.remoteUri) {
- __this.cli.output.info((("Executing `git remote add azure " + gitUri) + "`"));
- return __this._exec(("git remote add azure " + gitUri), __cb(_, __frame, 16, 4, __then, true)); } else { __then(); } ; })(_); }, true)); });};
+ __this.cli.output.info((("Executing `git remote add azure " + gitUri) + "`"));
+ return __this._exec(("git remote add azure " + gitUri), __cb(_, __frame, 20, 4, __then, true)); } else { __then(); } ; })(_); }); }, true)); });};
-GithubClient.prototype.getRepositories = function GithubClient_prototype_getRepositories__7(username, _) { var progress, userRepos, orgs, i, org, __this = this; var __frame = { name: "GithubClient_prototype_getRepositories__7", line: 163 }; return __func(_, this, arguments, GithubClient_prototype_getRepositories__7, 1, __frame, function __$GithubClient_prototype_getRepositories__7() {
- progress = __this.cli.progress("Retrieving repositories");
- userRepos = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$GithubClient_prototype_getRepositories__7() {
+GithubClient.prototype.getRepositories = function GithubClient_prototype_getRepositories__7(username, _) { var progress, userRepos, orgs, orgRepos, i, org, __this = this;
- return __this.client.repos.getFromUser({ user: username }, __cb(_, __frame, 5, 16, function ___(__0, __3) { userRepos = __3;
- return __this.client.orgs.getFromUser({ user: username }, __cb(_, __frame, 6, 15, function ___(__0, __4) { orgs = __4; return (function __$GithubClient_prototype_getRepositories__7(__then) {
+
+ function sortFunction(repositoryA, repositoryB) {
+ return repositoryA.full_name.toLowerCase().localeCompare(repositoryB.full_name.toLowerCase()); };
+
+
+
+ function filterPrivate(repository) {
+ return (repository["private"] !== true); }; var __frame = { name: "GithubClient_prototype_getRepositories__7", line: 167 }; return __func(_, this, arguments, GithubClient_prototype_getRepositories__7, 1, __frame, function __$GithubClient_prototype_getRepositories__7() { progress = __this.cli.progress("Retrieving repositories"); userRepos = []; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$GithubClient_prototype_getRepositories__7() {
+
+
+
+ return __this.client.repos.getFromUser({ user: username }, __cb(_, __frame, 14, 16, function ___(__0, __3) { userRepos = __3.filter(filterPrivate).sort(sortFunction);
+
+
+
+ return __this.client.orgs.getFromUser({ user: username }, __cb(_, __frame, 18, 15, function ___(__0, __4) { orgs = __4; return (function __$GithubClient_prototype_getRepositories__7(__then) {
if (orgs) {
+ orgRepos = [];
var __1 = __forIn(orgs); var __2 = 0; return (function ___(__break) { var __more; var __loop = __cb(_, __frame, 0, 0, function __$GithubClient_prototype_getRepositories__7() { __more = false; var __8 = (__2 < __1.length); if (__8) { i = __1[__2++]; return (function __$GithubClient_prototype_getRepositories__7(__then) {
if (orgs.hasOwnProperty(i)) {
org = orgs[i]; return (function __$GithubClient_prototype_getRepositories__7(__then) {
if (org.login) {
- return __this.client.repos.getFromOrg({ org: org.login }, __cb(_, __frame, 12, 20, function ___(__0, __5) { repos = __5;
+ return __this.client.repos.getFromOrg({ org: org.login }, __cb(_, __frame, 25, 20, function ___(__0, __5) { repos = __5;
+
+ orgRepos = orgRepos.concat(repos); __then(); }, true)); } else { __then(); } ; })(__then); } else { __then(); } ; })(function __$GithubClient_prototype_getRepositories__7() { while (__more) { __loop(); }; __more = true; }); } else { __break(); } ; }); do { __loop(); } while (__more); __more = true; })(__then); } else { __then(); } ; })(function __$GithubClient_prototype_getRepositories__7() {
- userRepos = userRepos.concat(repos); __then(); }, true)); } else { __then(); } ; })(__then); } else { __then(); } ; })(function __$GithubClient_prototype_getRepositories__7() { while (__more) { __loop(); }; __more = true; }); } else { __break(); } ; }); do { __loop(); } while (__more); __more = true; })(__then); } else { __then(); } ; })(function __$GithubClient_prototype_getRepositories__7() { _(null, null, true); }); }, true)); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$GithubClient_prototype_getRepositories__7() {
+ orgRepos = orgRepos.filter(filterPrivate).sort(sortFunction);
+ userRepos = userRepos.concat(orgRepos); _(null, null, true); }); }, true)); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$GithubClient_prototype_getRepositories__7() {
progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$GithubClient_prototype_getRepositories__7() {
@@ -186,7 +206,7 @@ GithubClient.prototype.getRepositories = function GithubClient_prototype_getRepo
return _(null, userRepos); }); }); });};
-GithubClient.prototype.createOrUpdateHook = function GithubClient_prototype_createOrUpdateHook__8(username, repository, deployUri, _) { var hook, hooks, parsedDeployUri, existingHook, __this = this; var __frame = { name: "GithubClient_prototype_createOrUpdateHook__8", line: 189 }; return __func(_, this, arguments, GithubClient_prototype_createOrUpdateHook__8, 3, __frame, function __$GithubClient_prototype_createOrUpdateHook__8() {
+GithubClient.prototype.createOrUpdateHook = function GithubClient_prototype_createOrUpdateHook__8(username, repository, deployUri, _) { var hook, hooks, parsedDeployUri, existingHook, __this = this; var __frame = { name: "GithubClient_prototype_createOrUpdateHook__8", line: 209 }; return __func(_, this, arguments, GithubClient_prototype_createOrUpdateHook__8, 3, __frame, function __$GithubClient_prototype_createOrUpdateHook__8() {
hook = {
name: "web",
user: username,
@@ -208,72 +228,88 @@ GithubClient.prototype.createOrUpdateHook = function GithubClient_prototype_crea
- existingHook = hooks.filter(function(hook) { if (hook.config) { return ((hook.name === "web") && (url.parse(hook.config.url).hostname === parsedDeployUri.hostname)); } ; return false; })[0]; return (function __$GithubClient_prototype_createOrUpdateHook__8(__then) {
+ existingHook = hooks.filter(function(hook) { if (hook.config) { return ((hook.name === "web") && (url.parse(hook.config.url).hostname.toLowerCase() === parsedDeployUri.hostname.toLowerCase())); } ; return false; })[0]; return (function __$GithubClient_prototype_createOrUpdateHook__8(__then) {
if (existingHook) { return (function __$GithubClient_prototype_createOrUpdateHook__8(__then) {
- if ((existingHook.config.url !== hook.config.url)) {
+ if ((existingHook.config.url.toLowerCase() !== hook.config.url.toLowerCase())) {
existingHook.config.url = hook.config.url;
hook = existingHook;
- return __this.updateHook(hook, __cb(_, __frame, 29, 6, __then, true)); } else {
+ hook.user = username;
+ hook.repo = repository;
+ return __this.updateHook(hook, __cb(_, __frame, 31, 13, function ___(__0, __2) { hook = __2;
+ return __this.testHook(hook, __cb(_, __frame, 32, 6, __then, true)); }, true)); } else {
__this.cli.output.info("Link already established"); __then(); } ; })(__then); } else {
- return __this.createHook(hook, __cb(_, __frame, 34, 4, __then, true)); } ; })(_); }, true)); });};
+ return __this.createHook(hook, __cb(_, __frame, 37, 11, function ___(__0, __3) { hook = __3;
+ hook.user = username;
+ hook.repo = repository;
+ return __this.testHook(hook, __cb(_, __frame, 40, 4, __then, true)); }, true)); } ; })(_); }, true)); });};
-GithubClient.prototype.createHook = function GithubClient_prototype_createHook__9(hook, _) { var progress, __this = this; var __frame = { name: "GithubClient_prototype_createHook__9", line: 227 }; return __func(_, this, arguments, GithubClient_prototype_createHook__9, 1, __frame, function __$GithubClient_prototype_createHook__9() {
+GithubClient.prototype.createHook = function GithubClient_prototype_createHook__9(hook, _) { var progress, __this = this; var __frame = { name: "GithubClient_prototype_createHook__9", line: 253 }; return __func(_, this, arguments, GithubClient_prototype_createHook__9, 1, __frame, function __$GithubClient_prototype_createHook__9() {
progress = __this.cli.progress("Creating new hook"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$GithubClient_prototype_createHook__9() {
- return __this.client.repos.createHook(hook, __cb(_, __frame, 4, 4, function __$GithubClient_prototype_createHook__9() { _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$GithubClient_prototype_createHook__9() {
+ return __this.client.repos.createHook(hook, __cb(_, __frame, 4, 11, _, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$GithubClient_prototype_createHook__9() {
progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, _); }); });};
-GithubClient.prototype.updateHook = function GithubClient_prototype_updateHook__10(hook, _) { var progress, __this = this; var __frame = { name: "GithubClient_prototype_updateHook__10", line: 237 }; return __func(_, this, arguments, GithubClient_prototype_updateHook__10, 1, __frame, function __$GithubClient_prototype_updateHook__10() {
+GithubClient.prototype.updateHook = function GithubClient_prototype_updateHook__10(hook, _) { var progress, __this = this; var __frame = { name: "GithubClient_prototype_updateHook__10", line: 263 }; return __func(_, this, arguments, GithubClient_prototype_updateHook__10, 1, __frame, function __$GithubClient_prototype_updateHook__10() {
progress = __this.cli.progress("Updating hook"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$GithubClient_prototype_updateHook__10() {
- return __this.client.repos.updateHook(hook, __cb(_, __frame, 4, 4, function __$GithubClient_prototype_updateHook__10() { _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$GithubClient_prototype_updateHook__10() {
+ return __this.client.repos.updateHook(hook, __cb(_, __frame, 4, 11, _, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$GithubClient_prototype_updateHook__10() {
+
+ progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, _); }); });};
+
+
+
+GithubClient.prototype.testHook = function GithubClient_prototype_testHook__11(hook, _) { var progress, __this = this; var __frame = { name: "GithubClient_prototype_testHook__11", line: 273 }; return __func(_, this, arguments, GithubClient_prototype_testHook__11, 1, __frame, function __$GithubClient_prototype_testHook__11() {
+ progress = __this.cli.progress("Testing new hook"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$GithubClient_prototype_testHook__11() {
+
+
+ return __this.client.repos.testHook(hook, __cb(_, __frame, 4, 4, function __$GithubClient_prototype_testHook__11() { _(null, null, true); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$GithubClient_prototype_testHook__11() {
progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, _); }); });};
-GithubClient.prototype.getHooks = function GithubClient_prototype_getHooks__11(username, repository, _) { var progress, __this = this; var __frame = { name: "GithubClient_prototype_getHooks__11", line: 247 }; return __func(_, this, arguments, GithubClient_prototype_getHooks__11, 2, __frame, function __$GithubClient_prototype_getHooks__11() {
- progress = __this.cli.progress("Retrieving website hooks"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$GithubClient_prototype_getHooks__11() {
+GithubClient.prototype.getHooks = function GithubClient_prototype_getHooks__12(username, repository, _) { var progress, __this = this; var __frame = { name: "GithubClient_prototype_getHooks__12", line: 283 }; return __func(_, this, arguments, GithubClient_prototype_getHooks__12, 2, __frame, function __$GithubClient_prototype_getHooks__12() {
+ progress = __this.cli.progress("Retrieving website hooks"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$GithubClient_prototype_getHooks__12() {
return __this.client.repos.getHooks({
user: username,
- repo: repository }, __cb(_, __frame, 4, 11, _, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$GithubClient_prototype_getHooks__11() {
+ repo: repository }, __cb(_, __frame, 4, 11, _, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$GithubClient_prototype_getHooks__12() {
progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, _); }); });};
-GithubClient.prototype._getRemoteUri = function GithubClient_prototype__getRemoteUri__12(_) { var progress, originUri, __this = this; var __frame = { name: "GithubClient_prototype__getRemoteUri__12", line: 260 }; return __func(_, this, arguments, GithubClient_prototype__getRemoteUri__12, 0, __frame, function __$GithubClient_prototype__getRemoteUri__12() {
+GithubClient.prototype._getRemoteUri = function GithubClient_prototype__getRemoteUri__13(_) { var progress, originUri, __this = this; var __frame = { name: "GithubClient_prototype__getRemoteUri__13", line: 296 }; return __func(_, this, arguments, GithubClient_prototype__getRemoteUri__13, 0, __frame, function __$GithubClient_prototype__getRemoteUri__13() {
progress = __this.cli.progress("Retrieving local git repositories");
- originUri = null; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$GithubClient_prototype__getRemoteUri__12() {
+ originUri = null; return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$GithubClient_prototype__getRemoteUri__13() {
- return __this._getRemote("azure", __cb(_, __frame, 5, 16, function ___(__0, __1) { originUri = __1; return (function __$GithubClient_prototype__getRemoteUri__12(__then) {
+ return __this._getRemote("azure", __cb(_, __frame, 5, 16, function ___(__0, __1) { originUri = __1; return (function __$GithubClient_prototype__getRemoteUri__13(__then) {
if (!originUri) {
- return __this._getRemote("origin", __cb(_, __frame, 7, 18, function ___(__0, __2) { originUri = __2; __then(); }, true)); } else { __then(); } ; })(function __$GithubClient_prototype__getRemoteUri__12() { _(null, null, true); }); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$GithubClient_prototype__getRemoteUri__12() {
+ return __this._getRemote("origin", __cb(_, __frame, 7, 18, function ___(__0, __2) { originUri = __2; __then(); }, true)); } else { __then(); } ; })(function __$GithubClient_prototype__getRemoteUri__13() { _(null, null, true); }); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$GithubClient_prototype__getRemoteUri__13() {
- progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$GithubClient_prototype__getRemoteUri__12() {
+ progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$GithubClient_prototype__getRemoteUri__13() {
return _(null, originUri); }); }); });};
-GithubClient.prototype._getRemote = function GithubClient_prototype__getRemote__13(name, _) { var remotes, origin, __this = this; var __frame = { name: "GithubClient_prototype__getRemote__13", line: 276 }; return __func(_, this, arguments, GithubClient_prototype__getRemote__13, 1, __frame, function __$GithubClient_prototype__getRemote__13() {
+GithubClient.prototype._getRemote = function GithubClient_prototype__getRemote__14(name, _) { var remotes, origin, __this = this; var __frame = { name: "GithubClient_prototype__getRemote__14", line: 312 }; return __func(_, this, arguments, GithubClient_prototype__getRemote__14, 1, __frame, function __$GithubClient_prototype__getRemote__14() {
return __this._exec("git remote -v", __cb(_, __frame, 1, 16, function ___(__0, __1) { remotes = __1;
origin = ((remotes.stdout + remotes.stderr)).split("\n").filter(function(item) {
return item.split(" ").some(function(it) {
View
60 lib/cli/linkedrevisioncontrol_.js
@@ -116,7 +116,7 @@ GithubClient.prototype.init = function (context, _) {
var repositories = this.getRepositories(context.username, _);
context.remoteUri = this._getRemoteUri(_);
- if (context.remoteUri) {
+ if (!context.flags.forceRepositorySelection && context.remoteUri) {
var parsedRepositoryUri = url.parse(context.remoteUri);
var pathParts = parsedRepositoryUri.pathname.split('/');
if (pathParts.length === 3) {
@@ -145,15 +145,19 @@ GithubClient.prototype.deploy = function (context, _) {
parsedRepositoryUri.auth = context.repositoryAuth;
parsedRepositoryUri.pathname = '/deploy';
var hookUrl = url.format(parsedRepositoryUri);
-
context.lvcClient.createOrUpdateHook(context.repository.owner.login,
context.repository.name,
hookUrl,
_);
- if (!context.remoteUri) {
- var gitUri = context.repository.git_url;
+ var gitUri = context.repository.git_url;
+ if (context.remoteUri && context.remoteUri.toLowerCase() !== gitUri.toLowerCase()) {
+ this.cli.output.verbose('Removing existing azure remote alias');
+ this._exec('git remote rm azure', _);
+ context.remoteUri = null;
+ }
+ if (!context.remoteUri) {
// create the remote repo locally
this.cli.output.info('Executing `git remote add azure ' + gitUri + '`');
this._exec('git remote add azure ' + gitUri, _);
@@ -164,21 +168,37 @@ GithubClient.prototype.getRepositories = function (username, _) {
var progress = this.cli.progress('Retrieving repositories');
var userRepos = [];
+ function sortFunction (repositoryA, repositoryB) {
+ return repositoryA.full_name.toLowerCase()
+ .localeCompare(repositoryB.full_name.toLowerCase());
+ };
+
+ function filterPrivate (repository) {
+ return repository['private'] !== true;
+ };
+
try {
- userRepos = this.client.repos.getFromUser({ user: username }, _);
+ userRepos = this.client.repos.getFromUser({ user: username }, _)
+ .filter(filterPrivate)
+ .sort(sortFunction);
+
var orgs = this.client.orgs.getFromUser({ user: username }, _);
if (orgs) {
+ var orgRepos = [];
for (var i in orgs) {
if (orgs.hasOwnProperty(i)) {
var org = orgs[i];
if (org.login) {
repos = this.client.repos.getFromOrg({ org: org.login }, _);
- userRepos = userRepos.concat(repos);
+ orgRepos = orgRepos.concat(repos);
}
}
}
}
+ orgRepos = orgRepos.filter(filterPrivate).sort(sortFunction);
+
+ userRepos = userRepos.concat(orgRepos);
} finally {
progress.end();
}
@@ -204,7 +224,7 @@ GithubClient.prototype.createOrUpdateHook = function (username, repository, depl
var existingHook = hooks.filter(function (hook) {
if (hook.config) {
return hook.name === 'web' &&
- url.parse(hook.config.url).hostname === parsedDeployUri.hostname;
+ url.parse(hook.config.url).hostname.toLowerCase() === parsedDeployUri.hostname.toLowerCase();
}
return false;
@@ -212,15 +232,21 @@ GithubClient.prototype.createOrUpdateHook = function (username, repository, depl
if (existingHook) {
// check if full url is also the same
- if (existingHook.config.url !== hook.config.url) {
+ if (existingHook.config.url.toLowerCase() !== hook.config.url.toLowerCase()) {
existingHook.config.url = hook.config.url;
hook = existingHook;
- this.updateHook(hook, _);
+ hook.user = username;
+ hook.repo = repository;
+ hook = this.updateHook(hook, _);
+ this.testHook(hook, _);
} else {
this.cli.output.info('Link already established');
}
} else {
- this.createHook(hook, _);
+ hook = this.createHook(hook, _);
+ hook.user = username;
+ hook.repo = repository;
+ this.testHook(hook, _);
}
};
@@ -228,7 +254,7 @@ GithubClient.prototype.createHook = function (hook, _) {
var progress = this.cli.progress('Creating new hook');
try {
- this.client.repos.createHook(hook, _);
+ return this.client.repos.createHook(hook, _);
} finally {
progress.end();
}
@@ -238,7 +264,17 @@ GithubClient.prototype.updateHook = function (hook, _) {
var progress = this.cli.progress('Updating hook');
try {
- this.client.repos.updateHook(hook, _);
+ return this.client.repos.updateHook(hook, _);
+ } finally {
+ progress.end();
+ }
+};
+
+GithubClient.prototype.testHook = function (hook, _) {
+ var progress = this.cli.progress('Testing new hook');
+
+ try {
+ this.client.repos.testHook(hook, _);
} finally {
progress.end();
}
View
34 test/cli/linkrevisioncontrol-tests.js
@@ -55,7 +55,7 @@ suite('cli', function(){
url.should.equal('git://github.com/andrerod/mynewsite999.git');
done();
- })
+ });
});
test('should get remote origin uri', function(done) {
@@ -78,7 +78,7 @@ suite('cli', function(){
url.should.equal('git://github.com/andrerod/mynewsite999.git');
done();
- })
+ });
});
test('should not get other remote uris', function(done) {
@@ -101,7 +101,35 @@ suite('cli', function(){
should.strictEqual(undefined, url);
done();
- })
+ });
+ });
+
+ test('site create hook', function(done) {
+ // Setup
+ var originUrl = {
+ stdout: 'myremote\tgit://github.com/andrerod/mynewsite999.git (fetch)\n' +
+ 'myremote\tgit://github.com/andrerod/mynewsite999.git (push)\n',
+ stderr: ''
+ };
+
+/*
+ var cli = { output: { }, progress: function() { return { end: function() {}}} };
+
+
+ var githubClient = LinkedRevisionControl.createClient(cli, 'github');
+
+ var execStub = sandbox.stub(githubClient.repos, 'createHook');
+ execStub.yields(undefined, originUrl);
+*/
+ var username = process.env['AZURE_GITHUB_USERNAME'];
+ var password = process.env['AZURE_GITHUB_PASSWORD'];
+
+ capture(function() {
+ cli.parse('node cli.js site create mytestsite --github --username ' + username + ' --pass ' + password + ' --location "East US"'.split(' '));
+ }, function (result) {
+ console.log(result);
+ done();
+ });
});
});
});

0 comments on commit 5577072

Please sign in to comment.
Something went wrong with that request. Please try again.