Skip to content
Browse files

Merge pull request #448 from WindowsAzure/dev

Release 0.6.7
  • Loading branch information...
2 parents 7fb88ff + edc4b40 commit 17f3e63c1968166ea0a5a9204cfe82d6911c8c51 @andrerod andrerod committed
Showing with 5,502 additions and 860 deletions.
  1. +7 −1 ChangeLog.txt
  2. +1 −1 examples/blobuploader/server.js
  3. +1 −1 examples/blog/blog.js
  4. +1 −1 examples/blog/public/stylesheets/style.css
  5. +3 −2 examples/geophoto/package.json
  6. +2 −2 examples/geophoto/services/pushpinService.js
  7. +3 −3 examples/geophoto/views/layout.ejs
  8. +2 −2 examples/myevents/server.js
  9. +1 −1 examples/tasklist/server.js
  10. +32 −26 lib/azure.js
  11. +50 −46 lib/cli/cli.js
  12. +3 −2 lib/cli/commands/account.js
  13. +71 −41 lib/cli/commands/deployment.js
  14. +51 −21 lib/cli/commands/deployment_.js
  15. +81 −113 lib/cli/commands/log.js
  16. +1 −1 lib/cli/commands/log_.js
  17. +123 −0 lib/cli/commands/repository.js
  18. +126 −0 lib/cli/commands/repository_.js
  19. +258 −161 lib/cli/commands/site.js
  20. +224 −127 lib/cli/commands/site_.js
  21. +176 −0 lib/cli/commands/siteconfig.js
  22. +178 −0 lib/cli/commands/siteconfig_.js
  23. +432 −0 lib/cli/linkedrevisioncontrol.js
  24. +433 −0 lib/cli/linkedrevisioncontrol_.js
  25. +12 −2 lib/cli/utils.js
  26. +15 −15 lib/services/blob/blobservice.js
  27. +217 −0 lib/services/core/connectionstringparser.js
  28. +9 −50 lib/services/core/servicebusserviceclient.js
  29. +137 −0 lib/services/core/servicebussettings.js
  30. +21 −27 lib/services/core/serviceclient.js
  31. +2 −10 lib/services/core/servicemanagementclient.js
  32. +120 −0 lib/services/core/servicemanagementsettings.js
  33. +238 −0 lib/services/core/servicesettings.js
  34. +101 −30 lib/services/core/storageserviceclient.js
  35. +296 −0 lib/services/core/storageservicesettings.js
  36. +14 −14 lib/services/queue/queueservice.js
  37. +60 −10 lib/services/serviceBus/servicebusservice.js
  38. +6 −4 lib/services/serviceBus/wrap.js
  39. +12 −29 lib/services/serviceBus/wrapservice.js
  40. +3 −4 lib/services/serviceBus/wraptokenmanager.js
  41. +15 −15 lib/services/serviceManagement/servicemanagementservice.js
  42. +2 −2 lib/services/table/batchserviceclient.js
  43. +16 −15 lib/services/table/tableservice.js
  44. +55 −0 lib/util/constants.js
  45. +15 −7 lib/util/js2xml.js
  46. +38 −0 lib/util/util.js
  47. +50 −0 lib/util/validate.js
  48. +5 −2 package.json
  49. +13 −15 test/azure-tests.js
  50. +8 −12 test/cli/commands/cli.account-tests.js
  51. +154 −0 test/cli/commands/cli.deployment-tests.js
  52. +348 −0 test/cli/commands/cli.site-tests.js
  53. +185 −0 test/cli/commands/cli.siteconfig-tests.js
  54. +1 −1 test/cli/commands/generate-psm1-utils-test.js
  55. +11 −0 test/cli/data/account-credentials.publishsettings
  56. +89 −0 test/cli/linkrevisioncontrol-tests.js
  57. +29 −23 test/cli/util.js
  58. +5 −0 test/clitestlist.txt
  59. +36 −17 test/services/blob/blobservice-tests.js
  60. +112 −0 test/services/core/connectionstringparser-tests.js
  61. +86 −0 test/services/core/servicebussettings-tests.js
  62. +94 −0 test/services/core/servicemanagementsettings-tests.js
  63. +59 −0 test/services/core/servicesettings-tests.js
  64. +310 −0 test/services/core/storageservicesettings-tests.js
  65. +25 −0 test/services/queue/queueservice-tests.js
  66. +51 −0 test/services/serviceBus/servicebusservice-tests.js
  67. +3 −1 test/services/table/tableservice-batch-tests.js
  68. +99 −2 test/services/table/tableservice-tests.js
  69. +6 −1 test/testlist.txt
  70. +19 −0 test/util/util-tests.js
  71. +40 −0 test/util/validate-tests.js
