Skip to content

Commit

Permalink
Improving existing hook detection logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Rodrigues committed Oct 18, 2012
1 parent 8276ea8 commit 909858e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
35 changes: 18 additions & 17 deletions lib/cli/commands/deployment.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,16 @@ exports.init = function(cli) {
context.hook = existingHook;
return scm.doUpdateHook(context, __cb(_, __frame, 33, 12, __then, true)); } else {

return _(new Error("Link already established")); } ; })(__then); } else {
log.info("Link already established"); __then(); } ; })(__then); } else {


return scm.doCreateHook(context, __cb(_, __frame, 38, 10, __then, true)); } ; })(_); }, true)); }); };



function addRemoteToLocalGitRepo(_) { var gitUri; var __frame = { name: "addRemoteToLocalGitRepo", line: 277 }; return __func(_, this, arguments, addRemoteToLocalGitRepo, 0, __frame, function __$addRemoteToLocalGitRepo() {
if ((context.remoteUri !== undefined)) { return _(null); } ;
console.log(context.remoteUri);
if (context.remoteUri) { return _(null); } ;



Expand All @@ -284,11 +285,11 @@ exports.init = function(cli) {


log.info((("Executing `git remote add azure " + gitUri) + "`"));
return exec(("git remote add azure " + gitUri), __cb(_, __frame, 10, 8, _, true)); }); }; var __frame = { name: "__4", line: 179 }; return __func(_, this, arguments, __4, 2, __frame, function __$__4() { context = { subscription: cli.category("account").lookupSubscriptionId(options.subscription), site: { name: nameArg } }; return ensureRepositoryUri(context, __cb(_, __frame, 9, 6, function __$__4() { return promptForCredentials(__cb(_, __frame, 10, 6, function __$__4() { return promptForRepository(__cb(_, __frame, 11, 6, function __$__4() { return linkRemoteGitRepo(__cb(_, __frame, 12, 6, function __$__4() { return addRemoteToLocalGitRepo(__cb(_, __frame, 13, 6, _, true)); }, true)); }, true)); }, true)); }, true)); }); });
return exec(("git remote add azure " + gitUri), __cb(_, __frame, 11, 8, _, true)); }); }; var __frame = { name: "__4", line: 179 }; return __func(_, this, arguments, __4, 2, __frame, function __$__4() { context = { subscription: cli.category("account").lookupSubscriptionId(options.subscription), site: { name: nameArg } }; return ensureRepositoryUri(context, __cb(_, __frame, 9, 6, function __$__4() { return promptForCredentials(__cb(_, __frame, 10, 6, function __$__4() { return promptForRepository(__cb(_, __frame, 11, 6, function __$__4() { return linkRemoteGitRepo(__cb(_, __frame, 12, 6, function __$__4() { return addRemoteToLocalGitRepo(__cb(_, __frame, 13, 6, _, true)); }, true)); }, true)); }, true)); }, true)); }); });



