Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'upstream/dev' into connectionStrings

  • Loading branch information...
commit 82f9c184b1b474af99fef3fe1bf3e87ae26cdb13 2 parents 125864d + a6830e1
@andrerod andrerod authored
View
5 lib/cli/commands/account.js
@@ -39,9 +39,10 @@ exports.init = function (cli) {
account.command('download')
.whiteListPowershell()
.description('Launch a browser to download your publishsettings file')
+ .option('-r, --realm <realm>', 'Specify organization used for login')
.execute(function (options, callback) {
try {
- var url = utils.getPublishingProfileUrl();
+ var url = utils.getPublishingProfileUrl(options.realm);
common.launchBrowser(url);
log.help('Save the downloaded file, then execute the command');
log.help(' account import <file>');
@@ -203,7 +204,7 @@ exports.init = function (cli) {
log.info('Setting default subscription to:', subs[0]['@'].Name);
log.info('Use "azure account set" to change to a different one.')
var config = account.readConfig();
- config.subscription = subs[0]['@'].Id;
+ config.subscription = subs[0]['@'].Name;
account.writeConfig(config);
}
log.warn('The \'' + file + '\' file contains sensitive information.');
View
123 lib/cli/commands/repository.js
@@ -0,0 +1,123 @@
+/*** Generated by streamline 0.4.5 (callbacks) - DO NOT EDIT ***/ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func=__rt.__func,__cb=__rt.__cb,__tryCatch=__rt.__tryCatch; var common = require("../common");
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+var fs = require("fs");
+var path = require("path");
+var url = require("url");
+var crypto = require("crypto");
+var pfx2pem = require("../../util/certificates/pkcs").pfx2pem;
+var Channel = require("../channel");
+var async = require("async");
+var child_process = require("child_process");
+var utils = require("../utils");
+var constants = require("../constants");
+var cacheUtils = require("../cacheUtils");
+
+exports.init = function(cli) {
+
+ var log = cli.output;
+ var site = cli.category("site");
+ var scm = site.category("deployment");
+ var repository = site.category("repository").description("Commands to manage your git repository");
+
+
+ repository.command("branch <branch> [name]>").whiteListPowershell().usage("<branch> [name] [options]").description("set your repository branch").option("-s, --subscription <id>", "use the subscription id").execute(function __1(branch, name, options, _) { var context, repositoryUri; var __frame = { name: "__1", line: 42 }; return __func(_, this, arguments, __1, 3, __frame, function __$__1() {
+
+
+
+
+
+ context = {
+ subscription: cli.category("account").lookupSubscriptionId(options.subscription),
+ settingKey: "branch",
+ settingValue: branch,
+ site: { name: name } };
+
+
+ return scm.ensureRepositoryUri(context, __cb(_, __frame, 8, 26, function ___(__0, __1) { repositoryUri = __1; return (function __$__1(__then) {
+ if (repositoryUri) {
+ return doSettingsSet(context, __cb(_, __frame, 10, 8, __then, true)); } else {
+
+ log.error("Repository is not setup"); __then(); } ; })(_); }, true)); }); });
+
+
+
+ repository.command("delete [name]").whiteListPowershell().usage("[name] [options]").description("Delete your repository").option("-s, --subscription <id>", "use the subscription id").option("-q, --quiet", "quiet mode, do not ask for delete confirmation").execute(function __2(name, options, _) { var context, repositoryUri; var __frame = { name: "__2", line: 64 }; return __func(_, this, arguments, __2, 2, __frame, function __$__2() {
+
+
+
+
+
+
+ context = {
+ subscription: cli.category("account").lookupSubscriptionId(options.subscription),
+ site: { name: name } };
+
+
+ return scm.ensureRepositoryUri(context, __cb(_, __frame, 6, 26, function ___(__0, __2) { repositoryUri = __2; return (function __$__2(__then) {
+ if (repositoryUri) { return (function __$__2(_) {
+ var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return site.confirm("Delete repository? (y/n) ", __cb(_, __frame, 8, 31, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -63, 17, function ___(__0, __3) { return (function __$__2(__then) { if (__3) { return _(null); } else { __then(); } ; })(function __$__2() {
+
+
+
+ return doDeleteRepository(context, __cb(_, __frame, 12, 8, function __$__2() {
+ return site.doRepositoryDelete(context, __cb(_, __frame, 13, 8, __then, true)); }, true)); }); }, true)); } else {
+
+ log.error("Repository is not setup"); __then(); } ; })(_); }, true)); }); });
+
+
+
+ function doSettingsGet(context, _) { var channel, progress; var __frame = { name: "doSettingsGet", line: 83 }; return __func(_, this, arguments, doSettingsGet, 1, __frame, function __$doSettingsGet() {
+
+ channel = scm.getScmChannel(context).path("settings");
+ if ((context.settingKey !== undefined)) {
+ channel.path(context.settingKey); } ;
+
+
+ progress = cli.progress((("Retrieving repository " + ((context.settingKey ? ((context.settingKey + " ")) : ""))) + "settings")); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$doSettingsGet() {
+
+ return channel.GET(__cb(_, __frame, 9, 13, _, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$doSettingsGet() {
+
+ progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, _); }); }); };
+
+
+ repository.doSettingsGet = doSettingsGet;
+
+ function doSettingsSet(context, _) { var channel, data, progress; var __frame = { name: "doSettingsSet", line: 99 }; return __func(_, this, arguments, doSettingsSet, 1, __frame, function __$doSettingsSet() {
+
+ channel = scm.getScmChannel(context).path("settings");
+ data = {
+ key: context.settingKey,
+ value: context.settingValue };
+
+
+ progress = cli.progress(((("Setting " + context.settingKey) + " to ") + context.settingValue)); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$doSettingsSet() {
+
+ return channel.header("content-type", "application/json").POST(JSON.stringify(data), __cb(_, __frame, 10, 13, _, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$doSettingsSet() {
+
+ progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, _); }); }); };
+
+
+
+ function doDeleteRepository(context, _) { var channel, progress; var __frame = { name: "doDeleteRepository", line: 115 }; return __func(_, this, arguments, doDeleteRepository, 1, __frame, function __$doDeleteRepository() {
+
+ channel = scm.getScmChannel(context).path("live/scm");
+
+ progress = cli.progress("Cleaning up repository files"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$doDeleteRepository() {
+
+ return channel.DELETE(__cb(_, __frame, 6, 13, _, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$doDeleteRepository() {
+
+ progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, _); }); }); };};
View
126 lib/cli/commands/repository_.js
@@ -0,0 +1,126 @@
+/**
+* Copyright (c) Microsoft. All rights reserved.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+var common = require('../common');
+var fs = require('fs');
+var path = require('path');
+var url = require('url');
+var crypto = require('crypto');
+var pfx2pem = require('../../util/certificates/pkcs').pfx2pem;
+var Channel = require('../channel');
+var async = require('async');
+var child_process = require('child_process');
+var utils = require('../utils');
+var constants = require('../constants');
+var cacheUtils = require('../cacheUtils');
+
+exports.init = function(cli) {
+
+ var log = cli.output;
+ var site = cli.category('site');
+ var scm = site.category('deployment');
+ var repository = site.category('repository')
+ .description('Commands to manage your git repository');
+
+ repository.command('branch <branch> [name]>')
+ .whiteListPowershell()
+ .usage('<branch> [name] [options]')
+ .description('set your repository branch')
+ .option('-s, --subscription <id>', 'use the subscription id')
+ .execute(function(branch, name, options, _) {
+ var context = {
+ subscription: cli.category('account').lookupSubscriptionId(options.subscription),
+ settingKey: 'branch',
+ settingValue: branch,
+ site: { name: name }
+ };
+
+ var repositoryUri = scm.ensureRepositoryUri(context, _);
+ if (repositoryUri) {
+ doSettingsSet(context, _);
+ } else {
+ log.error('Repository is not setup');
+ }
+ });
+
+ repository.command('delete [name]')
+ .whiteListPowershell()
+ .usage('[name] [options]')
+ .description('Delete your repository')
+ .option('-s, --subscription <id>', 'use the subscription id')
+ .option('-q, --quiet', 'quiet mode, do not ask for delete confirmation')
+ .execute(function(name, options, _) {
+ var context = {
+ subscription: cli.category('account').lookupSubscriptionId(options.subscription),
+ site: { name: name }
+ };
+
+ var repositoryUri = scm.ensureRepositoryUri(context, _);
+ if (repositoryUri) {
+ if (!options.quiet && !site.confirm('Delete repository? (y/n) ', _)) {
+ return;
+ }
+
+ doDeleteRepository(context, _);
+ site.doRepositoryDelete(context, _);
+ } else {
+ log.error('Repository is not setup');
+ }
+ });
+
+ function doSettingsGet(context, _) {
+ var channel = scm.getScmChannel(context)
+ .path('settings');
+ if (context.settingKey !== undefined) {
+ channel.path(context.settingKey);
+ }
+
+ var progress = cli.progress('Retrieving repository ' + (context.settingKey ? (context.settingKey + ' ') : '') + 'settings');
+ try {
+ return channel.GET(_);
+ } finally {
+ progress.end();
+ }
+ };
+ repository.doSettingsGet = doSettingsGet;
+
+ function doSettingsSet(context, _) {
+ var channel = scm.getScmChannel(context)
+ .path('settings');
+ var data = {
+ key: context.settingKey,
+ value: context.settingValue
+ };
+
+ var progress = cli.progress('Setting ' + context.settingKey + ' to ' + context.settingValue);
+ try {
+ return channel.header('content-type', 'application/json').POST(JSON.stringify(data), _);
+ } finally {
+ progress.end();
+ }
+ };
+
+ function doDeleteRepository(context, _) {
+ var channel = scm.getScmChannel(context)
+ .path('live/scm');
+
+ var progress = cli.progress('Cleaning up repository files');
+ try {
+ return channel.DELETE(_);
+ } finally {
+ progress.end();
+ }
+ };
+};
View
143 lib/cli/commands/site.js
@@ -17,6 +17,7 @@
var fs = require("fs");
var path = require("path");
var url = require("url");
+var util = require("util");
var crypto = require("crypto");
var pfx2pem = require("../../util/certificates/pkcs").pfx2pem;
var Channel = require("../channel");
@@ -67,7 +68,7 @@ exports.init = function(cli) {
var site = cli.category("site").description("Commands to manage your web sites");
- site.command("list").whiteListPowershell().description("List your web sites").option("-s, --subscription <id>", "use the subscription id").execute(function __1(options, _) { var parameters, sites, s; var __frame = { name: "__1", line: 74 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() {
+ site.command("list").whiteListPowershell().description("List your web sites").option("-s, --subscription <id>", "use the subscription id").execute(function __1(options, _) { var parameters, sites, s; var __frame = { name: "__1", line: 75 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() {
@@ -139,7 +140,7 @@ exports.init = function(cli) {
- function promptForSiteName(_) { var __frame = { name: "promptForSiteName", line: 142 }; return __func(_, this, arguments, promptForSiteName, 0, __frame, function __$promptForSiteName() {
+ function promptForSiteName(_) { var __frame = { name: "promptForSiteName", line: 143 }; return __func(_, this, arguments, promptForSiteName, 0, __frame, function __$promptForSiteName() {
log.silly("promptForSiteName"); return (function __$promptForSiteName(__then) {
if ((context.site.name === undefined)) {
log.help("Need a site name");
@@ -147,7 +148,7 @@ exports.init = function(cli) {
- function determineIfSiteExists(_) { var sites, hits; var __frame = { name: "determineIfSiteExists", line: 150 }; return __func(_, this, arguments, determineIfSiteExists, 0, __frame, function __$determineIfSiteExists() {
+ function determineIfSiteExists(_) { var sites, hits; var __frame = { name: "determineIfSiteExists", line: 151 }; return __func(_, this, arguments, determineIfSiteExists, 0, __frame, function __$determineIfSiteExists() {
log.silly("determineIfSiteExists");
return site.doSitesGet(context, __cb(_, __frame, 2, 24, function ___(__0, __1) { sites = __1;
hits = sites.filter(function(item) {
@@ -165,7 +166,7 @@ exports.init = function(cli) {
- function promptForLocation(_) { var spaces, displayNameMatches; var __frame = { name: "promptForLocation", line: 168 }; return __func(_, this, arguments, promptForLocation, 0, __frame, function __$promptForLocation() {
+ function promptForLocation(_) { var spaces, displayNameMatches; var __frame = { name: "promptForLocation", line: 169 }; return __func(_, this, arguments, promptForLocation, 0, __frame, function __$promptForLocation() {
log.silly("promptForLocation");
return cacheUtils.readSpaces(context, __cb(_, __frame, 2, 25, function ___(__0, __1) { spaces = __1; return (function __$promptForLocation(__then) {
if ((!spaces || !spaces.length)) {
@@ -202,7 +203,7 @@ exports.init = function(cli) {
- function determineIfCurrentDirectoryIsGitWorkingTree(_) { var isInsideWorkTree, lines; var __frame = { name: "determineIfCurrentDirectoryIsGitWorkingTree", line: 205 }; return __func(_, this, arguments, determineIfCurrentDirectoryIsGitWorkingTree, 0, __frame, function __$determineIfCurrentDirectoryIsGitWorkingTree() {
+ function determineIfCurrentDirectoryIsGitWorkingTree(_) { var isInsideWorkTree, lines; var __frame = { name: "determineIfCurrentDirectoryIsGitWorkingTree", line: 206 }; return __func(_, this, arguments, determineIfCurrentDirectoryIsGitWorkingTree, 0, __frame, function __$determineIfCurrentDirectoryIsGitWorkingTree() {
log.silly("determineIfCurrentDirectoryIsGitWorkingTree"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$determineIfCurrentDirectoryIsGitWorkingTree() {
@@ -216,7 +217,7 @@ exports.init = function(cli) {
- function initGitOnCurrentDirectory(_) { var __frame = { name: "initGitOnCurrentDirectory", line: 219 }; return __func(_, this, arguments, initGitOnCurrentDirectory, 0, __frame, function __$initGitOnCurrentDirectory() {
+ function initGitOnCurrentDirectory(_) { var __frame = { name: "initGitOnCurrentDirectory", line: 220 }; return __func(_, this, arguments, initGitOnCurrentDirectory, 0, __frame, function __$initGitOnCurrentDirectory() {
log.silly("initGitOnCurrentDirectoryIfNeeded");
if (context.flags.isGitWorkingTree) { return _(null); } ;
@@ -240,7 +241,7 @@ exports.init = function(cli) {
context.flags.isGitWorkingTree = true; _(); }); }, true)); }, true)); }, true)); }); };
- function copyIisNodeWhenServerJsPresent(_) { var sourcePath; var __frame = { name: "copyIisNodeWhenServerJsPresent", line: 243 }; return __func(_, this, arguments, copyIisNodeWhenServerJsPresent, 0, __frame, function __$copyIisNodeWhenServerJsPresent() {
+ function copyIisNodeWhenServerJsPresent(_) { var sourcePath; var __frame = { name: "copyIisNodeWhenServerJsPresent", line: 244 }; 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");
@@ -249,7 +250,7 @@ exports.init = function(cli) {
- function updateLocalConfigWithSiteName(_) { var cfg; var __frame = { name: "updateLocalConfigWithSiteName", line: 252 }; return __func(_, this, arguments, updateLocalConfigWithSiteName, 0, __frame, function __$updateLocalConfigWithSiteName() {
+ function updateLocalConfigWithSiteName(_) { var cfg; var __frame = { name: "updateLocalConfigWithSiteName", line: 253 }; 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;
@@ -259,7 +260,7 @@ exports.init = function(cli) {
- function createSiteAndInitializeRemoteRepo(_) { var __frame = { name: "createSiteAndInitializeRemoteRepo", line: 262 }; return __func(_, this, arguments, createSiteAndInitializeRemoteRepo, 0, __frame, function __$createSiteAndInitializeRemoteRepo() {
+ function createSiteAndInitializeRemoteRepo(_) { var __frame = { name: "createSiteAndInitializeRemoteRepo", line: 263 }; return __func(_, this, arguments, createSiteAndInitializeRemoteRepo, 0, __frame, function __$createSiteAndInitializeRemoteRepo() {
log.silly("createSiteAndInitializeRemoteRepo"); return (function __$createSiteAndInitializeRemoteRepo(__then) {
if (!context.flags.siteExists) {
return site.doSitesPost(context, __cb(_, __frame, 3, 14, function __$createSiteAndInitializeRemoteRepo() {
@@ -275,7 +276,7 @@ exports.init = function(cli) {
log.silly("context.repo", context.repo); _(); }); }); };
- function addRemoteToLocalGitRepo(_) { var remotes, azureExists, gitUri; var __frame = { name: "addRemoteToLocalGitRepo", line: 278 }; return __func(_, this, arguments, addRemoteToLocalGitRepo, 0, __frame, function __$addRemoteToLocalGitRepo() {
+ function addRemoteToLocalGitRepo(_) { var remotes, azureExists, gitUri; var __frame = { name: "addRemoteToLocalGitRepo", line: 279 }; 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) {
@@ -300,11 +301,11 @@ exports.init = function(cli) {
gitUri = getGitUri(context.repo, context.site.name, context.publishingUser);
log.info((("Executing `git remote add azure " + gitUri) + "`"));
- return exec(("git remote add azure " + gitUri), __cb(_, __frame, 25, 12, _, true)); }); }, true)); }); }); }; var __frame = { name: "__2", line: 119 }; return __func(_, this, arguments, __2, 2, __frame, function __$__2() { context = { subscription: cli.category("account").lookupSubscriptionId(options.subscription), git: options.git, site: { name: nameArg, webspace: options.location, hostname: options.hostname }, flags: { } }; return promptForSiteName(__cb(_, __frame, 13, 10, function __$__2() { return determineIfSiteExists(__cb(_, __frame, 14, 10, function __$__2() { return promptForLocation(__cb(_, __frame, 15, 10, function __$__2() { return determineIfCurrentDirectoryIsGitWorkingTree(__cb(_, __frame, 16, 10, function __$__2() { return initGitOnCurrentDirectory(__cb(_, __frame, 17, 10, function __$__2() { return copyIisNodeWhenServerJsPresent(__cb(_, __frame, 18, 10, function __$__2() { return updateLocalConfigWithSiteName(__cb(_, __frame, 19, 10, function __$__2() { return createSiteAndInitializeRemoteRepo(__cb(_, __frame, 20, 10, function __$__2() { return addRemoteToLocalGitRepo(__cb(_, __frame, 21, 10, _, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }); });
+ return exec(("git remote add azure " + gitUri), __cb(_, __frame, 25, 12, _, true)); }); }, true)); }); }); }; var __frame = { name: "__2", line: 120 }; return __func(_, this, arguments, __2, 2, __frame, function __$__2() { context = { subscription: cli.category("account").lookupSubscriptionId(options.subscription), git: options.git, site: { name: nameArg, webspace: options.location, hostname: options.hostname }, flags: { } }; return promptForSiteName(__cb(_, __frame, 13, 10, function __$__2() { return determineIfSiteExists(__cb(_, __frame, 14, 10, function __$__2() { return promptForLocation(__cb(_, __frame, 15, 10, function __$__2() { return determineIfCurrentDirectoryIsGitWorkingTree(__cb(_, __frame, 16, 10, function __$__2() { return initGitOnCurrentDirectory(__cb(_, __frame, 17, 10, function __$__2() { return copyIisNodeWhenServerJsPresent(__cb(_, __frame, 18, 10, function __$__2() { return updateLocalConfigWithSiteName(__cb(_, __frame, 19, 10, function __$__2() { return createSiteAndInitializeRemoteRepo(__cb(_, __frame, 20, 10, function __$__2() { return addRemoteToLocalGitRepo(__cb(_, __frame, 21, 10, _, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }, true)); }); });
- function portalCreateSiteInstruction(context, _) { var href; var __frame = { name: "portalCreateSiteInstruction", line: 307 }; return __func(_, this, arguments, portalCreateSiteInstruction, 1, __frame, function __$portalCreateSiteInstruction() {
+ function portalCreateSiteInstruction(context, _) { var href; var __frame = { name: "portalCreateSiteInstruction", line: 308 }; 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");
@@ -323,7 +324,7 @@ exports.init = function(cli) {
- function getPublishingUser(context, _) { var publishingUsers, filters; var __frame = { name: "getPublishingUser", line: 326 }; return __func(_, this, arguments, getPublishingUser, 1, __frame, function __$getPublishingUser() {
+ function getPublishingUser(context, _) { var publishingUsers, filters; var __frame = { name: "getPublishingUser", line: 327 }; 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) {
@@ -341,7 +342,7 @@ exports.init = function(cli) {
return prompt("Publishing username: ", __cb(_, __frame, 15, 11, _, true)); }); }); };
- function portalGitInitInstruction(context, _) { var href; var __frame = { name: "portalGitInitInstruction", line: 344 }; return __func(_, this, arguments, portalGitInitInstruction, 1, __frame, function __$portalGitInitInstruction() {
+ function portalGitInitInstruction(context, _) { var href; var __frame = { name: "portalGitInitInstruction", line: 345 }; 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\"");
@@ -361,7 +362,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: 367 }; 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: 368 }; return __func(_, this, arguments, __3, 1, __frame, function __$__3() {
@@ -383,20 +384,27 @@ exports.init = function(cli) {
- site.command("portal [name]").whiteListPowershell().description("Opens the portal in a browser to manage your web sites").execute(function __4(name, options, _) { var href; var __frame = { name: "__4", line: 389 }; 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: 391 }; return __func(_, this, arguments, __4, 2, __frame, function __$__4() {
- href = utils.getPortalUrl();
+
+ href = url.parse(utils.getPortalUrl(), true);
+ delete href.search;
+ delete href.path;
if (name) {
- href = (((href + "#Workspaces/WebsiteExtension/Website/") + name) + "/dashboard"); } ;
+ href.hash = (("#Workspaces/WebsiteExtension/Website/" + name) + "/dashboard"); } ;
+
+ if ((options && options.realm)) {
+ href.query.whr = options.realm; } ;
- common.launchBrowser(href); _(); }); });
+ targetUrl = url.format(href);
+ 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: 403 }; 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: 411 }; return __func(_, this, arguments, __5, 2, __frame, function __$__5() {
@@ -410,14 +418,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, -402, 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, -410, 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, data; var __frame = { name: "__6", line: 424 }; 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: 432 }; return __func(_, this, arguments, __6, 2, __frame, function __$__6() {
@@ -434,32 +442,41 @@ exports.init = function(cli) {
log.info("Showing details for site");
log.verbose("Parameters", context);
- return async.parallel([function __1(_) { var __frame = { name: "__1", line: 438 }; return __func(_, this, arguments, __1, 0, __frame, function __$__1() {
+ return async.parallel([function __1(_) { var __frame = { name: "__1", line: 446 }; 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: 439 }; 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: 447 }; 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;
repositoryUri = getRepositoryUri(result[0]);
gitUri = (repositoryUri ? getGitUri(repositoryUri, context.site.name) : "none");
+ settings = []; return (function __$__6(__then) {
+ if (repositoryUri) {
+ return site.category("deployment").ensureRepositoryUri(context, __cb(_, __frame, 23, 12, function __$__6() {
+ return site.category("repository").doSettingsGet(context, __cb(_, __frame, 24, 23, function ___(__0, __4) { settings = __4; __then(); }, true)); }, true)); } else { __then(); } ; })(function __$__6() {
- if (log.format().json) {
- data = {
- site: clean(result[0]),
- config: clean(result[1]),
- gitRepositoryUri: gitUri };
+ if (log.format().json) {
+ data = {
+ site: clean(result[0]),
+ config: clean(result[1]),
+ gitRepositoryUri: gitUri,
+ settings: settings };
- log.json(data); }
- else {
- logEachData("Site", result[0]);
- logEachData("Config", result[1]);
- log.data("GitRepositoryUri", gitUri); } ; _(); }, true)); }, true)); }); });
+ log.json(data); }
+ else {
+ logEachData("Site", result[0]);
+ logEachData("Config", result[1]);
+
+ log.data("GitRepositoryUri", gitUri);
+ for (index in settings) {
+ log.data((("Settings" + " ") + settings[index].Key), settings[index].Value); }; } ; _(); }); }, true)); }, true)); }); });
- function lookupSiteName(context, _) { var cfg; var __frame = { name: "lookupSiteName", line: 462 }; return __func(_, this, arguments, lookupSiteName, 1, __frame, function __$lookupSiteName() {
+
+ function lookupSiteName(context, _) { var cfg; var __frame = { name: "lookupSiteName", line: 479 }; return __func(_, this, arguments, lookupSiteName, 1, __frame, function __$lookupSiteName() {
if ((context.site.name !== undefined)) { return _(null); } ;
@@ -480,7 +497,7 @@ exports.init = function(cli) {
- function lookupSiteWebSpace(context, _) { var sites, index; var __frame = { name: "lookupSiteWebSpace", line: 483 }; return __func(_, this, arguments, lookupSiteWebSpace, 1, __frame, function __$lookupSiteWebSpace() {
+ function lookupSiteWebSpace(context, _) { var sites, index; var __frame = { name: "lookupSiteWebSpace", line: 500 }; 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) {
@@ -494,7 +511,7 @@ exports.init = function(cli) {
- function lookupSiteNameAndWebSpace(context, _) { var cache; var __frame = { name: "lookupSiteNameAndWebSpace", line: 497 }; return __func(_, this, arguments, lookupSiteNameAndWebSpace, 1, __frame, function __$lookupSiteNameAndWebSpace() {
+ function lookupSiteNameAndWebSpace(context, _) { var cache; var __frame = { name: "lookupSiteNameAndWebSpace", line: 514 }; 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)) {
@@ -568,7 +585,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: 576 }; 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: 593 }; return __func(_, this, arguments, __7, 2, __frame, function __$__7() {
@@ -584,7 +601,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, -575, 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, -592, 17, function ___(__0, __2) { return (function __$__7(__then) { if (__2) { return _(null); } else { __then(); } ; })(function __$__7() {
@@ -607,7 +624,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: 614 }; 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: 631 }; return __func(_, this, arguments, __8, 2, __frame, function __$__8() {
@@ -658,7 +675,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: 665 }; 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: 682 }; return __func(_, this, arguments, __9, 2, __frame, function __$__9() {
@@ -713,19 +730,19 @@ exports.init = function(cli) {
- site.readConfig = function site_readConfig__10(_) { var __frame = { name: "site_readConfig__10", line: 716 }; 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: 733 }; 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: 723 }; 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: 740 }; 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: 728 }; 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: 745 }; 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) {
@@ -736,7 +753,7 @@ exports.init = function(cli) {
- site.writeConfigValue = function site_writeConfigValue__13(name, value, _) { var __frame = { name: "site_writeConfigValue__13", line: 739 }; 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: 756 }; return __func(_, this, arguments, site_writeConfigValue__13, 2, __frame, function __$site_writeConfigValue__13() {
return exec(((("git config " + name) + " ") + value), __cb(_, __frame, 1, 4, _, true)); }); };
@@ -808,7 +825,33 @@ exports.init = function(cli) {
- site.doSpacesGet = function site_doSpacesGet__14(options, _) { var progress, result, spaces; var __frame = { name: "site_doSpacesGet__14", line: 811 }; return __func(_, this, arguments, site_doSpacesGet__14, 1, __frame, function __$site_doSpacesGet__14() {
+ site.doRepositoryDelete = function(options, callback) {
+ log.verbose("Subscription", options.subscription);
+ log.verbose("Webspace", options.site.webspace);
+ log.verbose("Site", options.site.name);
+
+ var progress = cli.progress("Updating site information");
+ getChannel().path(options.subscription).path("services").path("webspaces").path(options.site.webspace).path("sites").path(options.site.name).path("repository").DELETE(function(err, result) {
+
+
+
+
+
+
+
+
+
+ progress.end();
+ if (err) {
+ logError("Failed to delete repository", err); }
+ else {
+ log.info("Repository deleted"); } ;
+
+ return callback(err, result); }); };
+
+
+
+ site.doSpacesGet = function site_doSpacesGet__14(options, _) { var progress, result, spaces; var __frame = { name: "site_doSpacesGet__14", line: 854 }; 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() {
@@ -830,7 +873,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: 833 }; 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: 876 }; 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;
@@ -842,7 +885,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: 847 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() {
+ return async.map(spaces, function __1(webspace, _) { var __frame = { name: "__1", line: 890 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() {
@@ -921,12 +964,12 @@ exports.init = function(cli) {
- site.doRepositoryGet = function site_doRepositoryGet__16(options, _) { var siteData; var __frame = { name: "site_doRepositoryGet__16", line: 924 }; 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: 967 }; 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: 929 }; 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: 972 }; 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
51 lib/cli/commands/site_.js
@@ -17,6 +17,7 @@ var common = require('../common');
var fs = require('fs');
var path = require('path');
var url = require('url');
+var util = require('util');
var crypto = require('crypto');
var pfx2pem = require('../../util/certificates/pkcs').pfx2pem;
var Channel = require('../channel');
@@ -386,14 +387,21 @@ 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 (name, options, _) {
- var href = utils.getPortalUrl();
+ var href = url.parse(utils.getPortalUrl(), true);
+ delete href.search;
+ delete href.path;
if (name) {
- href = href + '#Workspaces/WebsiteExtension/Website/' + name + '/dashboard';
+ href.hash = '#Workspaces/WebsiteExtension/Website/' + name + '/dashboard';
}
- common.launchBrowser(href);
+ if(options && options.realm){
+ href.query.whr = options.realm;
+ }
+ targetUrl = url.format(href);
+ common.launchBrowser(targetUrl);
});
site.command('browse [name]')
@@ -442,12 +450,18 @@ exports.init = function (cli) {
var repositoryUri = getRepositoryUri(result[0]);
var gitUri = repositoryUri ? getGitUri(repositoryUri, context.site.name) : 'none';
+ var settings = [];
+ if (repositoryUri) {
+ site.category('deployment').ensureRepositoryUri(context, _);
+ settings = site.category('repository').doSettingsGet(context, _);
+ }
if (log.format().json) {
var data = {
site: clean(result[0]),
config: clean(result[1]),
- gitRepositoryUri: gitUri
+ gitRepositoryUri: gitUri,
+ settings: settings
};
log.json(data);
@@ -456,6 +470,9 @@ exports.init = function (cli) {
logEachData('Config', result[1]);
log.data('GitRepositoryUri', gitUri);
+ for (var index in settings) {
+ log.data('Settings' + ' ' + settings[index].Key, settings[index].Value);
+ }
}
});
@@ -808,6 +825,32 @@ exports.init = function (cli) {
});
};
+ site.doRepositoryDelete = function(options, callback) {
+ log.verbose('Subscription', options.subscription);
+ log.verbose('Webspace', options.site.webspace);
+ log.verbose('Site', options.site.name);
+
+ var progress = cli.progress('Updating site information');
+ getChannel()
+ .path(options.subscription)
+ .path('services')
+ .path('webspaces')
+ .path(options.site.webspace)
+ .path('sites')
+ .path(options.site.name)
+ .path('repository')
+ .DELETE(
+ function(err, result) {
+ progress.end();
+ if (err) {
+ logError('Failed to delete repository', err);
+ } else {
+ log.info('Repository deleted');
+ }
+ return callback(err, result);
+ });
+ };
+
site.doSpacesGet = function (options, _) {
log.verbose('Subscription', options.subscription);
View
14 lib/cli/utils.js
@@ -440,9 +440,19 @@ exports.getPortalUrl = function () {
|| constants.DEFAULT_PORTAL_URL;
};
-exports.getPublishingProfileUrl = function () {
- return process.env.AZURE_PUBLISHINGPROFILE_URL
+exports.getPublishingProfileUrl = function (realm) {
+ var targetUrl = process.env.AZURE_PUBLISHINGPROFILE_URL
|| constants.DEFAULT_PUBLISHINGPROFILE_URL;
+ var urlObj;
+
+ if (realm) {
+ urlObj = url.parse(targetUrl, true);
+ delete urlObj.search;
+ urlObj.query.whr = realm;
+ targetUrl = url.format(urlObj);
+ }
+
+ return targetUrl;
};
exports.getManagementEndpointUrl = function (accountManagementEndpointUrl) {
Please sign in to comment.
Something went wrong with that request. Please try again.