diff --git a/lib/cli/commands/site-deploy.js b/lib/cli/commands/site-deploy.js index 728895526..ca900a6d8 100644 --- a/lib/cli/commands/site-deploy.js +++ b/lib/cli/commands/site-deploy.js @@ -3,43 +3,49 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= /* 1 */ var url = require("url"); /* 3 */ var querystring = require("querystring"); /* 4 */ var Channel = require("../channel"); -/* 6 */ return; /* 8 */ var child_process = require("child_process"); /* 10 */ exports.init = function(cli) { /* 11 */ var log = cli.output; /* 12 */ var site = cli.category("site"); -/* 14 */ var deploy = site.command("push ").description("Publish the current directory as web site via git").option("-s, --subscription ", "use the subscription id").execute(function __1(name, options, _) { - var context, siteConfig, repositoryData, repositoryUrl; +/* 14 */ var deploy = site.command("push [name]").description("Publish the current directory as web site via git").option("-s, --subscription ", "use the subscription id").execute(function __1(name, options, _) { + var context, siteConfig, repositoryData, repositoryUrl, out; var __frame = { name: "__1", line: 17 }; return __func(_, this, arguments, __1, 2, __frame, function __$__1() { -/* 19 */ log.json(url.parse("http://a:b@c.com/d?e#f")); /* 21 */ context = { /* 22 */ subscription: cli.category("account").lookupSubscriptionId(options.subscription), /* 23 */ site: { /* 24 */ name: name } }; -/* 28 */ return site.lookupSiteWebSpace(context, __cb(_, __frame, 11, 12, function __$__1() { -/* 29 */ return site.doSiteConfigGet(context, __cb(_, __frame, 12, 29, function ___(__0, __1) { - siteConfig = __1; -/* 30 */ return site.doRepositoryGet(context, __cb(_, __frame, 13, 33, function ___(__0, __2) { - repositoryData = __2; -/* 31 */ repositoryUrl = url.parse(repositoryData); -/* 33 */ repositoryUrl.pathname = (name + ".git"); -/* 34 */ repositoryUrl.auth = ((querystring.escape(("$" + name)) + ":") + querystring.escape(siteConfig.PublishingPassword)); -/* 35 */ repositoryUrl.protocol = "http:"; -/* 36 */ delete repositoryUrl.host; -/* 37 */ log.json(url.format(repositoryUrl)); -/* 39 */ log.json(siteConfig); -/* 40 */ log.json(repositoryData); -/* 41 */ log.json(repositoryUrl); - _(); +/* 27 */ return site.lookupSiteName(context, __cb(_, __frame, 10, 12, function __$__1() { +/* 28 */ return site.lookupSiteWebSpace(context, __cb(_, __frame, 11, 12, function __$__1() { +/* 29 */ return site.doSiteConfigGet(context, __cb(_, __frame, 12, 29, function ___(__0, __1) { + siteConfig = __1; +/* 30 */ return site.doRepositoryGet(context, __cb(_, __frame, 13, 33, function ___(__0, __2) { + repositoryData = __2; +/* 31 */ repositoryUrl = url.parse(repositoryData); +/* 33 */ repositoryUrl.pathname = (name + ".git"); +/* 34 */ repositoryUrl.auth = ((querystring.escape(("$" + name)) + ":") + querystring.escape(siteConfig.PublishingPassword)); +/* 35 */ repositoryUrl.protocol = "http:"; +/* 36 */ delete repositoryUrl.host; +/* 43 */ return exec((("git push " + url.format(repositoryUrl)) + " HEAD:master"), __cb(_, __frame, 26, 22, function ___(__0, __3) { + out = __3; +/* 44 */ log.data(out); + _(); + })); + })); })); })); })); }); }); +/* 47 */ function exec(cmd, cb) { +/* 48 */ child_process.exec(cmd, function(err, stdout, stderr) { +/* 49 */ log.info("Executing", cmd); +/* 50 */ cb(err, (stdout + stderr)); + }); + }; }; diff --git a/lib/cli/commands/site-deploy_.js b/lib/cli/commands/site-deploy_.js index e578acb71..68d2ca2cd 100644 --- a/lib/cli/commands/site-deploy_.js +++ b/lib/cli/commands/site-deploy_.js @@ -3,20 +3,20 @@ var url = require('url'); var querystring = require('querystring'); var Channel = require('../channel'); -return; + var child_process = require('child_process'); exports.init = function (cli) { var log = cli.output; var site = cli.category('site'); - - var deploy = site.command('push ') + + var deploy = site.command('push [name]') .description('Publish the current directory as web site via git') .option('-s, --subscription ', 'use the subscription id') .execute(function (name, options, _) { - log.json(url.parse('http://a:b@c.com/d?e#f')); + // log.json(url.parse('http://a:b@c.com/d?e#f')); var context = { subscription: cli.category('account').lookupSubscriptionId(options.subscription), @@ -24,7 +24,7 @@ exports.init = function (cli) { name: name } }; - + site.lookupSiteName(context, _); site.lookupSiteWebSpace(context, _); var siteConfig = site.doSiteConfigGet(context, _); var repositoryData = site.doRepositoryGet(context, _); @@ -34,13 +34,23 @@ exports.init = function (cli) { repositoryUrl.auth = querystring.escape('$' + name) + ':' + querystring.escape(siteConfig.PublishingPassword); repositoryUrl.protocol = 'http:'; delete repositoryUrl.host; - log.json(url.format(repositoryUrl)); +// log.json(url.format(repositoryUrl)); - log.json(siteConfig); - log.json(repositoryData); - log.json(repositoryUrl); +// log.json(siteConfig); +// log.json(repositoryData); +// log.json(repositoryUrl); + + var out = exec('git push ' + url.format(repositoryUrl) + ' HEAD:master', _); + log.data(out); }); + function exec(cmd, cb) { + child_process.exec(cmd, function (err, stdout, stderr) { + log.info('Executing', cmd); + cb(err, stdout + stderr); + }); + } + // deploy.command('list') // .description('Show deployment history') // .action(function () { }); diff --git a/lib/cli/commands/site.js b/lib/cli/commands/site.js index b7bf56414..313956a38 100644 --- a/lib/cli/commands/site.js +++ b/lib/cli/commands/site.js @@ -68,7 +68,7 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= }); /* 80 */ function choose(data, callback) { /* 81 */ cli.choose(data, function(x) { -/* 81 */ callback(null, x); +/* 81 */ callback(undefined, x); }); }; /* 84 */ site.command("create [name]").description("Create a new web site and local directory.").option("-s, --subscription ", "use the subscription id").option("--location ", "the geographic region to create the website").option("--hostname ", "custom host name to use").execute(function __2(nameArg, options, _) { @@ -88,7 +88,7 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= }; /* 99 */ cfg = site.readConfig(); return (function __$__2(__then) { -/* 100 */ if ((cfg == null)) { +/* 100 */ if ((cfg === undefined)) { return (function __$__2(__then) { /* 101 */ if ((context.site.name === undefined)) { /* 102 */ log.help("Need a site name"); @@ -403,11 +403,11 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= /* 358 */ try { /* 359 */ var parentFolder = path.dirname(scanFolder); /* 360 */ if (((parentFolder === scanFolder) || !path.exists(scanFolder))) { -/* 361 */ return null; +/* 361 */ return undefined; } ; /* 364 */ } catch (err) { -/* 365 */ return null; +/* 365 */ return undefined; }; }; }; @@ -429,7 +429,7 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= /* 385 */ var configPath = site.findConfig(); /* 386 */ if ((configPath === undefined)) { /* 387 */ log.verbose("No site .azure/*.config file locate at current directory"); -/* 388 */ return null; +/* 388 */ return undefined; } ; /* 391 */ log.silly("Reading file", configPath); @@ -442,7 +442,7 @@ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename),__func= /* 399 */ var configPath = site.findConfig(); /* 400 */ if ((configPath === undefined)) { /* 401 */ log.verbose("No site .azure/*.config file locate at current directory"); -/* 402 */ return null; +/* 402 */ return undefined; } ; /* 404 */ log.silly("Writing file", configPath); diff --git a/lib/cli/commands/site_.js b/lib/cli/commands/site_.js index c38b8faf4..11adecc92 100644 --- a/lib/cli/commands/site_.js +++ b/lib/cli/commands/site_.js @@ -78,7 +78,7 @@ exports.init = function (cli) { }); function choose(data, callback) { - cli.choose(data, function (x) { callback(null, x); }); + cli.choose(data, function (x) { callback(undefined, x); }); } site.command('create [name]') @@ -97,7 +97,7 @@ exports.init = function (cli) { }; var cfg = site.readConfig(); - if (cfg == null) { + if (cfg === undefined) { if (context.site.name === undefined) { log.help('Need a site name'); context.site.name = cli.prompt('Name: ', _); @@ -358,11 +358,11 @@ exports.init = function (cli) { try { var parentFolder = path.dirname(scanFolder); if (parentFolder === scanFolder || !path.exists(scanFolder)) { - return null; + return undefined; } } catch (err) { - return null; + return undefined; } } }; @@ -385,7 +385,7 @@ exports.init = function (cli) { var configPath = site.findConfig(); if (configPath === undefined) { log.verbose('No site .azure/*.config file locate at current directory'); - return null; + return undefined; } log.silly('Reading file', configPath); @@ -399,7 +399,7 @@ exports.init = function (cli) { var configPath = site.findConfig(); if (configPath === undefined) { log.verbose('No site .azure/*.config file locate at current directory'); - return null; + return undefined; } log.silly('Writing file', configPath); var configText = JSON.stringify(config);