scm.doCreateHook = function scm_doCreateHook__5(context, _) { var progress; var __frame = { name: "scm_doCreateHook__5", line: 291 }; 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: 292 }; 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() {


Expand All @@ -298,7 +299,7 @@ exports.init = function(cli) {



scm.doUpdateHook = function scm_doUpdateHook__6(context, _) { var progress; var __frame = { name: "scm_doUpdateHook__6", line: 301 }; 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: 302 }; 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() {


Expand All @@ -308,7 +309,7 @@ exports.init = function(cli) {



scm.doGetHooks = function scm_doGetHooks__7(context, _) { var progress; var __frame = { name: "scm_doGetHooks__7", line: 311 }; 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: 312 }; 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() {


Expand All @@ -326,7 +327,7 @@ exports.init = function(cli) {



function getRemote(name, _) { var remotes, origin; var __frame = { name: "getRemote", line: 329 }; return __func(_, this, arguments, getRemote, 1, __frame, function __$getRemote() {
function getRemote(name, _) { var remotes, origin; var __frame = { name: "getRemote", line: 330 }; 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) {
Expand All @@ -338,7 +339,7 @@ exports.init = function(cli) {
return _(null, origin[0].split(" ")[1].split(" ")[0]); } ;


return _(null, null); }, true)); }); }; var __frame = { name: "scm_doGetRemoteUri__8", line: 324 }; 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: 325 }; 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) {
Expand All @@ -352,7 +353,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: 355 }; 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: 356 }; 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() {

Expand All @@ -376,7 +377,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: 379 }; 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: 380 }; return __func(_, this, arguments, scm_doDeploymentsGet__10, 1, __frame, function __$scm_doDeploymentsGet__10() {
maxItems = parseInt(context.maxItems, 10);
if ((!maxItems || (maxItems <= 0))) {
maxItems = 20; } ;
Expand All @@ -397,7 +398,7 @@ exports.init = function(cli) {



scm.doDeploymentGet = function scm_doDeploymentGet__11(context, _) { var channel, progress; var __frame = { name: "scm_doDeploymentGet__11", line: 400 }; 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: 401 }; return __func(_, this, arguments, scm_doDeploymentGet__11, 1, __frame, function __$scm_doDeploymentGet__11() {


channel = getScmChannel(context).path("deployments").path(context.id);
Expand All @@ -409,7 +410,7 @@ exports.init = function(cli) {



scm.doDeploymentPut = function scm_doDeploymentPut__12(context, _) { var channel, progress; var __frame = { name: "scm_doDeploymentPut__12", line: 412 }; 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: 413 }; return __func(_, this, arguments, scm_doDeploymentPut__12, 1, __frame, function __$scm_doDeploymentPut__12() {


channel = getScmChannel(context).path("deployments").path(context.id);
Expand All @@ -421,7 +422,7 @@ exports.init = function(cli) {



scm.doLogGet = function scm_doLogGet__13(context, _) { var channel, progress, logs; var __frame = { name: "scm_doLogGet__13", line: 424 }; 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: 425 }; return __func(_, this, arguments, scm_doLogGet__13, 1, __frame, function __$scm_doLogGet__13() {



Expand All @@ -435,7 +436,7 @@ exports.init = function(cli) {



function listDeployments(context, _) { var deployments, authorLength, messageLength; var __frame = { name: "listDeployments", line: 438 }; return __func(_, this, arguments, listDeployments, 1, __frame, function __$listDeployments() {
function listDeployments(context, _) { var deployments, authorLength, messageLength; var __frame = { name: "listDeployments", line: 439 }; 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)) {
Expand All @@ -453,13 +454,13 @@ exports.init = function(cli) {



function getLogDetails(context, _) { var results, logs, progress, i; var __frame = { name: "getLogDetails", line: 456 }; return __func(_, this, arguments, getLogDetails, 1, __frame, function __$getLogDetails() {
function getLogDetails(context, _) { var results, logs, progress, i; var __frame = { name: "getLogDetails", line: 457 }; 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: 462 }; 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: 463 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() { return (function __$__1(__then) {
if (log.hasDetails) {


Expand Down Expand Up @@ -552,7 +553,7 @@ exports.init = function(cli) {



function ensureRepositoryUri(context, _) { var siteData, repositoryUri; var __frame = { name: "ensureRepositoryUri", line: 555 }; return __func(_, this, arguments, ensureRepositoryUri, 1, __frame, function __$ensureRepositoryUri() {
function ensureRepositoryUri(context, _) { var siteData, repositoryUri; var __frame = { name: "ensureRepositoryUri", line: 556 }; 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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/cli/commands/deployment_.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,15 @@ exports.init = function (cli) {
context.hook = existingHook;
scm.doUpdateHook(context, _);
} else {
throw new Error('Link already established');
log.info('Link already established');
}
} else {
scm.doCreateHook(context, _);
}
}

function addRemoteToLocalGitRepo(_) {
if (context.remoteUri !== undefined) {
if (context.remoteUri) {
return;
}

Expand Down

0 comments on commit 909858e

Please sign in to comment.