Changing 'waz' to cli internally and azure as the bin name

This commit is contained in:
Louis DeJardin 2012-03-15 17:10:00 -07:00
Родитель 55539ed9f5
Коммит d00559f51b
17 изменённых файлов: 64 добавлений и 65 удалений

7
bin/azure Normal file
Просмотреть файл

@ -0,0 +1,7 @@
#!/usr/bin/env node
var cli = require('../lib/cli/cli');
cli.parse(process.argv);
if (cli.args.length == 0) {
cli.parse(['', '', '-h']);
}

7
bin/azure.js Normal file
Просмотреть файл

@ -0,0 +1,7 @@
var cli = require('../lib/cli/cli');
cli.parse(process.argv);
if (cli.args.length == 0) {
cli.parse(['', '', '-h']);
}

Просмотреть файл

@ -1,7 +0,0 @@
#!/usr/bin/env node
var waz = require('../lib/waz/waz');
waz.parse(process.argv);
if (waz.args.length == 0) {
waz.parse(['', '', '-h']);
}

Просмотреть файл

@ -1,7 +0,0 @@
var waz = require('../lib/waz/waz');
waz.parse(process.argv);
if (waz.args.length == 0) {
waz.parse(['', '', '-h']);
}

Просмотреть файл

Просмотреть файл