View
8 ChangeLog.txt
@@ -1,3 +1,9 @@
+2012.10.15 Version 0.6.7
+ * Adding connection strings support for storage and service bus
+ * Fixing issue with EMULATED and explicit variables making the later more relevant
+ * Adding Github support
+ * Adding website application settings support
+
2012.10.12 Version 0.6.6
* Using fixed version of commander.js to avoid bug in commander.js 1.0.5
@@ -33,7 +39,7 @@
* Multiple Bugfixes
2011.12.14 Version 0.5.1
- * Multiple bug fixes.
+ * Multiple bug fixes
2011.12.09 Version 0.5.0
* Initial Release
View
2 examples/blobuploader/server.js
@@ -31,7 +31,7 @@ var helpers = require('./helpers.js');
var app = module.exports = express.createServer();
// Global request options, set the retryPolicy
-var blobClient = azure.createBlobService(azure.ServiceClient.DEVSTORE_STORAGE_ACCOUNT, azure.ServiceClient.DEVSTORE_STORAGE_ACCESS_KEY, azure.ServiceClient.DEVSTORE_BLOB_HOST).withFilter(new azure.ExponentialRetryPolicyFilter());
+var blobClient = azure.createBlobService('UseDevelopmentStorage=true').withFilter(new azure.ExponentialRetryPolicyFilter());
var containerName = 'webpi';
//Configuration
View
2 examples/blog/blog.js
@@ -33,7 +33,7 @@ var tableName = 'posts';
var partition = 'part1';
Blog = function () {
- this.tableClient = azure.createTableService(ServiceClient.DEVSTORE_STORAGE_ACCOUNT, ServiceClient.DEVSTORE_STORAGE_ACCESS_KEY, ServiceClient.DEVSTORE_TABLE_HOST);
+ this.tableClient = azure.createTableService('UseDevelopmentStorage=true');
};
Blog.prototype.findAll = function (callback) {
View
2 examples/blog/public/stylesheets/style.css
@@ -1,7 +1,7 @@
body {
font-family: Tahoma, "Helvetica Neue", Arial, Helvetica, sans-serif;
font-size: 13px;
- text-stroke: 1px rgba(255,255,255,0.10);
+ text-stroke: 1px rgba(255,255,255,0.1);
color: #555;
background-color: #f3f4f5;
}
View
5 examples/geophoto/package.json
@@ -2,11 +2,12 @@
"name": "geophoto"
, "version": "0.0.1"
, "dependencies": {
- "azure": ">= 0.5.1"
- , "express": "2.5.1"
+ "express": "2.5.1"
, "ejs": ">= 0.0.1"
, "socket.io": "0.8.7"
, "node-uuid": ">= 1.3.3"
, "nconf": ">= 0.5.1"
+ , "uglify-js": ">= 1.3.3"
+ , "azure": ">= 0.5.1"
}
}
View
4 examples/geophoto/services/pushpinService.js
@@ -19,8 +19,8 @@ if (!fs.existsSync) {
}
var azure;
-if (fs.existsSync('./../../lib/azure.js')) {
- azure = require('./../../lib/azure');
+if (fs.existsSync('./../../../lib/azure.js')) {
+ azure = require('./../../../lib/azure');
} else {
azure = require('azure');
}
View
6 examples/geophoto/views/layout.ejs
@@ -14,11 +14,11 @@
<script type="text/javascript" src="socket.io/socket.io.js"></script>
<script type="text/javascript">
- var bingMapsCredentials = '<%= bingMapsCredentials %>';
+ var bingMapsCredentials = '<% if (locals.bingMapsCredentials) { %><%= bingMapsCredentials %><% } %>';
var initialPushpins = [
- <% pushpins.forEach(function(pushpin) { %>
+ <% if (locals.pushpins) { pushpins.forEach(function(pushpin) { %>
{ title: '<%= pushpin.title %>', description: '<%= pushpin.description %>', latitude: '<%= pushpin.latitude %>', longitude: '<%= pushpin.longitude %>', RowKey: '<%= pushpin.RowKey %>', PartitionKey: '<%= pushpin.PartitionKey %>', imageUrl: '<%= pushpin.imageUrl %>' },
- <% }) %>
+ <% }) } %>
];
</script>
View
4 examples/myevents/server.js
@@ -11,8 +11,8 @@ var express = require('express')
var app = module.exports = express.createServer();
-var tableClient = azure.createTableService(ServiceClient.DEVSTORE_STORAGE_ACCOUNT, ServiceClient.DEVSTORE_STORAGE_ACCESS_KEY, ServiceClient.DEVSTORE_TABLE_HOST);
-var blobClient = azure.createBlobService(azure.ServiceClient.DEVSTORE_STORAGE_ACCOUNT, azure.ServiceClient.DEVSTORE_STORAGE_ACCESS_KEY, azure.ServiceClient.DEVSTORE_BLOB_HOST).withFilter(new azure.ExponentialRetryPolicyFilter());
+var tableClient = azure.createTableService('UseDevelopmentStorage=true');
+var blobClient = azure.createBlobService('UseDevelopmentStorage=true').withFilter(new azure.ExponentialRetryPolicyFilter());
// Create table and blob
tableClient.createTableIfNotExists('events', function(error) {
View
2 examples/tasklist/server.js
@@ -32,7 +32,7 @@ var Home = require('./home');
var ServiceClient = azure.ServiceClient;
var app = module.exports = express.createServer();
-var client = azure.createTableService(ServiceClient.DEVSTORE_STORAGE_ACCOUNT, ServiceClient.DEVSTORE_STORAGE_ACCESS_KEY, ServiceClient.DEVSTORE_TABLE_HOST);
+var client = azure.createTableService('UseDevelopmentStorage=true');
// table creation
client.createTableIfNotExists("tasks", function (res, created) {
View
58 lib/azure.js
@@ -26,13 +26,13 @@ exports.TableService = TableService;
* Creates a new TableService object.
* If no storageaccount or storageaccesskey are provided, the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY environment variables will be used.
*
-* @param {string} [storageAccount] The storage account.
-* @param {string} [storageAccessKey] The storage access key.
-* @param {string} [host] The host address.
-* @param {object} [authenticationProvider] The authentication provider.
+* @param {string} [storageAccountOrConnectionString] The storage account or the connection string.
+* @param {string} [storageAccessKey] The storage access key.
+* @param {string} [host] The host address.
+* @param {object} [authenticationProvider] The authentication provider.
*/
-exports.createTableService = function (storageAccount, storageAccessKey, host, authenticationProvider) {
- return new TableService(storageAccount, storageAccessKey, host, authenticationProvider);
+exports.createTableService = function (storageAccountOrConnectionString, storageAccessKey, host, authenticationProvider) {
+ return new TableService(storageAccountOrConnectionString, storageAccessKey, host, authenticationProvider);
};
/**
@@ -46,13 +46,13 @@ exports.BlobService = BlobService;
* Creates a new BlobService object.
* If no storageaccount or storageaccesskey are provided, the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY environment variables will be used.
*
-* @param {string} [storageAccount] The storage account.
-* @param {string} [storageAccessKey] The storage access key.
-* @param {string} [host] The host address.
-* @param {object} [authenticationProvider] The authentication provider.
+* @param {string} [storageAccountOrConnectionString] The storage account or the connection string.
+* @param {string} [storageAccessKey] The storage access key.
+* @param {string} [host] The host address.
+* @param {object} [authenticationProvider] The authentication provider.
*/
-exports.createBlobService = function (storageAccount, storageAccessKey, host, authenticationProvider) {
- return new BlobService(storageAccount, storageAccessKey, host, authenticationProvider);
+exports.createBlobService = function (storageAccountOrConnectionString, storageAccessKey, host, authenticationProvider) {
+ return new BlobService(storageAccountOrConnectionString, storageAccessKey, host, authenticationProvider);
};
/**
@@ -67,13 +67,13 @@ exports.QueueService = QueueService;
* If no storageAccount or storageAccessKey are provided, the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY
* environment variables will be used.
*
-* @param {string} [storageAccount] The storage account.
-* @param {string} [storageAccessKey] The storage access key.
-* @param {string} [host] The host address.
-* @param {object} [authenticationProvider] The authentication provider.
+* @param {string} [storageAccountOrConnectionString] The storage account or the connection string.
+* @param {string} [storageAccessKey] The storage access key.
+* @param {string} [host] The host address.
+* @param {object} [authenticationProvider] The authentication provider.
*/
-exports.createQueueService = function (storageAccount, storageAccessKey, host, authenticationProvider) {
- return new QueueService(storageAccount, storageAccessKey, host, authenticationProvider);
+exports.createQueueService = function (storageAccountOrConnectionString, storageAccessKey, host, authenticationProvider) {
+ return new QueueService(storageAccountOrConnectionString, storageAccessKey, host, authenticationProvider);
};
/**
@@ -86,15 +86,15 @@ exports.ServiceBusService = ServiceBusService;
/**
* Creates a new ServiceBusService object.
*
-* @param {string} [namespace] The service bus namespace.
-* @param {string} [accessKey] The password.
-* @param {string} [issuer] The issuer.
-* @param {string} [acsNamespace] The acs namespace. Usually the same as the sb namespace with "-sb" suffix.
-* @param {string} [host] The host address.
-* @param {object} [authenticationProvider] The authentication provider.
+* @param {string} [namespaceOrConnectionString] The service bus namespace.
+* @param {string} [accessKey] The password.
+* @param {string} [issuer] The issuer.
+* @param {string} [acsNamespace] The acs namespace. Usually the same as the sb namespace with "-sb" suffix.
+* @param {string} [host] The host address.
+* @param {object} [authenticationProvider] The authentication provider.
*/
-exports.createServiceBusService = function (namespace, accessKey, issuer, acsNamespace, host, authenticationProvider) {
- return new ServiceBusService(namespace, accessKey, issuer, acsNamespace, host, authenticationProvider);
+exports.createServiceBusService = function (namespaceOrConnectionString, accessKey, issuer, acsNamespace, host, authenticationProvider) {
+ return new ServiceBusService(namespaceOrConnectionString, accessKey, issuer, acsNamespace, host, authenticationProvider);
};
/**
@@ -149,6 +149,12 @@ exports.SharedKeyTable = require('./services/table/sharedkeytable');
exports.SharedKeyLiteTable = require('./services/table/sharedkeylitetable');
exports.ISO8061Date = require('./util/iso8061date');
exports.Logger = require('./diagnostics/logger');
+exports.ConnectionStringParser = require('./services/core/connectionstringparser');
+exports.ServiceSettings = require('./services/core/servicesettings');
+exports.StorageServiceSettings = require('./services/core/storageservicesettings');
+exports.ServiceBusSettings = require('./services/core/servicebussettings');
+exports.ServiceManagementSettings = require('./services/core/servicemanagementsettings');
+exports.Validate = require('./util/validate');
/*
* Convenience functions.
View
96 lib/cli/cli.js
@@ -344,66 +344,71 @@ commander.Command.prototype.whiteListPowershell = function (whitelist) {
return this;
};
-// Allow cli.password to accept empty passwords
-commander.Command.prototype.password = function (str, mask, fn) {
+commander.Command.prototype.passwordOnce = function (currentStr, mask, callback) {
+ var self = this;
+ var buf = '';
+
// default mask
if ('function' === typeof mask) {
- fn = mask;
+ callback = mask;
mask = '';
}
- var getPassword = function (currentStr, callback) {
- var self = this;
- var buf = '';
+ if (!process.stdin.setRawMode) {
+ process.stdin.setRawMode = tty.setRawMode;
+ }
- if (!process.stdin.setRawMode) {
- process.stdin.setRawMode = tty.setRawMode;
+ process.stdin.resume();
+ process.stdin.setRawMode(true);
+ fs.writeSync(istty1 ? 1 : 2, currentStr);
+ process.stdin.on('data', function(char) {
+ // Exit on Ctrl+C keypress
+ char = char.toString();
+ if (char === '\003') {
+ console.log('%s', buf);
+ process.exit();
}
- process.stdin.resume();
- process.stdin.setRawMode(true);
- fs.writeSync(istty1 ? 1 : 2, currentStr);
- process.stdin.on('data', function(char) {
- // Exit on Ctrl+C keypress
- char = char.toString();
- if (char === '\003') {
- console.log('%s', buf);
- process.exit();
- }
+ // Return password in the buffer on enter key press
+ if (char === '\015') {
+ process.stdin.removeAllListeners('data');
+ process.stdout.write('\n');
+ process.stdin.setRawMode(false);
+ process.stdin.pause();
- // Return password in the buffer on enter key press
- if (char === '\015') {
- process.stdin.removeAllListeners('data');
- process.stdout.write('\n');
- process.stdin.setRawMode(false);
- callback(buf);
- return;
- }
-
- // Backspace handling
- // Windows usually sends '\b' (^H) while Linux sends '\x7f'
- if (char === '\b' || char === '\177') {
- if (buf) {
- buf = buf.slice(0, -1);
- for (var j = 0; j < mask.length; ++j) {
- process.stdout.write('\b \b'); // space the last char out
- }
+ return callback(buf);
+ }
+
+ // Backspace handling
+ // Windows usually sends '\b' (^H) while Linux sends '\x7f'
+ if (char === '\b' || char === '\177') {
+ if (buf) {
+ buf = buf.slice(0, -1);
+ for (var j = 0; j < mask.length; ++j) {
+ process.stdout.write('\b \b'); // space the last char out
}
- return;
- }
- char = char.split('\015')[0]; // only use the first line if many (for paste)
- for(var i = 0; i < char.length; ++i) {
- process.stdout.write(mask); // output several chars (for paste)
}
- buf += char;
- }).resume();
- };
+ return;
+ }
+
+ char = char.split('\015')[0]; // only use the first line if many (for paste)
+ for(var i = 0; i < char.length; ++i) {
+ process.stdout.write(mask); // output several chars (for paste)
+ }
+
+ buf += char;
+ });
+};
+
+// Allow cli.password to accept empty passwords
+commander.Command.prototype.password = function (str, mask, fn) {
+ var self = this;
// Prompt first time
- getPassword(str, function (pass) {
+ self.passwordOnce(str, mask, function (pass) {
// Prompt for confirmation
- getPassword('Confirm password: ', function (pass2) {
+ self.passwordOnce('Confirm password: ', mask, function (pass2) {
if (pass === pass2) {
fn (pass);
} else {
@@ -413,7 +418,6 @@ commander.Command.prototype.password = function (str, mask, fn) {
});
};
-
commander.Command.prototype.execute = function (fn) {
var self = this;
return self.action(function () {
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
112 lib/cli/commands/deployment.js
@@ -14,9 +14,6 @@
-
-
-
var fs = require("fs");
var path = require("path");
var url = require("url");
@@ -24,11 +21,12 @@ 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");
+var linkedRevisionControl = require("../linkedrevisioncontrol");
+
exports.init = function(cli) {
var log = cli.output;
@@ -65,7 +63,7 @@ exports.init = function(cli) {
scm.getScmChannel = getScmChannel;
- scm.command("list [name]").whiteListPowershell().usage("[options] [name]").description("List your git deployments").option("-s, --subscription <id>", "use the subscription id").option("-m, --max <count>", "limit the maximum number of results").execute(function __1(name, options, _) { var context, repositoryUri; var __frame = { name: "__1", line: 74 }; return __func(_, this, arguments, __1, 2, __frame, function __$__1() {
+ scm.command("list [name]").whiteListPowershell().usage("[options] [name]").description("List your git deployments").option("-s, --subscription <id>", "use the subscription id").option("-m, --max <count>", "limit the maximum number of results").execute(function __1(name, options, _) { var context, repositoryUri; var __frame = { name: "__1", line: 72 }; return __func(_, this, arguments, __1, 2, __frame, function __$__1() {
@@ -80,7 +78,7 @@ exports.init = function(cli) {
- return ensureRepositoryUri(context, __cb(_, __frame, 9, 26, function ___(__0, __1) { repositoryUri = __1; return (function __$__1(__then) {
+ return site.ensureRepositoryUri(context, __cb(_, __frame, 9, 26, function ___(__0, __1) { repositoryUri = __1; return (function __$__1(__then) {
if (repositoryUri) {
return listDeployments(context, __cb(_, __frame, 11, 8, __then, true)); } else {
@@ -88,7 +86,7 @@ exports.init = function(cli) {
- scm.command("show <commitId> [name]").whiteListPowershell().usage("[options] <commitId> [name]").description("Show your git deployment").option("-s, --subscription <id>", "use the subscription id").option("-d, --details", "display log details").execute(function __2(commitId, name, options, _) { var context, repositoryUri, deployment, data, logs, i, details, j; var __frame = { name: "__2", line: 97 }; return __func(_, this, arguments, __2, 3, __frame, function __$__2() {
+ scm.command("show <commitId> [name]").whiteListPowershell().usage("[options] <commitId> [name]").description("Show your git deployment").option("-s, --subscription <id>", "use the subscription id").option("-d, --details", "display log details").execute(function __2(commitId, name, options, _) { var context, repositoryUri, deployment, data, logs, i, details, j; var __frame = { name: "__2", line: 95 }; return __func(_, this, arguments, __2, 3, __frame, function __$__2() {
@@ -107,7 +105,7 @@ exports.init = function(cli) {
return _(null, log.error((("deployment with " + commitId) + " does not exist"))); } else { __then(); } ; })(function __$__2() {
- return ensureRepositoryUri(context, __cb(_, __frame, 13, 26, function ___(__0, __3) { repositoryUri = __3; return (function __$__2(__then) {
+ return site.ensureRepositoryUri(context, __cb(_, __frame, 13, 26, function ___(__0, __3) { repositoryUri = __3; return (function __$__2(__then) {
if (repositoryUri) {
return scm.doDeploymentGet(context, __cb(_, __frame, 15, 25, function ___(__0, __4) { deployment = __4; return (function __$__2(__then) {
@@ -140,7 +138,7 @@ exports.init = function(cli) {
- scm.command("redeploy <commitId> [name]").whiteListPowershell().usage("[options] <commitId> [name]").description("Redeploy your git deployment").option("-s, --subscription <id>", "use the subscription id").option("-q, --quiet", "quiet mode, do not ask for redeploy confirmation").execute(function __3(commitId, name, options, _) { var context, repositoryUri; var __frame = { name: "__3", line: 149 }; return __func(_, this, arguments, __3, 3, __frame, function __$__3() {
+ scm.command("redeploy <commitId> [name]").whiteListPowershell().usage("[options] <commitId> [name]").description("Redeploy your git deployment").option("-s, --subscription <id>", "use the subscription id").option("-q, --quiet", "quiet mode, do not ask for redeploy confirmation").execute(function __3(commitId, name, options, _) { var context, repositoryUri; var __frame = { name: "__3", line: 147 }; return __func(_, this, arguments, __3, 3, __frame, function __$__3() {
@@ -159,9 +157,9 @@ exports.init = function(cli) {
return _(null, log.error((("deployment with " + commitId) + " does not exist"))); } else { __then(); } ; })(function __$__3() {
- return ensureRepositoryUri(context, __cb(_, __frame, 13, 26, function ___(__0, __4) { repositoryUri = __4; return (function __$__3(__then) {
+ return site.ensureRepositoryUri(context, __cb(_, __frame, 13, 26, function ___(__0, __4) { repositoryUri = __4; return (function __$__3(__then) {
if (repositoryUri) { return (function __$__3(_) {
- var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return site.confirm((("Reploy deployment with " + context.shortId) + " id? (y/n) "), __cb(_, __frame, 15, 31, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -148, 17, function ___(__0, __5) { return (function __$__3(__then) { if (__5) { return _(null); } else { __then(); } ; })(function __$__3() {
+ var __1 = !options.quiet; if (!__1) { return _(null, __1); } ; return site.confirm((("Reploy deployment with " + context.shortId) + " id? (y/n) "), __cb(_, __frame, 15, 31, function ___(__0, __3) { var __2 = !__3; return _(null, __2); }, true)); })(__cb(_, __frame, -146, 17, function ___(__0, __5) { return (function __$__3(__then) { if (__5) { return _(null); } else { __then(); } ; })(function __$__3() {
return scm.doDeploymentPut(context, __cb(_, __frame, 18, 8, function __$__3() {
@@ -171,7 +169,53 @@ exports.init = function(cli) {
- scm.doDeploymentsGet = function scm_doDeploymentsGet__4(context, _) { var maxItems, channel, progress, deployments; var __frame = { name: "scm_doDeploymentsGet__4", line: 174 }; return __func(_, this, arguments, scm_doDeploymentsGet__4, 1, __frame, function __$scm_doDeploymentsGet__4() {
+ scm.command("github [name]").whiteListPowershell().usage("[options] [name]").description("Links a website to a github account for deployment").option("-s, --subscription <id>", "use the subscription id").option("--githubusername <username>", "The github username").option("--githubpassword <password>", "The github password").option("--githubrepository <repository>", "The github repository full name (i.e. user/repository)").execute(function __4(name, options, _) { var context;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ function initializeRemoteRepo(_) { var __frame = { name: "initializeRemoteRepo", line: 211 }; return __func(_, this, arguments, initializeRemoteRepo, 0, __frame, function __$initializeRemoteRepo() {
+ log.silly("InitializeRemoteRepo");
+ return site.doRepositoryPost(context, __cb(_, __frame, 2, 8, function __$initializeRemoteRepo() {
+ return site.ensureRepositoryUri(context, __cb(_, __frame, 3, 8, _, true)); }, true)); }); }; var __frame = { name: "__4", line: 180 }; return __func(_, this, arguments, __4, 2, __frame, function __$__4() { context = { subscription: cli.category("account").lookupSubscriptionId(options.subscription), site: { name: name }, github: { username: options.githubusername, password: options.githubpassword, repositoryFullName: options.githubrepository }, flags: { } }; if (!context.github.repositoryFullName) { context.flags = { forceRepositorySelection: true }; } ; return site.ensureRepositoryUri(context, __cb(_, __frame, 21, 6, function __$__4() { return (function __$__4(__then) { if (!context.repositoryUri) { return initializeRemoteRepo(__cb(_, __frame, 24, 8, __then, true)); } else { __then(); } ; })(function __$__4() { context.lvcClient = linkedRevisionControl.createClient(cli, "github"); return context.lvcClient.init(context, __cb(_, __frame, 28, 6, function __$__4() { return context.lvcClient.deploy(context, __cb(_, __frame, 29, 6, _, true)); }, true)); }); }, true)); }); });
+
+
+
+ scm.doDeploymentsGet = function scm_doDeploymentsGet__5(context, _) { var maxItems, channel, progress, deployments; var __frame = { name: "scm_doDeploymentsGet__5", line: 218 }; return __func(_, this, arguments, scm_doDeploymentsGet__5, 1, __frame, function __$scm_doDeploymentsGet__5() {
maxItems = parseInt(context.maxItems, 10);
if ((!maxItems || (maxItems <= 0))) {
maxItems = 20; } ;
@@ -182,55 +226,55 @@ exports.init = function(cli) {
channel = getScmChannel(context).path("deployments").query("$orderby", "ReceivedTime desc").query("$top", maxItems);
- progress = cli.progress("Enumerating deployments"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$scm_doDeploymentsGet__4() {
+ progress = cli.progress("Enumerating deployments"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$scm_doDeploymentsGet__5() {
return channel.GET(__cb(_, __frame, 13, 44, function ___(__0, __1) { deployments = ensureShortCommitId(__1);
- return cacheUtils.saveCommitIds(context, deployments, __cb(_, __frame, 14, 6, function __$scm_doDeploymentsGet__4() {
- return _(null, deployments.map(formatDeployment)); }, true)); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$scm_doDeploymentsGet__4() {
+ return cacheUtils.saveCommitIds(context, deployments, __cb(_, __frame, 14, 6, function __$scm_doDeploymentsGet__5() {
+ return _(null, deployments.map(formatDeployment)); }, true)); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$scm_doDeploymentsGet__5() {
progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, _); }); }); };
- scm.doDeploymentGet = function scm_doDeploymentGet__5(context, _) { var channel, progress; var __frame = { name: "scm_doDeploymentGet__5", line: 195 }; return __func(_, this, arguments, scm_doDeploymentGet__5, 1, __frame, function __$scm_doDeploymentGet__5() {
+ scm.doDeploymentGet = function scm_doDeploymentGet__6(context, _) { var channel, progress; var __frame = { name: "scm_doDeploymentGet__6", line: 239 }; return __func(_, this, arguments, scm_doDeploymentGet__6, 1, __frame, function __$scm_doDeploymentGet__6() {
channel = getScmChannel(context).path("deployments").path(context.id);
- progress = cli.progress("Retrieving deployment info"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$scm_doDeploymentGet__5() {
+ progress = cli.progress("Retrieving deployment info"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$scm_doDeploymentGet__6() {
- return channel.GET(__cb(_, __frame, 6, 30, function ___(__0, __2) { var __1 = formatDeployment(__2); return _(null, __1); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$scm_doDeploymentGet__5() {
+ return channel.GET(__cb(_, __frame, 6, 30, function ___(__0, __2) { var __1 = formatDeployment(__2); return _(null, __1); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$scm_doDeploymentGet__6() {
progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, _); }); }); };
- scm.doDeploymentPut = function scm_doDeploymentPut__6(context, _) { var channel, progress; var __frame = { name: "scm_doDeploymentPut__6", line: 207 }; return __func(_, this, arguments, scm_doDeploymentPut__6, 1, __frame, function __$scm_doDeploymentPut__6() {
+ scm.doDeploymentPut = function scm_doDeploymentPut__7(context, _) { var channel, progress; var __frame = { name: "scm_doDeploymentPut__7", line: 251 }; return __func(_, this, arguments, scm_doDeploymentPut__7, 1, __frame, function __$scm_doDeploymentPut__7() {
channel = getScmChannel(context).path("deployments").path(context.id);
- progress = cli.progress("Redeploying deployment"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$scm_doDeploymentPut__6() {
+ progress = cli.progress("Redeploying deployment"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$scm_doDeploymentPut__7() {
- return channel.PUT(null, __cb(_, __frame, 6, 13, _, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$scm_doDeploymentPut__6() {
+ return channel.PUT(null, __cb(_, __frame, 6, 13, _, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$scm_doDeploymentPut__7() {
progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, _); }); }); };
- scm.doLogGet = function scm_doLogGet__7(context, _) { var channel, progress, logs; var __frame = { name: "scm_doLogGet__7", line: 219 }; return __func(_, this, arguments, scm_doLogGet__7, 1, __frame, function __$scm_doLogGet__7() {
+ scm.doLogGet = function scm_doLogGet__8(context, _) { var channel, progress, logs; var __frame = { name: "scm_doLogGet__8", line: 263 }; return __func(_, this, arguments, scm_doLogGet__8, 1, __frame, function __$scm_doLogGet__8() {
channel = getScmChannel(context).path("deployments").path(context.id).path("log");
- progress = cli.progress("Retrieving deployment log info"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$scm_doLogGet__7() {
+ progress = cli.progress("Retrieving deployment log info"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$scm_doLogGet__8() {
return channel.GET(__cb(_, __frame, 7, 17, function ___(__0, __1) { logs = __1;
- return _(null, logs.map(formatLog)); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$scm_doLogGet__7() {
+ return _(null, logs.map(formatLog)); }, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$scm_doLogGet__8() {
progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, _); }); }); };
- function listDeployments(context, _) { var deployments, authorLength, messageLength; var __frame = { name: "listDeployments", line: 233 }; return __func(_, this, arguments, listDeployments, 1, __frame, function __$listDeployments() {
+ function listDeployments(context, _) { var deployments, authorLength, messageLength; var __frame = { name: "listDeployments", line: 277 }; return __func(_, this, arguments, listDeployments, 1, __frame, function __$listDeployments() {
return scm.doDeploymentsGet(context, __cb(_, __frame, 1, 22, function ___(__0, __1) { deployments = __1;
authorLength = 0; messageLength = 0;
if ((deployments && deployments.length)) {
@@ -248,13 +292,13 @@ exports.init = function(cli) {
- function getLogDetails(context, _) { var results, logs, progress, i; var __frame = { name: "getLogDetails", line: 251 }; return __func(_, this, arguments, getLogDetails, 1, __frame, function __$getLogDetails() {
+ function getLogDetails(context, _) { var results, logs, progress, i; var __frame = { name: "getLogDetails", line: 295 }; return __func(_, this, arguments, getLogDetails, 1, __frame, function __$getLogDetails() {
return scm.doLogGet(context, __cb(_, __frame, 2, 15, function ___(__0, __2) { logs = __2; return (function __$getLogDetails(__then) {
if ((logs && logs.length)) {
progress = cli.progress("Retrieving log details"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$getLogDetails() {
- return async.map(logs, function __1(log, _) { var details; var __frame = { name: "__1", line: 257 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() { return (function __$__1(__then) {
+ return async.map(logs, function __1(log, _) { var details; var __frame = { name: "__1", line: 301 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() { return (function __$__1(__then) {
if (log.hasDetails) {
@@ -335,20 +379,6 @@ exports.init = function(cli) {
- function ensureRepositoryUri(context, _) { var siteData, repositoryUri; var __frame = { name: "ensureRepositoryUri", line: 338 }; return __func(_, this, arguments, ensureRepositoryUri, 1, __frame, function __$ensureRepositoryUri() {
- return site.lookupSiteNameAndWebSpace(context, __cb(_, __frame, 1, 19, function ___(__0, __1) { siteData = __1;
- repositoryUri = (siteData && site.getRepositoryUri(siteData)); return (function __$ensureRepositoryUri(__then) {
- if (!repositoryUri) {
- return site.doSiteGet(context, __cb(_, __frame, 4, 17, function ___(__0, __2) { siteData = __2;
- repositoryUri = site.getRepositoryUri(siteData); __then(); }, true)); } else { __then(); } ; })(function __$ensureRepositoryUri() {
-
- if (repositoryUri) {
- context.repositoryAuth = site.getRepositoryAuth(siteData);
- return _(null, context.repositoryUri = repositoryUri); } ; _(); }); }, true)); }); };
-
-
- scm.ensureRepositoryUri = ensureRepositoryUri;
-
function formatDeployment(deployment) {
var timeProperties = ["end_time","last_success_end_time","received_time","start_time",];
for (var i = 0; (i < timeProperties.length); ++i) {
View
72 lib/cli/commands/deployment_.js
@@ -13,9 +13,6 @@
* limitations under the License.
*/
-
-//if (!require('streamline/module')(module)) return;
-
var common = require('../common');
var fs = require('fs');
var path = require('path');
@@ -24,11 +21,12 @@ 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');
+var linkedRevisionControl = require('../linkedrevisioncontrol');
+
exports.init = function (cli) {
var log = cli.output;
@@ -80,7 +78,7 @@ exports.init = function (cli) {
}
};
- var repositoryUri = ensureRepositoryUri(context, _);
+ var repositoryUri = site.ensureRepositoryUri(context, _);
if (repositoryUri) {
listDeployments(context, _);
} else {
@@ -107,7 +105,7 @@ exports.init = function (cli) {
return log.error('deployment with ' + commitId + ' does not exist');
}
- var repositoryUri = ensureRepositoryUri(context, _);
+ var repositoryUri = site.ensureRepositoryUri(context, _);
if (repositoryUri) {
var deployment = scm.doDeploymentGet(context, _);
@@ -159,7 +157,7 @@ exports.init = function (cli) {
return log.error('deployment with ' + commitId + ' does not exist');
}
- var repositoryUri = ensureRepositoryUri(context, _);
+ var repositoryUri = site.ensureRepositoryUri(context, _);
if (repositoryUri) {
if (!options.quiet && !site.confirm('Reploy deployment with ' + context.shortId + ' id? (y/n) ', _)) {
return;
@@ -171,6 +169,52 @@ exports.init = function (cli) {
}
});
+ scm.command('github [name]')
+ .whiteListPowershell()
+ .usage('[options] [name]')
+ .description('Links a website to a github account for deployment')
+ .option('-s, --subscription <id>', 'use the subscription id')
+ .option('--githubusername <username>', 'The github username')
+ .option('--githubpassword <password>', 'The github password')
+ .option('--githubrepository <repository>', 'The github repository full name (i.e. user/repository)')
+ .execute(function (name, options, _) {
+ var context = {
+ subscription: cli.category('account').lookupSubscriptionId(options.subscription),
+ site: {
+ name: name
+ },
+ github: {
+ username: options.githubusername,
+ password: options.githubpassword,
+ repositoryFullName: options.githubrepository
+ },
+ flags: { }
+ };
+
+ if (!context.github.repositoryFullName) {
+ // If no explicit github repository URI is passed
+ // this command always prompts the user for a repository
+ context.flags = { forceRepositorySelection: true };
+ }
+
+ // Fetch site and website repository data
+ site.ensureRepositoryUri(context, _);
+ if (!context.repositoryUri) {
+ // If there is no website remote repo, initialize it
+ initializeRemoteRepo(_);
+ }
+
+ context.lvcClient = linkedRevisionControl.createClient(cli, 'github');
+ context.lvcClient.init(context, _);
+ context.lvcClient.deploy(context, _);
+
+ function initializeRemoteRepo(_) {
+ log.silly('InitializeRemoteRepo');
+ site.doRepositoryPost(context, _);
+ site.ensureRepositoryUri(context, _);
+ }
+ });
+
scm.doDeploymentsGet = function (context, _) {
var maxItems = parseInt(context.maxItems, 10);
if (!maxItems || maxItems <= 0) {
@@ -335,20 +379,6 @@ exports.init = function (cli) {
});
}
- function ensureRepositoryUri(context, _) {
- var siteData = site.lookupSiteNameAndWebSpace(context, _);
- var repositoryUri = siteData && site.getRepositoryUri(siteData);
- if (!repositoryUri) {
- siteData = site.doSiteGet(context, _);
- repositoryUri = site.getRepositoryUri(siteData);
- }
- if (repositoryUri) {
- context.repositoryAuth = site.getRepositoryAuth(siteData);
- return context.repositoryUri = repositoryUri;
- }
- }
- scm.ensureRepositoryUri = ensureRepositoryUri;
-
function formatDeployment(deployment) {
var timeProperties = ['end_time', 'last_success_end_time', 'received_time', 'start_time'];
for (var i = 0; i < timeProperties.length; ++i) {
View
194 lib/cli/commands/log.js
@@ -1,113 +1,81 @@
-/*** Generated by streamline 0.3.6 (callbacks) - 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");
-/* 21 */ var path = require("path");
-/* 22 */ var url = require("url");
-/* 23 */ var crypto = require("crypto");
-/* 24 */ var pfx2pem = require("../../util/certificates/pkcs").pfx2pem;
-/* 25 */ var Channel = require("../channel");
-/* 26 */ var async = require("async");
-/* 27 */ var child_process = require("child_process");
-/* 28 */ var utils = require("../utils");
-/* 29 */ var constants = require("../constants");
-/* 30 */ var cacheUtils = require("../cacheUtils");
-/* 32 */ exports.init = function(cli) {
-/* 34 */ var log = cli.output;
-/* 35 */ var site = cli.category("site");
-/* 36 */ var scm = site.category("deployment");
-/* 37 */ var diagnostic = site.category("log").description("Commands to download diagnostic log");
-/* 40 */ diagnostic.command("download [name]").whiteListPowershell().description("Download diagnostic log").option("-s, --subscription <id>", "use the subscription id").option("-o, --output <path>", "output path, default is local folder").execute(function __1(name, options, _) {
- var context, repositoryUri, buf;
- var __frame = {
- name: "__1",
- line: 45
- };
- return __func(_, this, arguments, __1, 2, __frame, function __$__1() {
-/* 46 */ context = {
-/* 47 */ subscription: cli.category("account").lookupSubscriptionId(options.subscription),
-/* 48 */ path: (options.output || ""),
-/* 49 */ site: {
-/* 50 */ name: name
- }
- };
-/* 54 */ if (!(/[.]zip$/i.test(context.path))) {
-/* 55 */ context.path = path.join(context.path, "diagnostics.zip");
- }
- ;
- return (function __$__1(__then) {
-/* 58 */ if (utils.pathExistsSync(context.path)) {
-/* 59 */ return site.confirm((("Replace existing " + context.path) + "? (y/n) "), __cb(_, __frame, 14, 13, function ___(__0, __2) {
-/* 59 */ var __1 = !__2;
- return (function __$__1(__then) {
- if (__1) {
- return _(null);
- }
- else {
- __then();
- }
- ;
- })(__then);
- }, true));
- }
- else {
- __then();
- }
- ;
- })(function __$__1() {
-/* 64 */ return scm.ensureRepositoryUri(context, __cb(_, __frame, 19, 26, function ___(__0, __3) {
- repositoryUri = __3;
- return (function __$__1(__then) {
-/* 65 */ if (repositoryUri) {
-/* 66 */ return doDownloadDiagnostic(context, __cb(_, __frame, 21, 18, function ___(__0, __4) {
- buf = __4;
-/* 67 */ log.info(("Writing to " + context.path));
-/* 68 */ return fs.writeFile(context.path, buf, __cb(_, __frame, 23, 8, __then, true));
- }, true));
- }
- else {
-/* 70 */ log.error("Repository is not setup");
- __then();
- }
- ;
- })(_);
- }, true));
- });
- });
- });
-/* 74 */ function doDownloadDiagnostic(context, _) {
- var channel, progress;
- var __frame = {
- name: "doDownloadDiagnostic",
- line: 74
- };
- return __func(_, this, arguments, doDownloadDiagnostic, 1, __frame, function __$doDownloadDiagnostic() {
-/* 76 */ channel = scm.getScmChannel(context).path("dump");
-/* 77 */ progress = cli.progress("Downloading diagnostic log");
- return (function ___(__then) {
- (function ___(_) {
- __tryCatch(_, function __$doDownloadDiagnostic() {
-/* 79 */ return channel.GET(__cb(_, __frame, 5, 13, _, true));
- });
- })(function ___(__e, __r, __cont) {
- (function ___(__then) {
- __tryCatch(_, function __$doDownloadDiagnostic() {
-/* 81 */ progress.end();
- __then();
- });
- })(function ___() {
- __tryCatch(_, function ___() {
- if (__cont) {
- __then();
- } else {
- _(__e, __r);
- };
- });
- });
- });
- })(function ___() {
- __tryCatch(_, _);
- });
- });
- };
- };
+/*** 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 diagnostic = site.category("log").description("Commands to download diagnostic log");
+
+
+ diagnostic.command("download [name]").whiteListPowershell().description("Download diagnostic log").option("-s, --subscription <id>", "use the subscription id").option("-o, --output <path>", "output path, default is local folder").execute(function __1(name, options, _) { var context, repositoryUri, buf; var __frame = { name: "__1", line: 45 }; return __func(_, this, arguments, __1, 2, __frame, function __$__1() {
+
+
+
+
+
+ context = {
+ subscription: cli.category("account").lookupSubscriptionId(options.subscription),
+ path: (options.output || ""),
+ site: {
+ name: name } };
+
+
+
+ if (!(/[.]zip$/i.test(context.path))) {
+ context.path = path.join(context.path, "diagnostics.zip"); } ; return (function __$__1(__then) {
+
+
+ if (utils.pathExistsSync(context.path)) {
+ return site.confirm((("Replace existing " + context.path) + "? (y/n) "), __cb(_, __frame, 14, 13, function ___(__0, __2) { var __1 = !__2; return (function __$__1(__then) { if (__1) { return _(null); } else { __then(); } ; })(__then); }, true)); } else { __then(); } ; })(function __$__1() {
+
+
+
+
+ return site.ensureRepositoryUri(context, __cb(_, __frame, 19, 26, function ___(__0, __3) { repositoryUri = __3; return (function __$__1(__then) {
+ if (repositoryUri) {
+ return doDownloadDiagnostic(context, __cb(_, __frame, 21, 18, function ___(__0, __4) { buf = __4;
+ log.info(("Writing to " + context.path));
+ return fs.writeFile(context.path, buf, __cb(_, __frame, 23, 8, __then, true)); }, true)); } else {
+
+ log.error("Repository is not setup"); __then(); } ; })(_); }, true)); }); }); });
+
+
+
+ function doDownloadDiagnostic(context, _) { var channel, progress; var __frame = { name: "doDownloadDiagnostic", line: 74 }; return __func(_, this, arguments, doDownloadDiagnostic, 1, __frame, function __$doDownloadDiagnostic() {
+
+ channel = scm.getScmChannel(context).path("dump");
+ progress = cli.progress("Downloading diagnostic log"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$doDownloadDiagnostic() {
+
+ return channel.GET(__cb(_, __frame, 5, 13, _, true)); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$doDownloadDiagnostic() {
+
+ progress.end(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, _); }); }); };};
View
2 lib/cli/commands/log_.js
@@ -61,7 +61,7 @@ exports.init = function (cli) {
}
}
- var repositoryUri = scm.ensureRepositoryUri(context, _);
+ var repositoryUri = site.ensureRepositoryUri(context, _);
if (repositoryUri) {
var buf = doDownloadDiagnostic(context, _);
log.info('Writing to ' + context.path);
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 site.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 site.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 = site.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 = site.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
419 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");
@@ -25,6 +26,9 @@ var child_process = require("child_process");
var utils = require("../utils");
var constants = require("../constants");
var cacheUtils = require("../cacheUtils");
+var js2xml = require("../../util/js2xml");
+
+var linkedRevisionControl = require("../linkedrevisioncontrol");
exports.init = function(cli) {
@@ -67,7 +71,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: 78 }; return __func(_, this, arguments, __1, 1, __frame, function __$__1() {
@@ -109,7 +113,24 @@ exports.init = function(cli) {
site.confirm = confirm;
- site.command("create [name]").whiteListPowershell().description("Create a new web site").option("-s, --subscription <id>", "use the subscription id").option("--location <location>", "the geographic region to create the website").option("--hostname <hostname>", "custom host name to use").option("--git", "configure git on web site and local folder").execute(function __2(nameArg, options, _) { var context;
+ site.command("create [name]").whiteListPowershell().description("Create a new web site").option("-s, --subscription <id>", "use the subscription id").option("--location <location>", "the geographic region to create the website").option("--hostname <hostname>", "custom host name to use").option("--git", "configure git on web site and local folder").option("-pu, --publishingUsername <publishingUsername>", "The publishing username for git").option("--github", "configure github on web site and local folder").option("--githubusername <username>", "The github username").option("--githubpassword <password>", "The github password").option("--githubrepository <repository>", "The github repository full name (i.e. user/repository)").execute(function __2(nameArg, options, _) { var context;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -139,108 +160,93 @@ exports.init = function(cli) {
- function promptForSiteName(_) { var __frame = { name: "promptForSiteName", line: 142 }; 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");
- return prompt("Name: ", __cb(_, __frame, 4, 34, function ___(__0, __1) { context.site.name = __1; __then(); }, true)); } else { __then(); } ; })(_); }); };
- function determineIfSiteExists(_) { var sites, hits; var __frame = { name: "determineIfSiteExists", line: 150 }; 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) {
- return utils.ignoreCaseEquals(item.Name, context.site.name); });
- if ((hits.length === 1)) {
- log.info("Updating existing site");
- context.flags.siteExists = true;
- if ((context.site.webspace === undefined)) {
- context.site.webspace = hits[0].WebSpace;
- log.verbose("Existing site location is ", context.site.webspace); } else {
- if ((context.site.webspace !== hits[0].WebSpace)) {
- return _(new Error(((("Expected location " + context.site.webspace) + " but was ") + hits[0].WebSpace))); } ; } ; } ; _(); }, true)); }); };
- function promptForLocation(_) { var spaces, displayNameMatches; var __frame = { name: "promptForLocation", line: 168 }; 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)) {
- return site.doSpacesGet(context, __cb(_, __frame, 4, 23, function ___(__0, __2) { spaces = __2; __then(); }, true)); } else { __then(); } ; })(function __$promptForLocation() {
- if ((context.site.webspace !== undefined)) {
- 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)) { return _(null); } ; return (function __$promptForLocation(__then) {
+ function promptForSiteName(_) { var __frame = { name: "promptForSiteName", line: 181 }; 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");
+ return prompt("Name: ", __cb(_, __frame, 4, 34, function ___(__0, __1) { context.site.name = __1; __then(); }, true)); } else { __then(); } ; })(_); }); };
- if ((spaces.length === 0)) {
- return portalCreateSiteInstruction(context, __cb(_, __frame, 24, 14, function __$promptForLocation() {
- return _(new Error("First site must be created on portal")); }, true)); } else { return (function __$promptForLocation(__then) {
- if ((spaces.length == 1)) {
- context.site.webspace = spaces[0].Name;
- log.info("Using location", spaces[0].GeoRegion); __then(); } else {
- log.help("Choose a region");
- return choose(spaces.map(function(space) {
- return space.GeoRegion; }), __cb(_, __frame, 31, 45, function ___(__0, __3) { context.site.webspace = spaces[__3].Name; __then(); }, true)); } ; })(__then); } ; })(_); }); }, true)); }); };
+ function determineIfSiteExists(_) { var sites, hits, displayNameMatches; var __frame = { name: "determineIfSiteExists", line: 189 }; 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) {
+ return utils.ignoreCaseEquals(item.Name, context.site.name); }); return (function __$determineIfSiteExists(__then) {
+ if ((hits.length === 1)) {
+ log.info("Updating existing site");
+ context.flags.siteExists = true; return (function __$determineIfSiteExists(__then) {
+ if ((context.site.webspace === undefined)) {
+ context.site.webspace = hits[0].WebSpace;
+ log.verbose("Existing site location is ", context.site.webspace); __then(); } else {
+ return ensureSpaces(context, __cb(_, __frame, 14, 16, function __$determineIfSiteExists() {
- function determineIfCurrentDirectoryIsGitWorkingTree(_) { var isInsideWorkTree, lines; var __frame = { name: "determineIfCurrentDirectoryIsGitWorkingTree", line: 205 }; return __func(_, this, arguments, determineIfCurrentDirectoryIsGitWorkingTree, 0, __frame, function __$determineIfCurrentDirectoryIsGitWorkingTree() {
- log.silly("determineIfCurrentDirectoryIsGitWorkingTree"); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$determineIfCurrentDirectoryIsGitWorkingTree() {
+ displayNameMatches = context.spaces.filter(function(space) { return (space.GeoRegion === context.site.webspace); })[0];
- return exec("git rev-parse --git-dir", __cb(_, __frame, 4, 37, function ___(__0, __1) { isInsideWorkTree = __1;
- lines = (isInsideWorkTree.stdout + isInsideWorkTree.stderr);
- context.flags.isGitWorkingTree = lines.split("\n").some(function(line) {
- return (line === ".git"); }); __then(); }, true)); }); })(function ___(err, __result) { __tryCatch(_, function __$determineIfCurrentDirectoryIsGitWorkingTree() { if (err) {
+ if ((displayNameMatches && (displayNameMatches.Name !== hits[0].WebSpace))) {
+ return _(new Error(((("Expected location " + context.site.webspace) + " but was ") + displayNameMatches.GeoRegion))); } ; __then(); }, true)); } ; })(__then); } else { __then(); } ; })(_); }, true)); }); };
- context.flags.isGitWorkingTree = false; __then(); } else { _(null, __result); } ; }); }); })(function ___() { __tryCatch(_, _); }); }); };
- function initGitOnCurrentDirectory(_) { var __frame = { name: "initGitOnCurrentDirectory", line: 219 }; return __func(_, this, arguments, initGitOnCurrentDirectory, 0, __frame, function __$initGitOnCurrentDirectory() {
- log.silly("initGitOnCurrentDirectoryIfNeeded");
- if (context.flags.isGitWorkingTree) { return _(null); } ;
+ function promptForLocation(_) { var displayNameMatches; var __frame = { name: "promptForLocation", line: 215 }; return __func(_, this, arguments, promptForLocation, 0, __frame, function __$promptForLocation() {
+ log.silly("promptForLocation");
+ return ensureSpaces(context, __cb(_, __frame, 2, 12, function __$promptForLocation() {
+
+ if ((context.site.webspace !== undefined)) {
+
+ displayNameMatches = context.spaces.filter(function(space) {
+ return (space.GeoRegion === context.site.webspace); });
+ if ((displayNameMatches.length === 1)) {
+ context.site.webspace = displayNameMatches[0].Name; } ; } ;
- if (!options.git) { return _(null); } ;
+ if ((context.site.webspace !== undefined)) { return _(null); } ; return (function __$promptForLocation(__then) {
- return site.doPublishingUsersGet(context, __cb(_, __frame, 10, 38, function ___(__0, __1) { context.publishingUsers = __1;
- return getPublishingUser(context, __cb(_, __frame, 11, 37, function ___(__0, __2) { context.publishingUser = __2;
- log.info("Executing `git init`");
- return exec("git init", __cb(_, __frame, 14, 12, function __$initGitOnCurrentDirectory() { return (function __$initGitOnCurrentDirectory(__then) {
- if (!utils.pathExistsSync(".gitignore")) {
- log.info("Creating default .gitignore file");
- return fs.writeFile(".gitignore", "node_modules\nazure_error", __cb(_, __frame, 18, 14, __then, true)); } else { __then(); } ; })(function __$initGitOnCurrentDirectory() {
+ if ((context.spaces.length === 0)) {
+ return portalCreateSiteInstruction(context, __cb(_, __frame, 21, 14, function __$promptForLocation() {
+ return _(new Error("First site must be created on portal")); }, true)); } else { return (function __$promptForLocation(__then) {
+ if ((context.spaces.length == 1)) {
+ context.site.webspace = context.spaces[0].Name;
+ log.info("Using location", context.spaces[0].GeoRegion); __then(); } else {
- context.flags.isGitWorkingTree = true; _(); }); }, true)); }, true)); }, true)); }); };
+ log.help("Choose a region");
+ return choose(context.spaces.map(function(space) {
+ return space.GeoRegion; }), __cb(_, __frame, 28, 53, function ___(__0, __1) { context.site.webspace = context.spaces[__1].Name; __then(); }, true)); } ; })(__then); } ; })(_); }, 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: 249 }; 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 +255,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: 258 }; 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,23 +265,30 @@ exports.init = function(cli) {
- function createSiteAndInitializeRemoteRepo(_) { var __frame = { name: "createSiteAndInitializeRemoteRepo", line: 262 }; return __func(_, this, arguments, createSiteAndInitializeRemoteRepo, 0, __frame, function __$createSiteAndInitializeRemoteRepo() {
- log.silly("createSiteAndInitializeRemoteRepo"); return (function __$createSiteAndInitializeRemoteRepo(__then) {
+ function createSite(_) { var __frame = { name: "createSite", line: 268 }; return __func(_, this, arguments, createSite, 0, __frame, function __$createSite() {
+ log.silly("createSite"); return (function __$createSite(__then) {
+ if (!context.flags.siteExists) {
+ return site.doSitesPost(context, __cb(_, __frame, 3, 14, __then, true)); } else { __then(); } ; })(_); }); };
+
+
+
+ function initializeRemoteRepo(_) { var __frame = { name: "initializeRemoteRepo", line: 275 }; return __func(_, this, arguments, initializeRemoteRepo, 0, __frame, function __$initializeRemoteRepo() {
+ log.silly("InitializeRemoteRepo"); return (function __$initializeRemoteRepo(__then) {
if (!context.flags.siteExists) {
- return site.doSitesPost(context, __cb(_, __frame, 3, 14, function __$createSiteAndInitializeRemoteRepo() {
- return site.doRepositoryPost(context, __cb(_, __frame, 4, 14, function __$createSiteAndInitializeRemoteRepo() {
- return site.doRepositoryGet(context, __cb(_, __frame, 5, 29, function ___(__0, __1) { context.repo = __1; __then(); }, true)); }, true)); }, true)); } else {
+ return site.doRepositoryPost(context, __cb(_, __frame, 3, 14, function __$initializeRemoteRepo() {
+ return site.doRepositoryGet(context, __cb(_, __frame, 4, 29, function ___(__0, __1) { context.repo = __1; __then(); }, true)); }, true)); } else {
- return site.doRepositoryGet(context, __cb(_, __frame, 7, 29, function ___(__0, __2) { context.repo = __2; return (function __$createSiteAndInitializeRemoteRepo(__then) {
+ return site.doRepositoryGet(context, __cb(_, __frame, 6, 29, function ___(__0, __2) { context.repo = __2; return (function __$initializeRemoteRepo(__then) {
if (!context.repo) {
- return site.doRepositoryPost(context, __cb(_, __frame, 9, 16, function __$createSiteAndInitializeRemoteRepo() {
- return site.doRepositoryGet(context, __cb(_, __frame, 10, 31, function ___(__0, __3) { context.repo = __3; __then(); }, true)); }, true)); } else { __then(); } ; })(__then); }, true)); } ; })(function __$createSiteAndInitializeRemoteRepo() {
+ return site.doRepositoryPost(context, __cb(_, __frame, 8, 16, function __$initializeRemoteRepo() {
+ return site.doRepositoryGet(context, __cb(_, __frame, 9, 31, function ___(__0, __3) { context.repo = __3; __then(); }, true)); }, true)); } else { __then(); } ; })(__then); }, true)); } ; })(function __$initializeRemoteRepo() {
+
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: 291 }; 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 +313,20 @@ 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)); }); }); };
+
+
+ function ensureSpaces(context, _) { var __frame = { name: "ensureSpaces", line: 319 }; return __func(_, this, arguments, ensureSpaces, 1, __frame, function __$ensureSpaces() { return (function __$ensureSpaces(__then) {
+ if (!context.spaces) {
+ return cacheUtils.readSpaces(context, __cb(_, __frame, 2, 31, function ___(__0, __1) { context.spaces = __1; return (function __$ensureSpaces(__then) {
+ if ((!context.spaces || !context.spaces.length)) {
+ return site.doSpacesGet(context, __cb(_, __frame, 4, 33, function ___(__0, __2) { context.spaces = __2; __then(); }, true)); } else { __then(); } ; })(__then); }, true)); } else { __then(); } ; })(_); }); }; var __frame = { name: "__2", line: 128 }; 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 }, publishingUser: options.publishingUsername, github: { username: options.githubusername, password: options.githubpassword, repositoryFullName: options.githubrepository }, flags: { } }; if ((options.git && options.github)) { return _(new Error("Please run the command with either --git or --github options. Not both.")); } ; return promptForSiteName(__cb(_, __frame, 23, 10, function __$__2() { return determineIfSiteExists(__cb(_, __frame, 24, 10, function __$__2() { return promptForLocation(__cb(_, __frame, 25, 10, function __$__2() { return createSite(__cb(_, __frame, 26, 10, function __$__2() { return (function __$__2(__then) { if ((options.git || options.github)) { if (options.github) { context.lvcClient = linkedRevisionControl.createClient(cli, "github"); } else { if (options.git) { context.lvcClient = linkedRevisionControl.createClient(cli, "git"); } ; } ; return context.lvcClient.init(context, __cb(_, __frame, 36, 12, function __$__2() { return copyIisNodeWhenServerJsPresent(__cb(_, __frame, 39, 12, function __$__2() { return updateLocalConfigWithSiteName(__cb(_, __frame, 40, 12, function __$__2() { return initializeRemoteRepo(__cb(_, __frame, 42, 12, function __$__2() { return (function __$__2(__then) { if (options.git) { return addRemoteToLocalGitRepo(__cb(_, __frame, 45, 14, __then, true)); } else { return (function __$__2(__then) { if (options.github) { return site.ensureRepositoryUri(context, __cb(_, __frame, 47, 14, __then, true)); } else { __then(); } ; })(__then); } ; })(function __$__2() { return context.lvcClient.deploy(context, __cb(_, __frame, 50, 12, __then, true)); }); }, true)); }, true)); }, true)); }, true)); } else { __then(); } ; })(_); }, 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: 329 }; 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 +345,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: 348 }; 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 +363,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: 366 }; 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 +383,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: 389 }; return __func(_, this, arguments, __3, 1, __frame, function __$__3() {
@@ -383,20 +405,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: 412 }; 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: 432 }; return __func(_, this, arguments, __5, 2, __frame, function __$__5() {
@@ -410,14 +439,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, -431, 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: 453 }; return __func(_, this, arguments, __6, 2, __frame, function __$__6() {
@@ -434,32 +463,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: 467 }; 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: 468 }; 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.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: 500 }; return __func(_, this, arguments, lookupSiteName, 1, __frame, function __$lookupSiteName() {
if ((context.site.name !== undefined)) { return _(null); } ;
@@ -480,7 +518,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: 521 }; 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 +532,7 @@ exports.init = function(cli) {
- function lookupSiteNameAndWebSpace(context, _) { var cache; var __frame = { name: "lookupSiteNameAndWebSpace", line: 497