From 2e16a6d68c51a1c6bda2f278810219f5003f329d Mon Sep 17 00:00:00 2001 From: Louis DeJardin Date: Fri, 27 Apr 2012 12:41:46 -0700 Subject: [PATCH] Improving azure site --location option Don't prompt for location when provided Map provided location from matching display name to webspace name --- lib/cli/commands/site.js | 836 +++++++++++++++++++------------------- lib/cli/commands/site_.js | 16 + 2 files changed, 441 insertions(+), 411 deletions(-) diff --git a/lib/cli/commands/site.js b/lib/cli/commands/site.js index 3eda9173b..df0853b6f 100644 --- a/lib/cli/commands/site.js +++ b/lib/cli/commands/site.js @@ -1,4 +1,4 @@ -/*** Generated by streamline 0.2.2 - DO NOT EDIT ***/ +/*** Generated by streamline 0.2.5 - DO NOT EDIT ***/ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func=__rt.__func,__cb=__rt.__cb,__tryCatch=__rt.__tryCatch,__propagate=__rt.__propagate,__trap=__rt.__trap,__future=__rt.__future,__setEF=__rt.__setEF,__g=__rt.__g; /* 1 */ var common = require("../common"); /* 20 */ var fs = require("fs"); @@ -54,8 +54,8 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= /* 83 */ row.cell("Host names", clean(site).HostNames); }); _(); - })); - })); + }, true)); + }, true)); }); }); /* 87 */ function choose(data, callback) { @@ -88,7 +88,7 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= /* 130 */ return prompt("Name: ", __cb(_, __frame, 4, 40, function ___(__0, __1) { /* 130 */ context.site.name = __1; __then(); - })); + }, true)); } else { __then(); @@ -127,34 +127,48 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= } ; _(); - })); + }, true)); }); }; /* 152 */ function promptForLocation(_) { - var spaces, href; + var spaces, displayNameMatches, href; var __frame = { name: "promptForLocation", line: 152 }; return __func(_, this, arguments, promptForLocation, 0, __frame, function __$promptForLocation() { /* 153 */ log.silly("promptForLocation"); -/* 154 */ return site.doSpacesGet(context, __cb(_, __frame, 2, 29, function ___(__0, __1) { +/* 155 */ return site.doSpacesGet(context, __cb(_, __frame, 3, 29, function ___(__0, __1) { spaces = __1; +/* 157 */ if ((context.site.webspace !== undefined)) { +/* 159 */ displayNameMatches = spaces.filter(function(space) { +/* 160 */ return (space.GeoRegion === context.site.webspace); + }); +/* 162 */ if ((displayNameMatches.length === 1)) { +/* 163 */ context.site.webspace = displayNameMatches[0].Name; + } + ; + } + ; +/* 167 */ if ((context.site.webspace !== undefined)) { + return _(null); + } + ; return (function __$promptForLocation(__then) { -/* 156 */ if ((spaces.length === 0)) { -/* 157 */ log.help("You must create your first web site using the Windows Azure portal."); -/* 158 */ log.help("Please follow these steps in the portal:"); -/* 159 */ log.help("1. At the bottom of the page, click on New > Web Site > Quick Create"); -/* 160 */ log.help("2. Type \"{whatever they supplied as the name}\" in the URL field"); -/* 161 */ log.help("3. Click on \"Create Web Site\""); -/* 162 */ log.help("4. Once the site has been created, click on the site name"); -/* 163 */ log.help("5. Click on \"Set up Git publishing\" and create a publishing username and password. Use those credentials for all new websites you create."); -/* 164 */ return confirm("Launch browser to portal now? (y/n) ", __cb(_, __frame, 12, 24, function ___(__0, __2) { +/* 172 */ if ((spaces.length === 0)) { +/* 173 */ log.help("You must create your first web site using the Windows Azure portal."); +/* 174 */ log.help("Please follow these steps in the portal:"); +/* 175 */ log.help("1. At the bottom of the page, click on New > Web Site > Quick Create"); +/* 176 */ log.help((("2. Type \"" + context.site.name) + "\" in the URL field")); +/* 177 */ log.help("3. Click on \"Create Web Site\""); +/* 178 */ log.help("4. Once the site has been created, click on the site name"); +/* 179 */ log.help("5. Click on \"Set up Git publishing\" and create a publishing username and password. Use those credentials for all new websites you create."); +/* 180 */ return confirm("Launch browser to portal now? (y/n) ", __cb(_, __frame, 28, 24, function ___(__0, __2) { return (function __$promptForLocation(__then) { if (__2) { -/* 165 */ log.help("Launching portal."); -/* 166 */ href = "https://windows.azure-test.net/"; -/* 167 */ common.launchBrowser(href); +/* 181 */ log.help("Launching portal."); +/* 182 */ href = "https://windows.azure-test.net/"; +/* 183 */ common.launchBrowser(href); __then(); } else { @@ -162,58 +176,58 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= } ; })(function __$promptForLocation() { -/* 169 */ return _(new Error("First site must be created on portal")); +/* 185 */ return _(new Error("First site must be created on portal")); }); - })); + }, true)); } else { return (function __$promptForLocation(__then) { -/* 170 */ if ((spaces.length == 1)) { -/* 171 */ context.site.webspace = spaces[0].Name; -/* 172 */ log.info("Using location", context.site.webspace); +/* 186 */ if ((spaces.length == 1)) { +/* 187 */ context.site.webspace = spaces[0].Name; +/* 188 */ log.info("Using location", context.site.webspace); __then(); } else { -/* 174 */ log.help("Choose a region"); -/* 175 */ return choose(spaces.map(function(space) { -/* 176 */ return space.GeoRegion; - }), __cb(_, __frame, 23, 51, function ___(__0, __3) { -/* 175 */ context.site.webspace = spaces[__3].Name; +/* 190 */ log.help("Choose a region"); +/* 191 */ return choose(spaces.map(function(space) { +/* 192 */ return space.GeoRegion; + }), __cb(_, __frame, 39, 51, function ___(__0, __3) { +/* 191 */ context.site.webspace = spaces[__3].Name; __then(); - })); + }, true)); } ; })(__then); } ; })(_); - })); + }, true)); }); }; -/* 181 */ function determineIfCurrentDirectoryIsGitWorkingTree(_) { +/* 197 */ function determineIfCurrentDirectoryIsGitWorkingTree(_) { var isInsideWorkTree, lines; var __frame = { name: "determineIfCurrentDirectoryIsGitWorkingTree", - line: 181 + line: 197 }; return __func(_, this, arguments, determineIfCurrentDirectoryIsGitWorkingTree, 0, __frame, function __$determineIfCurrentDirectoryIsGitWorkingTree() { -/* 182 */ log.silly("determineIfCurrentDirectoryIsGitWorkingTree"); +/* 198 */ log.silly("determineIfCurrentDirectoryIsGitWorkingTree"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$determineIfCurrentDirectoryIsGitWorkingTree() { -/* 185 */ return exec("git rev-parse --is-inside-work-tree", __cb(_, __frame, 4, 43, function ___(__0, __1) { +/* 201 */ return exec("git rev-parse --is-inside-work-tree", __cb(_, __frame, 4, 43, function ___(__0, __1) { isInsideWorkTree = __1; -/* 186 */ lines = (isInsideWorkTree.stdout + isInsideWorkTree.stderr); -/* 187 */ context.flags.isGitWorkingTree = lines.split("\n").some(function(line) { -/* 188 */ return (line === "true"); +/* 202 */ lines = (isInsideWorkTree.stdout + isInsideWorkTree.stderr); +/* 203 */ context.flags.isGitWorkingTree = lines.split("\n").some(function(line) { +/* 204 */ return (line === "true"); }); __then(); - })); + }, true)); }); })(function ___(err, __result) { __tryCatch(_, function __$determineIfCurrentDirectoryIsGitWorkingTree() { if (err) { -/* 191 */ context.flags.isGitWorkingTree = false; +/* 207 */ context.flags.isGitWorkingTree = false; __then(); } else { @@ -227,54 +241,54 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= }); }); }; -/* 195 */ function initGitOnCurrentDirectory(_) { +/* 211 */ function initGitOnCurrentDirectory(_) { var __frame = { name: "initGitOnCurrentDirectory", - line: 195 + line: 211 }; return __func(_, this, arguments, initGitOnCurrentDirectory, 0, __frame, function __$initGitOnCurrentDirectory() { -/* 196 */ log.silly("initGitOnCurrentDirectoryIfNeeded"); -/* 197 */ if (context.flags.isGitWorkingTree) { +/* 212 */ log.silly("initGitOnCurrentDirectoryIfNeeded"); +/* 213 */ if (context.flags.isGitWorkingTree) { return _(null); } ; -/* 201 */ if (!options.git) { +/* 217 */ if (!options.git) { return _(null); } ; -/* 205 */ log.info("Executing `git init`"); -/* 206 */ return exec("git init", __cb(_, __frame, 11, 16, function __$initGitOnCurrentDirectory() { +/* 221 */ log.info("Executing `git init`"); +/* 222 */ return exec("git init", __cb(_, __frame, 11, 16, function __$initGitOnCurrentDirectory() { return (function __$initGitOnCurrentDirectory(__then) { -/* 208 */ if (!path.existsSync(".gitignore")) { -/* 209 */ log.info("Creating default .gitignore file"); -/* 210 */ return fs.writeFile(".gitignore", "node_modules", __cb(_, __frame, 15, 20, __then)); +/* 224 */ if (!path.existsSync(".gitignore")) { +/* 225 */ log.info("Creating default .gitignore file"); +/* 226 */ return fs.writeFile(".gitignore", "node_modules", __cb(_, __frame, 15, 20, __then, true)); } else { __then(); } ; })(function __$initGitOnCurrentDirectory() { -/* 213 */ context.flags.isGitWorkingTree = true; +/* 229 */ context.flags.isGitWorkingTree = true; _(); }); - })); + }, true)); }); }; -/* 216 */ function copyWebConfigWhenServerJsPresent(_) { +/* 232 */ function copyWebConfigWhenServerJsPresent(_) { var sourcePath; var __frame = { name: "copyWebConfigWhenServerJsPresent", - line: 216 + line: 232 }; return __func(_, this, arguments, copyWebConfigWhenServerJsPresent, 0, __frame, function __$copyWebConfigWhenServerJsPresent() { -/* 217 */ log.silly("copyWebConfigWhenServerJsPresent"); +/* 233 */ log.silly("copyWebConfigWhenServerJsPresent"); return (function __$copyWebConfigWhenServerJsPresent(__then) { -/* 218 */ if ((!path.existsSync("web.config") && path.existsSync("server.js"))) { -/* 219 */ log.info("Creating default web.config file"); -/* 220 */ sourcePath = path.join(__dirname, "../templates/node/web.config"); -/* 221 */ return fs.readFile(sourcePath, __cb(_, __frame, 5, 47, function ___(__0, __1) { -/* 221 */ return fs.writeFile("web.config", __1, __cb(_, __frame, 5, 20, __then)); - })); +/* 234 */ if ((!path.existsSync("web.config") && path.existsSync("server.js"))) { +/* 235 */ log.info("Creating default web.config file"); +/* 236 */ sourcePath = path.join(__dirname, "../templates/node/web.config"); +/* 237 */ return fs.readFile(sourcePath, __cb(_, __frame, 5, 47, function ___(__0, __1) { +/* 237 */ return fs.writeFile("web.config", __1, __cb(_, __frame, 5, 20, __then, true)); + }, true)); } else { __then(); @@ -283,21 +297,21 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= })(_); }); }; -/* 225 */ function updateLocalConfigWithSiteName(_) { +/* 241 */ function updateLocalConfigWithSiteName(_) { var cfg; var __frame = { name: "updateLocalConfigWithSiteName", - line: 225 + line: 241 }; return __func(_, this, arguments, updateLocalConfigWithSiteName, 0, __frame, function __$updateLocalConfigWithSiteName() { -/* 226 */ log.silly("updateLocalConfigWithSiteName"); +/* 242 */ log.silly("updateLocalConfigWithSiteName"); return (function __$updateLocalConfigWithSiteName(__then) { -/* 227 */ if (context.flags.isGitWorkingTree) { -/* 228 */ return site.readConfig(__cb(_, __frame, 3, 30, function ___(__0, __1) { +/* 243 */ if (context.flags.isGitWorkingTree) { +/* 244 */ return site.readConfig(__cb(_, __frame, 3, 30, function ___(__0, __1) { cfg = __1; -/* 229 */ cfg.name = context.site.name; -/* 230 */ return site.writeConfig(cfg, __cb(_, __frame, 5, 20, __then)); - })); +/* 245 */ cfg.name = context.site.name; +/* 246 */ return site.writeConfig(cfg, __cb(_, __frame, 5, 20, __then, true)); + }, true)); } else { __then(); @@ -306,16 +320,16 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= })(_); }); }; -/* 234 */ function createSiteAndInitializeRemoteRepo(_) { +/* 250 */ function createSiteAndInitializeRemoteRepo(_) { var __frame = { name: "createSiteAndInitializeRemoteRepo", - line: 234 + line: 250 }; return __func(_, this, arguments, createSiteAndInitializeRemoteRepo, 0, __frame, function __$createSiteAndInitializeRemoteRepo() { -/* 235 */ log.silly("createSiteAndInitializeRemoteRepo"); +/* 251 */ log.silly("createSiteAndInitializeRemoteRepo"); return (function __$createSiteAndInitializeRemoteRepo(__then) { -/* 236 */ if (!context.flags.siteExists) { -/* 237 */ return site.doSitesPost(context, __cb(_, __frame, 3, 20, __then)); +/* 252 */ if (!context.flags.siteExists) { +/* 253 */ return site.doSitesPost(context, __cb(_, __frame, 3, 20, __then, true)); } else { __then(); @@ -325,20 +339,20 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$createSiteAndInitializeRemoteRepo() { -/* 240 */ return site.doRepositoryGet(context, __cb(_, __frame, 6, 35, function ___(__0, __2) { -/* 240 */ context.repo = __2; +/* 256 */ return site.doRepositoryGet(context, __cb(_, __frame, 6, 35, function ___(__0, __2) { +/* 256 */ context.repo = __2; __then(); - })); + }, true)); }); })(function ___(err, __result) { __tryCatch(_, function __$createSiteAndInitializeRemoteRepo() { if (err) { -/* 243 */ return site.doRepositoryPost(context, __cb(_, __frame, 9, 20, function __$createSiteAndInitializeRemoteRepo() { -/* 244 */ return site.doRepositoryGet(context, __cb(_, __frame, 10, 35, function ___(__0, __1) { -/* 244 */ context.repo = __1; +/* 259 */ return site.doRepositoryPost(context, __cb(_, __frame, 9, 20, function __$createSiteAndInitializeRemoteRepo() { +/* 260 */ return site.doRepositoryGet(context, __cb(_, __frame, 10, 35, function ___(__0, __1) { +/* 260 */ context.repo = __1; __then(); - })); - })); + }, true)); + }, true)); } else { _(null, __result); @@ -348,67 +362,67 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= }); })(function ___() { __tryCatch(_, function __$createSiteAndInitializeRemoteRepo() { -/* 246 */ log.silly("context.repo", context.repo); +/* 262 */ log.silly("context.repo", context.repo); _(); }); }); }); }); }; -/* 249 */ function addRemoteToLocalGitRepo(_) { +/* 265 */ function addRemoteToLocalGitRepo(_) { var publishingUsers, publishingUser, repoUrl, remotes, azureExists; var __frame = { name: "addRemoteToLocalGitRepo", - line: 249 + line: 265 }; return __func(_, this, arguments, addRemoteToLocalGitRepo, 0, __frame, function __$addRemoteToLocalGitRepo() { -/* 250 */ log.silly("addRemoteToLocalGitRepo"); -/* 251 */ if (!context.flags.isGitWorkingTree) { +/* 266 */ log.silly("addRemoteToLocalGitRepo"); +/* 267 */ if (!context.flags.isGitWorkingTree) { return _(null); } ; -/* 254 */ return site.doPublishingUsersGet(context, __cb(_, __frame, 5, 38, function ___(__0, __1) { +/* 270 */ return site.doPublishingUsersGet(context, __cb(_, __frame, 5, 38, function ___(__0, __1) { publishingUsers = __1; -/* 255 */ publishingUser = toArray(publishingUsers)[0]; +/* 271 */ publishingUser = toArray(publishingUsers)[0]; return (function __$addRemoteToLocalGitRepo(__then) { -/* 256 */ if (((publishingUser === undefined) || (publishingUser.length > 64))) { -/* 257 */ log.help("You will also need to provide publishing username and credentials on the portal."); -/* 258 */ log.help("For now, please provide a username for git remote"); -/* 259 */ return prompt("Publishing username ", __cb(_, __frame, 10, 37, function ___(__0, __2) { -/* 259 */ publishingUser = __2; +/* 272 */ if (((publishingUser === undefined) || (publishingUser.length > 64))) { +/* 273 */ log.help("You will also need to provide publishing username and credentials on the portal."); +/* 274 */ log.help("For now, please provide a username for git remote"); +/* 275 */ return prompt("Publishing username ", __cb(_, __frame, 10, 37, function ___(__0, __2) { +/* 275 */ publishingUser = __2; __then(); - })); + }, true)); } else { __then(); } ; })(function __$addRemoteToLocalGitRepo() { -/* 262 */ repoUrl = url.parse(((context.repo + context.site.name) + ".git")); -/* 263 */ repoUrl.protocol = "http:"; -/* 264 */ repoUrl.auth = publishingUser; -/* 267 */ log.verbose("Detecting git and local git folder"); -/* 268 */ return exec("git remote", __cb(_, __frame, 19, 30, function ___(__0, __3) { +/* 278 */ repoUrl = url.parse(((context.repo + context.site.name) + ".git")); +/* 279 */ repoUrl.protocol = "http:"; +/* 280 */ repoUrl.auth = publishingUser; +/* 283 */ log.verbose("Detecting git and local git folder"); +/* 284 */ return exec("git remote", __cb(_, __frame, 19, 30, function ___(__0, __3) { remotes = __3; -/* 269 */ azureExists = ((remotes.stdout + remotes.stderr)).split("\n").some(function(item) { -/* 270 */ return (item === "azure"); +/* 285 */ azureExists = ((remotes.stdout + remotes.stderr)).split("\n").some(function(item) { +/* 286 */ return (item === "azure"); }); return (function __$addRemoteToLocalGitRepo(__then) { -/* 273 */ if (azureExists) { -/* 274 */ log.verbose("Removing existing azure remote alias"); -/* 275 */ return exec("git remote rm azure", __cb(_, __frame, 26, 20, __then)); +/* 289 */ if (azureExists) { +/* 290 */ log.verbose("Removing existing azure remote alias"); +/* 291 */ return exec("git remote rm azure", __cb(_, __frame, 26, 20, __then, true)); } else { __then(); } ; })(function __$addRemoteToLocalGitRepo() { -/* 278 */ log.info((("Executing `git remote add azure " + url.format(repoUrl)) + "`")); -/* 279 */ return exec(("git remote add azure " + url.format(repoUrl)), __cb(_, __frame, 30, 16, _)); +/* 294 */ log.info((("Executing `git remote add azure " + url.format(repoUrl)) + "`")); +/* 295 */ return exec(("git remote add azure " + url.format(repoUrl)), __cb(_, __frame, 30, 16, _, true)); }); - })); + }, true)); }); - })); + }, true)); }); }; var __frame = { @@ -434,292 +448,292 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= /* 121 */ return copyWebConfigWhenServerJsPresent(__cb(_, __frame, 17, 12, function __$__2() { /* 122 */ return updateLocalConfigWithSiteName(__cb(_, __frame, 18, 12, function __$__2() { /* 123 */ return createSiteAndInitializeRemoteRepo(__cb(_, __frame, 19, 12, function __$__2() { -/* 124 */ return addRemoteToLocalGitRepo(__cb(_, __frame, 20, 12, _)); - })); - })); - })); - })); - })); - })); - })); - })); +/* 124 */ return addRemoteToLocalGitRepo(__cb(_, __frame, 20, 12, _, true)); + }, true)); + }, true)); + }, true)); + }, true)); + }, true)); + }, true)); + }, true)); + }, true)); }); }); -/* 283 */ site.command("portal [name]").description("Opens the portal in a browser to manage your web sites").execute(function __3(name, options, _) { +/* 299 */ site.command("portal [name]").description("Opens the portal in a browser to manage your web sites").execute(function __3(name, options, _) { var href; var __frame = { name: "__3", - line: 285 + line: 301 }; return __func(_, this, arguments, __3, 2, __frame, function __$__3() { -/* 287 */ href = "https://windows.azure-test.net/"; -/* 288 */ if (name) { -/* 289 */ href = (((href + "#Workspaces/WebsiteExtension/Website/") + name) + "/dashboard"); +/* 303 */ href = "https://windows.azure-test.net/"; +/* 304 */ if (name) { +/* 305 */ href = (((href + "#Workspaces/WebsiteExtension/Website/") + name) + "/dashboard"); } ; -/* 292 */ common.launchBrowser(href); +/* 308 */ common.launchBrowser(href); _(); }); }); -/* 295 */ site.command("browse [name]").description("Open your web site in a browser.").option("-s, --subscription ", "use the subscription id").execute(function __4(name, options, _) { +/* 311 */ site.command("browse [name]").description("Open your web site in a browser.").option("-s, --subscription ", "use the subscription id").execute(function __4(name, options, _) { var context, siteData, href; var __frame = { name: "__4", - line: 298 + line: 314 }; return __func(_, this, arguments, __4, 2, __frame, function __$__4() { -/* 300 */ context = { -/* 301 */ subscription: cli.category("account").lookupSubscriptionId(options.subscription), -/* 302 */ site: { -/* 303 */ name: name +/* 316 */ context = { +/* 317 */ subscription: cli.category("account").lookupSubscriptionId(options.subscription), +/* 318 */ site: { +/* 319 */ name: name } }; -/* 306 */ return lookupSiteName(context, __cb(_, __frame, 8, 12, function __$__4() { -/* 307 */ return lookupSiteWebSpace(context, __cb(_, __frame, 9, 12, function __$__4() { -/* 308 */ return site.doSiteGet(context, __cb(_, __frame, 10, 33, function ___(__0, __1) { -/* 308 */ siteData = clean(__1); -/* 310 */ href = ("http://" + toArray(siteData.HostNames)[0]); -/* 312 */ common.launchBrowser(href); +/* 322 */ return lookupSiteName(context, __cb(_, __frame, 8, 12, function __$__4() { +/* 323 */ return lookupSiteWebSpace(context, __cb(_, __frame, 9, 12, function __$__4() { +/* 324 */ return site.doSiteGet(context, __cb(_, __frame, 10, 33, function ___(__0, __1) { +/* 324 */ siteData = clean(__1); +/* 326 */ href = ("http://" + toArray(siteData.HostNames)[0]); +/* 328 */ common.launchBrowser(href); _(); - })); - })); - })); + }, true)); + }, true)); + }, true)); }); }); -/* 315 */ site.command("show [name]").description("Show details for a web sites").option("-s, --subscription ", "use the subscription id").execute(function __5(name, options, _) { +/* 331 */ site.command("show [name]").description("Show details for a web sites").option("-s, --subscription ", "use the subscription id").execute(function __5(name, options, _) { var context, siteData, configData, repositoryData; var __frame = { name: "__5", - line: 318 + line: 334 }; return __func(_, this, arguments, __5, 2, __frame, function __$__5() { -/* 319 */ context = { -/* 320 */ subscription: cli.category("account").lookupSubscriptionId(options.subscription), -/* 321 */ site: { -/* 322 */ name: name +/* 335 */ context = { +/* 336 */ subscription: cli.category("account").lookupSubscriptionId(options.subscription), +/* 337 */ site: { +/* 338 */ name: name } }; -/* 326 */ return lookupSiteName(context, __cb(_, __frame, 8, 12, function __$__5() { -/* 327 */ return lookupSiteWebSpace(context, __cb(_, __frame, 9, 12, function __$__5() { -/* 329 */ log.info("Showing details for site"); -/* 330 */ log.verbose("Parameters", context); -/* 332 */ return site.doSiteGet(context, __cb(_, __frame, 14, 27, function ___(__0, __1) { +/* 342 */ return lookupSiteName(context, __cb(_, __frame, 8, 12, function __$__5() { +/* 343 */ return lookupSiteWebSpace(context, __cb(_, __frame, 9, 12, function __$__5() { +/* 345 */ log.info("Showing details for site"); +/* 346 */ log.verbose("Parameters", context); +/* 348 */ return site.doSiteGet(context, __cb(_, __frame, 14, 27, function ___(__0, __1) { siteData = __1; -/* 333 */ return site.doSiteConfigGet(context, __cb(_, __frame, 15, 29, function ___(__0, __2) { +/* 349 */ return site.doSiteConfigGet(context, __cb(_, __frame, 15, 29, function ___(__0, __2) { configData = __2; -/* 334 */ return site.doRepositoryGet(context, __cb(_, __frame, 16, 33, function ___(__0, __3) { +/* 350 */ return site.doRepositoryGet(context, __cb(_, __frame, 16, 33, function ___(__0, __3) { repositoryData = __3; -/* 336 */ logEachData("Site", siteData); -/* 337 */ logEachData("Config", configData); -/* 338 */ log.data("Repository", clean(repositoryData)); +/* 352 */ logEachData("Site", siteData); +/* 353 */ logEachData("Config", configData); +/* 354 */ log.data("Repository", clean(repositoryData)); _(); - })); - })); - })); - })); - })); + }, true)); + }, true)); + }, true)); + }, true)); + }, true)); }); }); -/* 341 */ function lookupSiteName(context, _) { +/* 357 */ function lookupSiteName(context, _) { var cfg; var __frame = { name: "lookupSiteName", - line: 341 + line: 357 }; return __func(_, this, arguments, lookupSiteName, 1, __frame, function __$lookupSiteName() { -/* 342 */ if ((context.site.name !== undefined)) { +/* 358 */ if ((context.site.name !== undefined)) { return _(null); } ; -/* 347 */ return site.readConfig(__cb(_, __frame, 6, 18, function ___(__0, __1) { +/* 363 */ return site.readConfig(__cb(_, __frame, 6, 18, function ___(__0, __1) { cfg = __1; -/* 348 */ if ((cfg !== undefined)) { -/* 350 */ context.site.name = cfg.name; +/* 364 */ if ((cfg !== undefined)) { +/* 366 */ context.site.name = cfg.name; return _(null); } ; -/* 354 */ return prompt("Web site name: ", __cb(_, __frame, 13, 28, function ___(__0, __2) { -/* 354 */ context.site.name = __2; +/* 370 */ return prompt("Web site name: ", __cb(_, __frame, 13, 28, function ___(__0, __2) { +/* 370 */ context.site.name = __2; _(); - })); - })); + }, true)); + }, true)); }); }; -/* 356 */ site.lookupSiteName = lookupSiteName; -/* 358 */ function lookupSiteWebSpace(context, _) { +/* 372 */ site.lookupSiteName = lookupSiteName; +/* 374 */ function lookupSiteWebSpace(context, _) { var sites, index; var __frame = { name: "lookupSiteWebSpace", - line: 358 + line: 374 }; return __func(_, this, arguments, lookupSiteWebSpace, 1, __frame, function __$lookupSiteWebSpace() { -/* 359 */ log.verbose("Attempting to locate site ", context.site.name); -/* 360 */ return site.doSitesGet(context, __cb(_, __frame, 2, 20, function ___(__0, __1) { +/* 375 */ log.verbose("Attempting to locate site ", context.site.name); +/* 376 */ return site.doSitesGet(context, __cb(_, __frame, 2, 20, function ___(__0, __1) { sites = __1; -/* 361 */ for (index in sites) { -/* 362 */ if ((sites[index].Name === context.site.name)) { -/* 363 */ log.verbose("Site located at ", sites[index].WebSpace); -/* 364 */ context.site.webspace = sites[index].WebSpace; +/* 377 */ for (index in sites) { +/* 378 */ if ((sites[index].Name === context.site.name)) { +/* 379 */ log.verbose("Site located at ", sites[index].WebSpace); +/* 380 */ context.site.webspace = sites[index].WebSpace; } ; }; -/* 367 */ if ((context.site.webspace === undefined)) { -/* 368 */ return _(new Error(("Unable to locate site named " + context.site.name))); +/* 383 */ if ((context.site.webspace === undefined)) { +/* 384 */ return _(new Error(("Unable to locate site named " + context.site.name))); } ; _(); - })); + }, true)); }); }; -/* 371 */ site.lookupSiteWebSpace = lookupSiteWebSpace; -/* 373 */ site.command("delete [name]").description("Delete a web site").option("-s, --subscription ", "use the subscription id").execute(function __6(name, options, _) { +/* 387 */ site.lookupSiteWebSpace = lookupSiteWebSpace; +/* 389 */ site.command("delete [name]").description("Delete a web site").option("-s, --subscription ", "use the subscription id").execute(function __6(name, options, _) { var context, result; var __frame = { name: "__6", - line: 376 + line: 392 }; return __func(_, this, arguments, __6, 2, __frame, function __$__6() { -/* 377 */ context = { -/* 378 */ subscription: cli.category("account").lookupSubscriptionId(options.subscription), -/* 379 */ site: { -/* 380 */ name: name +/* 393 */ context = { +/* 394 */ subscription: cli.category("account").lookupSubscriptionId(options.subscription), +/* 395 */ site: { +/* 396 */ name: name } }; -/* 384 */ return lookupSiteName(context, __cb(_, __frame, 8, 12, function __$__6() { -/* 385 */ return lookupSiteWebSpace(context, __cb(_, __frame, 9, 12, function __$__6() { -/* 387 */ log.info("Deleting site", context.site.name); -/* 395 */ return getChannel().path(context.subscription).path("services/webspaces").path(context.site.webspace).path("sites").path(context.site.name).DELETE(__cb(_, __frame, 19, 25, function ___(__0, __1) { +/* 400 */ return lookupSiteName(context, __cb(_, __frame, 8, 12, function __$__6() { +/* 401 */ return lookupSiteWebSpace(context, __cb(_, __frame, 9, 12, function __$__6() { +/* 403 */ log.info("Deleting site", context.site.name); +/* 411 */ return getChannel().path(context.subscription).path("services/webspaces").path(context.site.webspace).path("sites").path(context.site.name).DELETE(__cb(_, __frame, 19, 25, function ___(__0, __1) { result = __1; -/* 397 */ log.info((("Site " + context.site.name) + " has been deleted")); +/* 413 */ log.info((("Site " + context.site.name) + " has been deleted")); _(); - })); - })); - })); + }, true)); + }, true)); + }, true)); }); }); -/* 401 */ site.command("start [name]").description("Start a web site").option("-s, --subscription ", "use the subscription id").execute(function __7(name, options, _) { +/* 417 */ site.command("start [name]").description("Start a web site").option("-s, --subscription ", "use the subscription id").execute(function __7(name, options, _) { var context, result; var __frame = { name: "__7", - line: 404 + line: 420 }; return __func(_, this, arguments, __7, 2, __frame, function __$__7() { -/* 405 */ context = { -/* 406 */ subscription: cli.category("account").lookupSubscriptionId(options.subscription), -/* 407 */ site: { -/* 408 */ name: name +/* 421 */ context = { +/* 422 */ subscription: cli.category("account").lookupSubscriptionId(options.subscription), +/* 423 */ site: { +/* 424 */ name: name } }; -/* 412 */ return lookupSiteName(context, __cb(_, __frame, 8, 12, function __$__7() { -/* 413 */ return lookupSiteWebSpace(context, __cb(_, __frame, 9, 12, function __$__7() { -/* 415 */ log.info("Starting site", context.site.name); -/* 424 */ return getChannel().path(context.subscription).path("services/webspaces").path(context.site.webspace).path("sites").path(context.site.name).header("Content-Type", "application/xml").PUT(function(req) { -/* 425 */ req.write(""); -/* 426 */ req.write(""); -/* 427 */ req.write(""); -/* 428 */ req.write((context.site.name + ".antdf0.antares-test.windows-int.net")); -/* 429 */ req.write(""); -/* 430 */ req.write(""); -/* 431 */ req.write(""); -/* 432 */ req.write(context.site.name); -/* 433 */ req.write(""); -/* 434 */ req.write(""); -/* 435 */ req.write("Running"); -/* 436 */ req.write(""); -/* 437 */ req.write(""); -/* 439 */ req.end(); +/* 428 */ return lookupSiteName(context, __cb(_, __frame, 8, 12, function __$__7() { +/* 429 */ return lookupSiteWebSpace(context, __cb(_, __frame, 9, 12, function __$__7() { +/* 431 */ log.info("Starting site", context.site.name); +/* 440 */ return getChannel().path(context.subscription).path("services/webspaces").path(context.site.webspace).path("sites").path(context.site.name).header("Content-Type", "application/xml").PUT(function(req) { +/* 441 */ req.write(""); +/* 442 */ req.write(""); +/* 443 */ req.write(""); +/* 444 */ req.write((context.site.name + ".antdf0.antares-test.windows-int.net")); +/* 445 */ req.write(""); +/* 446 */ req.write(""); +/* 447 */ req.write(""); +/* 448 */ req.write(context.site.name); +/* 449 */ req.write(""); +/* 450 */ req.write(""); +/* 451 */ req.write("Running"); +/* 452 */ req.write(""); +/* 453 */ req.write(""); +/* 455 */ req.end(); }, __cb(_, __frame, 20, 25, function ___(__0, __1) { result = __1; -/* 442 */ log.info((("Site " + context.site.name) + " has been started")); +/* 458 */ log.info((("Site " + context.site.name) + " has been started")); _(); - })); - })); - })); + }, true)); + }, true)); + }, true)); }); }); -/* 445 */ site.command("stop [name]").description("Stop a web site").option("-s, --subscription ", "use the subscription id").execute(function __8(name, options, _) { +/* 461 */ site.command("stop [name]").description("Stop a web site").option("-s, --subscription ", "use the subscription id").execute(function __8(name, options, _) { var context, result; var __frame = { name: "__8", - line: 448 + line: 464 }; return __func(_, this, arguments, __8, 2, __frame, function __$__8() { -/* 449 */ context = { -/* 450 */ subscription: cli.category("account").lookupSubscriptionId(options.subscription), -/* 451 */ site: { -/* 452 */ name: name +/* 465 */ context = { +/* 466 */ subscription: cli.category("account").lookupSubscriptionId(options.subscription), +/* 467 */ site: { +/* 468 */ name: name } }; -/* 456 */ return lookupSiteName(context, __cb(_, __frame, 8, 12, function __$__8() { -/* 457 */ return lookupSiteWebSpace(context, __cb(_, __frame, 9, 12, function __$__8() { -/* 459 */ log.info("Stopping site", context.site.name); -/* 468 */ return getChannel().path(context.subscription).path("services/webspaces").path(context.site.webspace).path("sites").path(context.site.name).header("Content-Type", "application/xml").PUT(function(req) { -/* 469 */ req.write(""); -/* 470 */ req.write(""); -/* 471 */ req.write(""); -/* 472 */ req.write((context.site.name + ".antdf0.antares-test.windows-int.net")); -/* 473 */ req.write(""); -/* 474 */ req.write(""); -/* 475 */ req.write(""); -/* 476 */ req.write(context.site.name); -/* 477 */ req.write(""); -/* 478 */ req.write(""); -/* 479 */ req.write("Stopped"); -/* 480 */ req.write(""); -/* 481 */ req.write(""); -/* 483 */ req.end(); +/* 472 */ return lookupSiteName(context, __cb(_, __frame, 8, 12, function __$__8() { +/* 473 */ return lookupSiteWebSpace(context, __cb(_, __frame, 9, 12, function __$__8() { +/* 475 */ log.info("Stopping site", context.site.name); +/* 484 */ return getChannel().path(context.subscription).path("services/webspaces").path(context.site.webspace).path("sites").path(context.site.name).header("Content-Type", "application/xml").PUT(function(req) { +/* 485 */ req.write(""); +/* 486 */ req.write(""); +/* 487 */ req.write(""); +/* 488 */ req.write((context.site.name + ".antdf0.antares-test.windows-int.net")); +/* 489 */ req.write(""); +/* 490 */ req.write(""); +/* 491 */ req.write(""); +/* 492 */ req.write(context.site.name); +/* 493 */ req.write(""); +/* 494 */ req.write(""); +/* 495 */ req.write("Stopped"); +/* 496 */ req.write(""); +/* 497 */ req.write(""); +/* 499 */ req.end(); }, __cb(_, __frame, 20, 25, function ___(__0, __1) { result = __1; -/* 486 */ log.info((("Site " + context.site.name) + " has been stopped")); +/* 502 */ log.info((("Site " + context.site.name) + " has been stopped")); _(); - })); - })); - })); + }, true)); + }, true)); + }, true)); }); }); -/* 493 */ site.readConfig = function site_readConfig__9(_) { +/* 509 */ site.readConfig = function site_readConfig__9(_) { var __frame = { name: "site_readConfig__9", - line: 493 + line: 509 }; return __func(_, this, arguments, site_readConfig__9, 0, __frame, function __$site_readConfig__9() { -/* 495 */ return site.readConfigValue("azure.site.name", __cb(_, __frame, 2, 18, function ___(__0, __2) { -/* 494 */ var __1 = { -/* 495 */ name: __2 +/* 511 */ return site.readConfigValue("azure.site.name", __cb(_, __frame, 2, 18, function ___(__0, __2) { +/* 510 */ var __1 = { +/* 511 */ name: __2 }; return _(null, __1); - })); + }, true)); }); }; -/* 499 */ site.writeConfig = function site_writeConfig__10(cfg, _) { +/* 515 */ site.writeConfig = function site_writeConfig__10(cfg, _) { var __frame = { name: "site_writeConfig__10", - line: 499 + line: 515 }; return __func(_, this, arguments, site_writeConfig__10, 1, __frame, function __$site_writeConfig__10() { -/* 500 */ return site.writeConfigValue("azure.site.name", cfg.name, __cb(_, __frame, 1, 8, _)); +/* 516 */ return site.writeConfigValue("azure.site.name", cfg.name, __cb(_, __frame, 1, 8, _, true)); }); }; -/* 503 */ site.readConfigValue = function site_readConfigValue__11(name, _) { +/* 519 */ site.readConfigValue = function site_readConfigValue__11(name, _) { var result; var __frame = { name: "site_readConfigValue__11", - line: 503 + line: 519 }; return __func(_, this, arguments, site_readConfigValue__11, 1, __frame, function __$site_readConfigValue__11() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$site_readConfigValue__11() { -/* 505 */ return exec(("git config --get " + name), __cb(_, __frame, 2, 25, function ___(__0, __1) { +/* 521 */ return exec(("git config --get " + name), __cb(_, __frame, 2, 25, function ___(__0, __1) { result = __1; -/* 506 */ return _(null, ((result.stdout + result.stderr)).trim()); - })); +/* 522 */ return _(null, ((result.stdout + result.stderr)).trim()); + }, true)); }); })(function ___(err, __result) { __tryCatch(_, function __$site_readConfigValue__11() { if (err) { -/* 509 */ log.silly("Unable to read config", err); -/* 510 */ return _(null, ""); +/* 525 */ log.silly("Unable to read config", err); +/* 526 */ return _(null, ""); } else { _(null, __result); @@ -732,224 +746,224 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= }); }); }; -/* 514 */ site.writeConfigValue = function site_writeConfigValue__12(name, value, _) { +/* 530 */ site.writeConfigValue = function site_writeConfigValue__12(name, value, _) { var __frame = { name: "site_writeConfigValue__12", - line: 514 + line: 530 }; return __func(_, this, arguments, site_writeConfigValue__12, 2, __frame, function __$site_writeConfigValue__12() { -/* 515 */ return exec(((("git config " + name) + " ") + value), __cb(_, __frame, 1, 8, _)); +/* 531 */ return exec(((("git config " + name) + " ") + value), __cb(_, __frame, 1, 8, _, true)); }); }; -/* 522 */ site.doSitesPost = function(options, callback) { -/* 523 */ log.info("Creating a new web site"); -/* 524 */ log.verbose("Subscription", options.subscription); -/* 525 */ log.verbose("Webspace", options.site.webspace); -/* 526 */ log.verbose("Site", options.site.name); -/* 528 */ getChannel().path(options.subscription).path("services/webspaces").path(options.site.webspace).path("sites/").header("Content-Type", "application/xml").POST(writers.Site.xml(options.site), function(err, result) { -/* 537 */ if (err) { -/* 538 */ logError("Failed to create site", err); +/* 538 */ site.doSitesPost = function(options, callback) { +/* 539 */ log.info("Creating a new web site"); +/* 540 */ log.verbose("Subscription", options.subscription); +/* 541 */ log.verbose("Webspace", options.site.webspace); +/* 542 */ log.verbose("Site", options.site.name); +/* 544 */ getChannel().path(options.subscription).path("services/webspaces").path(options.site.webspace).path("sites/").header("Content-Type", "application/xml").POST(writers.Site.xml(options.site), function(err, result) { +/* 553 */ if (err) { +/* 554 */ logError("Failed to create site", err); } -/* 539 */ else { -/* 540 */ log.info("Created website at ", clean(result).HostNames); -/* 541 */ log.verbose("Site", clean(result)); +/* 555 */ else { +/* 556 */ log.info("Created website at ", clean(result).HostNames); +/* 557 */ log.verbose("Site", clean(result)); } ; -/* 543 */ callback(err, result); +/* 559 */ callback(err, result); }); }; -/* 547 */ site.doRepositoryPost = function(options, callback) { -/* 548 */ log.info("Initializing repository"); -/* 549 */ log.verbose("Subscription", options.subscription); -/* 550 */ log.verbose("Webspace", options.site.webspace); -/* 551 */ log.verbose("Site", options.site.name); -/* 553 */ getChannel().path(options.subscription).path("services/webspaces").path(options.site.webspace).path("sites").path(options.site.name).path("repository").POST("", function(err, result) { -/* 563 */ if (err) { -/* 564 */ logError("Failed to initialize repository", err); +/* 563 */ site.doRepositoryPost = function(options, callback) { +/* 564 */ log.info("Initializing repository"); +/* 565 */ log.verbose("Subscription", options.subscription); +/* 566 */ log.verbose("Webspace", options.site.webspace); +/* 567 */ log.verbose("Site", options.site.name); +/* 569 */ getChannel().path(options.subscription).path("services/webspaces").path(options.site.webspace).path("sites").path(options.site.name).path("repository").POST("", function(err, result) { +/* 579 */ if (err) { +/* 580 */ logError("Failed to initialize repository", err); } -/* 565 */ else { -/* 566 */ log.info("Repository initialized"); +/* 581 */ else { +/* 582 */ log.info("Repository initialized"); } ; -/* 568 */ callback(err, result); +/* 584 */ callback(err, result); }); }; -/* 572 */ site.doSpacesGet = function site_doSpacesGet__13(options, _) { +/* 588 */ site.doSpacesGet = function site_doSpacesGet__13(options, _) { var result; var __frame = { name: "site_doSpacesGet__13", - line: 572 + line: 588 }; return __func(_, this, arguments, site_doSpacesGet__13, 1, __frame, function __$site_doSpacesGet__13() { -/* 573 */ log.verbose("Subscription", options.subscription); -/* 578 */ return getChannel().path(options.subscription).path("services/webspaces/").GET(__cb(_, __frame, 6, 21, function ___(__0, __1) { +/* 589 */ log.verbose("Subscription", options.subscription); +/* 594 */ return getChannel().path(options.subscription).path("services/webspaces/").GET(__cb(_, __frame, 6, 21, function ___(__0, __1) { result = __1; -/* 580 */ log.json("silly", result); -/* 581 */ return _(null, toArray(result.WebSpace)); - })); +/* 596 */ log.json("silly", result); +/* 597 */ return _(null, toArray(result.WebSpace)); + }, true)); }); }; -/* 584 */ site.doSitesGet = function site_doSitesGet__14(options, _) { +/* 600 */ site.doSitesGet = function site_doSitesGet__14(options, _) { var spaces, channel, result, sites; var __frame = { name: "site_doSitesGet__14", - line: 584 + line: 600 }; return __func(_, this, arguments, site_doSitesGet__14, 1, __frame, function __$site_doSitesGet__14() { -/* 585 */ log.verbose("Subscription", options.subscription); -/* 587 */ return site.doSpacesGet(options, __cb(_, __frame, 3, 21, function ___(__0, __2) { +/* 601 */ log.verbose("Subscription", options.subscription); +/* 603 */ return site.doSpacesGet(options, __cb(_, __frame, 3, 21, function ___(__0, __2) { spaces = __2; -/* 591 */ channel = getChannel().path(options.subscription).path("services/webspaces"); -/* 593 */ return async.map(spaces, function __1(webspace, _) { +/* 607 */ channel = getChannel().path(options.subscription).path("services/webspaces"); +/* 609 */ return async.map(spaces, function __1(webspace, _) { var __frame = { name: "__1", - line: 595 + line: 611 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() { -/* 599 */ return channel.path(webspace.Name).path("sites/").GET(__cb(_, __frame, 4, 23, _)); +/* 615 */ return channel.path(webspace.Name).path("sites/").GET(__cb(_, __frame, 4, 23, _, true)); }); }, __cb(_, __frame, 9, 21, function ___(__0, __3) { result = __3; -/* 603 */ sites = []; -/* 604 */ result.forEach(function(item) { -/* 605 */ sites = sites.concat(toArray(item.Site)); +/* 619 */ sites = []; +/* 620 */ result.forEach(function(item) { +/* 621 */ sites = sites.concat(toArray(item.Site)); }); -/* 607 */ result = sites; -/* 609 */ log.json("verbose", sites); -/* 610 */ return _(null, sites); - })); - })); +/* 623 */ result = sites; +/* 625 */ log.json("verbose", sites); +/* 626 */ return _(null, sites); + }, true)); + }, true)); }); }; -/* 613 */ site.doSiteGet = function(options, callback) { -/* 614 */ getChannel().path(options.subscription).path("services/webspaces").path(options.site.webspace).path("sites").path(options.site.name).GET(function(err, result) { -/* 622 */ if (err) { -/* 623 */ logError("Failed to get site info", err); +/* 629 */ site.doSiteGet = function(options, callback) { +/* 630 */ getChannel().path(options.subscription).path("services/webspaces").path(options.site.webspace).path("sites").path(options.site.name).GET(function(err, result) { +/* 638 */ if (err) { +/* 639 */ logError("Failed to get site info", err); } -/* 624 */ else { -/* 625 */ log.verbose("Site", clean(result)); +/* 640 */ else { +/* 641 */ log.verbose("Site", clean(result)); } ; -/* 627 */ callback(err, result); +/* 643 */ callback(err, result); }); }; -/* 631 */ site.doSiteConfigGet = function(options, callback) { -/* 632 */ getChannel().path(options.subscription).path("services/webspaces").path(options.site.webspace).path("sites").path(options.site.name).path("config").GET(function(err, result) { -/* 641 */ if (err) { -/* 642 */ logError("Failed to get site config info", err); +/* 647 */ site.doSiteConfigGet = function(options, callback) { +/* 648 */ getChannel().path(options.subscription).path("services/webspaces").path(options.site.webspace).path("sites").path(options.site.name).path("config").GET(function(err, result) { +/* 657 */ if (err) { +/* 658 */ logError("Failed to get site config info", err); } -/* 643 */ else { -/* 644 */ log.verbose("SiteConfig", clean(result)); +/* 659 */ else { +/* 660 */ log.verbose("SiteConfig", clean(result)); } ; -/* 646 */ callback(err, result); +/* 662 */ callback(err, result); }); }; -/* 650 */ site.doRepositoryGet = function(options, callback) { -/* 651 */ getChannel().path(options.subscription).path("services/webspaces").path(options.site.webspace).path("sites").path(options.site.name).path("repository").GET(function(err, result) { -/* 660 */ if (result) { -/* 661 */ log.verbose("Repository", clean(result)); +/* 666 */ site.doRepositoryGet = function(options, callback) { +/* 667 */ getChannel().path(options.subscription).path("services/webspaces").path(options.site.webspace).path("sites").path(options.site.name).path("repository").GET(function(err, result) { +/* 676 */ if (result) { +/* 677 */ log.verbose("Repository", clean(result)); } ; -/* 663 */ callback(err, clean(result)); +/* 679 */ callback(err, clean(result)); }); }; -/* 667 */ site.doPublishingUsersGet = function site_doPublishingUsersGet__15(options, _) { +/* 683 */ site.doPublishingUsersGet = function site_doPublishingUsersGet__15(options, _) { var publishingUsers; var __frame = { name: "site_doPublishingUsersGet__15", - line: 667 + line: 683 }; return __func(_, this, arguments, site_doPublishingUsersGet__15, 1, __frame, function __$site_doPublishingUsersGet__15() { -/* 672 */ return getChannel().path(options.subscription).path("services/webspaces/").query("properties", "publishingUsers").GET(__cb(_, __frame, 5, 36, function ___(__0, __1) { -/* 668 */ publishingUsers = clean(__1); -/* 674 */ log.verbose("PublishingUsers", publishingUsers); -/* 675 */ return _(null, publishingUsers); - })); +/* 688 */ return getChannel().path(options.subscription).path("services/webspaces/").query("properties", "publishingUsers").GET(__cb(_, __frame, 5, 36, function ___(__0, __1) { +/* 684 */ publishingUsers = clean(__1); +/* 690 */ log.verbose("PublishingUsers", publishingUsers); +/* 691 */ return _(null, publishingUsers); + }, true)); }); }; -/* 682 */ var writers = { -/* 683 */ Site: { -/* 684 */ xml: function(site) { -/* 685 */ return function(req) { -/* 686 */ req.write(""); -/* 687 */ req.write(""); -/* 688 */ req.write(""); -/* 689 */ req.write((site.name + ".antdf0.antares-test.windows-int.net")); -/* 690 */ req.write(""); -/* 692 */ if (site.hostname) { -/* 693 */ req.write(""); -/* 694 */ req.write(site.hostname); -/* 695 */ req.write(""); +/* 698 */ var writers = { +/* 699 */ Site: { +/* 700 */ xml: function(site) { +/* 701 */ return function(req) { +/* 702 */ req.write(""); +/* 703 */ req.write(""); +/* 704 */ req.write(""); +/* 705 */ req.write((site.name + ".antdf0.antares-test.windows-int.net")); +/* 706 */ req.write(""); +/* 708 */ if (site.hostname) { +/* 709 */ req.write(""); +/* 710 */ req.write(site.hostname); +/* 711 */ req.write(""); } ; -/* 697 */ req.write(""); -/* 698 */ req.write(""); -/* 699 */ req.write(site.name); -/* 700 */ req.write(""); -/* 701 */ req.write(""); -/* 703 */ req.end(); +/* 713 */ req.write(""); +/* 714 */ req.write(""); +/* 715 */ req.write(site.name); +/* 716 */ req.write(""); +/* 717 */ req.write(""); +/* 719 */ req.end(); }; } } }; -/* 709 */ function clean(source) { -/* 710 */ if ((typeof (source) === "string")) { -/* 711 */ return source; +/* 725 */ function clean(source) { +/* 726 */ if ((typeof (source) === "string")) { +/* 727 */ return source; } ; -/* 714 */ var target = { +/* 730 */ var target = { }; -/* 715 */ var hasString = false; -/* 716 */ var hasNonString = false; -/* 717 */ var stringValue = ""; -/* 719 */ for (var prop in source) { -/* 720 */ if ((prop == "@")) { -/* 721 */ continue; +/* 731 */ var hasString = false; +/* 732 */ var hasNonString = false; +/* 733 */ var stringValue = ""; +/* 735 */ for (var prop in source) { +/* 736 */ if ((prop == "@")) { +/* 737 */ continue; } -/* 722 */ else { -/* 723 */ if ((((prop === "#") || (prop === "string")) || (prop.substring((prop.length - 7)) === ":string"))) { -/* 724 */ hasString = true; -/* 725 */ stringValue = source[prop]; +/* 738 */ else { +/* 739 */ if ((((prop === "#") || (prop === "string")) || (prop.substring((prop.length - 7)) === ":string"))) { +/* 740 */ hasString = true; +/* 741 */ stringValue = source[prop]; } -/* 726 */ else { -/* 727 */ hasNonString = true; +/* 742 */ else { +/* 743 */ hasNonString = true; } ; -/* 729 */ target[prop] = clean(source[prop]); +/* 745 */ target[prop] = clean(source[prop]); } ; }; -/* 732 */ if ((hasString && !hasNonString)) { -/* 733 */ return stringValue; +/* 748 */ if ((hasString && !hasNonString)) { +/* 749 */ return stringValue; } ; -/* 735 */ return target; +/* 751 */ return target; }; -/* 738 */ function logEachData(title, data) { -/* 739 */ var cleaned = clean(data); -/* 740 */ for (var property in cleaned) { -/* 741 */ log.data(((title + " ") + property), cleaned[property]); +/* 754 */ function logEachData(title, data) { +/* 755 */ var cleaned = clean(data); +/* 756 */ for (var property in cleaned) { +/* 757 */ log.data(((title + " ") + property), cleaned[property]); }; }; -/* 745 */ function logError(message, err) { -/* 746 */ if ((arguments.length == 1)) { -/* 747 */ err = message; -/* 748 */ message = undefined; +/* 761 */ function logError(message, err) { +/* 762 */ if ((arguments.length == 1)) { +/* 763 */ err = message; +/* 764 */ message = undefined; } -/* 749 */ else { -/* 750 */ log.error(message); +/* 765 */ else { +/* 766 */ log.error(message); } ; -/* 753 */ if (err) { -/* 754 */ if (err.message) { -/* 756 */ log.verbose("stack", err.stack); -/* 757 */ log.json("silly", err); +/* 769 */ if (err) { +/* 770 */ if (err.message) { +/* 772 */ log.verbose("stack", err.stack); +/* 773 */ log.json("silly", err); } -/* 759 */ else if (err.Message) { -/* 761 */ log.json("verbose", clean(err)); +/* 775 */ else if (err.Message) { +/* 777 */ log.json("verbose", clean(err)); } -/* 763 */ else { +/* 779 */ else { } @@ -957,20 +971,20 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= } ; }; -/* 769 */ function isArray(testObject) { -/* 770 */ return (((testObject && !(testObject.propertyIsEnumerable("length"))) && (typeof testObject === "object")) && (typeof testObject.length === "number")); +/* 785 */ function isArray(testObject) { +/* 786 */ return (((testObject && !(testObject.propertyIsEnumerable("length"))) && (typeof testObject === "object")) && (typeof testObject.length === "number")); }; -/* 773 */ function toArray(testObject) { -/* 774 */ return (isArray(testObject) ? testObject : ((typeof testObject === "undefined") ? [] : [testObject,])); +/* 789 */ function toArray(testObject) { +/* 790 */ return (isArray(testObject) ? testObject : ((typeof testObject === "undefined") ? [] : [testObject,])); }; -/* 777 */ function endsWith(str, suffix) { -/* 778 */ return (str.indexOf(suffix, (str.length - suffix.length)) !== -1); +/* 793 */ function endsWith(str, suffix) { +/* 794 */ return (str.indexOf(suffix, (str.length - suffix.length)) !== -1); }; -/* 781 */ function exec(cmd, cb) { -/* 782 */ child_process.exec(cmd, function(err, stdout, stderr) { -/* 783 */ cb(err, { -/* 784 */ stdout: stdout, -/* 785 */ stderr: stderr +/* 797 */ function exec(cmd, cb) { +/* 798 */ child_process.exec(cmd, function(err, stdout, stderr) { +/* 799 */ cb(err, { +/* 800 */ stdout: stdout, +/* 801 */ stderr: stderr }); }); }; diff --git a/lib/cli/commands/site_.js b/lib/cli/commands/site_.js index 8577694bc..b410eea79 100644 --- a/lib/cli/commands/site_.js +++ b/lib/cli/commands/site_.js @@ -151,8 +151,24 @@ exports.init = function (cli) { function promptForLocation(_) { log.silly('promptForLocation'); + var spaces = site.doSpacesGet(context, _); + if (context.site.webspace !== undefined) { + // Map user-provided value to GeoRegion display name, if unique match exists + var displayNameMatches = spaces.filter(function(space) { + return space.GeoRegion === context.site.webspace; + }); + if (displayNameMatches.length === 1) { + context.site.webspace = displayNameMatches[0].Name; + } + } + + if (context.site.webspace !== undefined) { + // Don't prompt if location has been inferred or provided + return; + } + if (spaces.length === 0) { log.help('You must create your first web site using the Windows Azure portal.'); log.help('Please follow these steps in the portal:');