@ -8,13 +8,13 @@ var eyes = require('eyes');
var Table = require('easy-table');
var waz = new commander.Command();
waz.output = log;
var cli = new commander.Command();
cli.output = log;
log.setLevel = function (level) {
waz.output.remove(waz.output.transports.Console);
waz.output.add(waz.output.transports.Console, { level: level });
waz.output.cli();
cli.output.remove(cli.output.transports.Console);
cli.output.add(cli.output.transports.Console, { level: level });
cli.output.cli();
};
log.setLevel('info');
@ -115,9 +115,9 @@ function enableNestedCommands(command) {
enableNestedCommands(waz);
enableNestedCommands(cli);
waz.helpInformation = rootHelpInformation;
cli.helpInformation = rootHelpInformation;
commander.Command.prototype.helpInformation = commandHelpInformation;
commander.Command.prototype.fullName = function () {
var name = this.name;
@ -202,7 +202,7 @@ for (var i = 0; i < commandFiles.length; i++) {
if (!fs.statSync(commandFile).isFile()) {
continue;
}
require(commandFile).init(waz);
require(commandFile).init(cli);
}
exports = module.exports = waz;
exports = module.exports = cli;

Просмотреть файл

@ -5,11 +5,11 @@ var xml2js = require('xml2js');
var assert = require('assert');
var pfx2pem = require('../../util/certificates/pkcs').pfx2pem;
exports.init = function (waz) {
exports.init = function (cli) {
var log = waz.output;
var log = cli.output;
var account = waz.category('account')
var account = cli.category('account')
.description('Manage your account information and publish settings.');
@ -24,7 +24,7 @@ exports.init = function (waz) {
.action(function (publishSettingsFile) {
log.info('Importing publish settings file', publishSettingsFile);
var wazPath = path.join(process.env.HOME, '.waz');
var wazPath = path.join(process.env.HOME, '.azure');
var wazPublishSettingsFilePath = path.join(wazPath, 'publishSettings.xml');
var wazManagementCertificatePfxFilePath = path.join(wazPath, 'managementCertificate.pfx');
var wazManagementCertificatePemFilePath = path.join(wazPath, 'managementCertificate.pem');
@ -122,7 +122,7 @@ exports.init = function (waz) {
account.readConfig = function () {
var wazPath = path.join(process.env.HOME, '.waz');
var wazPath = path.join(process.env.HOME, '.azure');
var wazConfigPath = path.join(wazPath, 'config.json');
var config = {};
log.silly('Reading config', wazConfigPath);
@ -139,7 +139,7 @@ exports.init = function (waz) {
};
account.writeConfig = function (config) {
var wazPath = path.join(process.env.HOME, '.waz');
var wazPath = path.join(process.env.HOME, '.azure');
var wazConfigPath = path.join(wazPath, 'config.json');
log.silly('Writing config', wazConfigPath);
fs.writeFileSync(wazConfigPath, JSON.stringify(config));
@ -150,7 +150,7 @@ exports.init = function (waz) {
};
account.managementCertificate = function () {
var wazPath = path.join(process.env.HOME, '.waz');
var wazPath = path.join(process.env.HOME, '.azure');
var wazManagementCertificateFilePath = path.join(wazPath, 'managementCertificate.pem');
log.silly('Reading cert', wazManagementCertificateFilePath);
return fs.readFileSync(wazManagementCertificateFilePath);

Просмотреть файл

@ -1,18 +1,17 @@
exports.init = function (waz) {
exports.init = function (cli) {
waz
.command('help [command]')
cli.command('help [command]')
.description('Display help for a given command')
.action(function (name, a, b, c) {
if (!name) {
var args = ['', '', '-h'];
waz.parse(args);
} else if (!waz.categories[name]) {
cli.parse(args);
} else if (!cli.categories[name]) {
throw new Error("Unknown command name " + name)
} else {
var args = ['', ''].concat(waz.rawArgs.slice(4), ['-h']);
waz.categories[name].parse(args);
var args = ['', ''].concat(cli.rawArgs.slice(4), ['-h']);
cli.categories[name].parse(args);
}
});

Просмотреть файл

@ -3,9 +3,9 @@ var fs = require('fs');
var pfx2pem = require('../../util/certificates/pkcs').pfx2pem;
var Channel = require('../channel');
exports.init = function (waz) {
exports.init = function (cli) {
var deploy = waz.category('site').category('deploy')
var deploy = cli.category('site').category('deploy')
.description('Manage site deployments.');
deploy.command('list')

Просмотреть файл

@ -3,15 +3,15 @@ var fs = require('fs');
var pfx2pem = require('../../util/certificates/pkcs').pfx2pem;
var Channel = require('../channel');
exports.init = function (waz) {
exports.init = function (cli) {
var log = waz.output;
var log = cli.output;
function getChannel() {
var pem = waz.category('account').managementCertificate();
var pem = cli.category('account').managementCertificate();
var channel = new Channel({
host: 'umapi-new.rdfetest.dnsdemo4.com',
host: 'umapi-tc2.rdfetest.dnsdemo4.com',
port: 8443,
key: pem,
cert: pem
@ -20,7 +20,7 @@ exports.init = function (waz) {
return channel;
}
var site = waz.category('site')
var site = cli.category('site')
.description('Commands to manage your web sites.');
site.command('sample')
@ -55,7 +55,7 @@ exports.init = function (waz) {
.action(function (options) {
var subscription = options.subscription || waz.category('account').defaultSubscriptionId();
var subscription = options.subscription || cli.category('account').defaultSubscriptionId();
log.info('Listing your web sites');
log.verbose('Subscription ', subscription);
@ -89,7 +89,7 @@ exports.init = function (waz) {
.action(function (name, options) {
var parameters = {
subscription: options.subscription || waz.category('account').defaultSubscriptionId(),
subscription: options.subscription || cli.category('account').defaultSubscriptionId(),
site: {
name: name
}
@ -117,7 +117,7 @@ exports.init = function (waz) {
.action(function (name, options) {
var parameters = {
subscription: options.subscription || waz.category('account').defaultSubscriptionId(),
subscription: options.subscription || cli.category('account').defaultSubscriptionId(),
site: {
name: name,
location: options.location,
@ -146,7 +146,7 @@ exports.init = function (waz) {
.option('-s, --subscription <id>', 'use the subscription id')
.action(function (name, options) {
var subscription = options.subscription || waz.category('account').defaultSubscriptionId();
var subscription = options.subscription || cli.category('account').defaultSubscriptionId();
getChannel()
.path(subscription)
@ -163,7 +163,7 @@ exports.init = function (waz) {
.option('-s, --subscription <id>', 'use the subscription id')
.action(function (name, options) {
var subscription = options.subscription || waz.category('account').defaultSubscriptionId();
var subscription = options.subscription || cli.category('account').defaultSubscriptionId();
getChannel()
.path(subscription)
@ -188,7 +188,7 @@ exports.init = function (waz) {
.option('-s, --subscription <id>', 'use the subscription id')
.action(function (name, options) {
var subscription = options.subscription || waz.category('account').defaultSubscriptionId();
var subscription = options.subscription || cli.category('account').defaultSubscriptionId();
getChannel()
.path(subscription)

Просмотреть файл

@ -43,6 +43,6 @@
"extendedtests": "node test/runextendedtests.js"
},
"bin": {
"waz": "./bin/waz"
"azure": "./bin/azure"
}
}

Просмотреть файл

@ -1,17 +1,17 @@
require('should');
var waz = require('./waz');
var cli = require('./cli');
var capture = require('./util').capture;
suite('waz', function(){
suite('cli', function(){
suite('account', function() {
suite('import', function() {
test('should launch browser when there is no file name', function(done) {
var result = capture(function() {
waz.parse('node waz.js account import'.split(' '));
var result = capture(function() {
cli.parse('node cli.js account import'.split(' '));
});
done();

Просмотреть файл

@ -1,15 +1,15 @@
require('should');
var waz = require('./waz');
var capture = require('./util').capture;
suite('waz', function(){
var cli = require('./cli');
var capture = require('./util').capture;
suite('cli', function () {
suite('help', function() {
test('should display help with -h option', function(done) {
var result = capture(function() {
waz.parse('node waz.js -h'.split(' '));
var result = capture(function() {
cli.parse('node cli.js -h'.split(' '));
});
result.text.should.include('Usage:');

1
test/cli/cli.js Normal file
Просмотреть файл

@ -0,0 +1 @@
module.exports = require('../../lib/cli/cli.js');

Просмотреть файл

Просмотреть файл

@ -1,9 +1,9 @@
util/certificates/der.decoder-tests.js
util/certificates/der.decoder.pfx.root-tests.js
util/certificates/pkcs.filedecoder-tests.js
waz/waz.help-tests.js
waz/waz.account-tests.js
waz/waz.site-tests.js
cli/cli.help-tests.js
cli/cli.account-tests.js
cli/cli.site-tests.js
services/blob/blobservice-tests.js
services/blob/sharedaccesssignature-tests.js
services/blob/sharedkey-tests.js

Просмотреть файл

@ -1 +0,0 @@
module.exports = require('../../lib/waz/waz.js');