joyentcloud name picked
This commit is contained in:
parent
120f3198cf
commit
5b2e74d09f
@ -1 +1 @@
|
|||||||
# joyent CLI Changelog
|
# node-joyentcloud CLI Changelog
|
||||||
|
4
Makefile
4
Makefile
@ -1,13 +1,13 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2014, Joyent, Inc. All rights reserved.
|
# Copyright (c) 2014, Joyent, Inc. All rights reserved.
|
||||||
#
|
#
|
||||||
# Makefile for joyent/joyent
|
# Makefile for node-joyentcloud
|
||||||
#
|
#
|
||||||
|
|
||||||
#
|
#
|
||||||
# Vars, Tools, Files, Flags
|
# Vars, Tools, Files, Flags
|
||||||
#
|
#
|
||||||
JS_FILES := bin/joyent \
|
JS_FILES := bin/joyentcloud \
|
||||||
$(shell find lib -name '*.js' | grep -v '/tmp/')
|
$(shell find lib -name '*.js' | grep -v '/tmp/')
|
||||||
JSL_CONF_NODE = tools/jsl.node.conf
|
JSL_CONF_NODE = tools/jsl.node.conf
|
||||||
JSL_FILES_NODE = $(JS_FILES)
|
JSL_FILES_NODE = $(JS_FILES)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014 Joyent Inc. All rights reserved.
|
* Copyright (c) 2014 Joyent Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* joyent - Joyent public cloud (https://my.joyentcloud.com/) CLI
|
* joyentcloud
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var p = console.log;
|
var p = console.log;
|
16
lib/cli.js
16
lib/cli.js
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014 Joyent Inc. All rights reserved.
|
* Copyright (c) 2014 Joyent Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* The 'joyent' CLI class.
|
* The 'joyentcloud' CLI class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var p = console.log;
|
var p = console.log;
|
||||||
@ -21,14 +21,14 @@ var cmdln = require('cmdln'),
|
|||||||
Cmdln = cmdln.Cmdln;
|
Cmdln = cmdln.Cmdln;
|
||||||
|
|
||||||
var common = require('./common');
|
var common = require('./common');
|
||||||
var Joyent = require('./joyent');
|
var JoyentCloud = require('./joyentcloud');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---- globals
|
//---- globals
|
||||||
|
|
||||||
var pkg = require('../package.json');
|
var pkg = require('../package.json');
|
||||||
var name = 'joyent';
|
var name = 'joyentcloud';
|
||||||
var log = bunyan.createLogger({
|
var log = bunyan.createLogger({
|
||||||
name: name,
|
name: name,
|
||||||
serializers: bunyan.stdSerializers,
|
serializers: bunyan.stdSerializers,
|
||||||
@ -68,14 +68,14 @@ CLI.prototype.init = function (opts, args, callback) {
|
|||||||
}
|
}
|
||||||
this.opts = opts;
|
this.opts = opts;
|
||||||
if (opts.verbose) {
|
if (opts.verbose) {
|
||||||
process.env.DEBUG = 1; //TODO This is a lame requirement of cmdln.main().
|
process.env.DEBUG = 1; //TODO This is a lame req of cmdln.main().
|
||||||
log.level('trace');
|
log.level('trace');
|
||||||
log.src = true;
|
log.src = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.__defineGetter__('joyent', function () {
|
this.__defineGetter__('joyent', function () {
|
||||||
if (self._joyent === undefined) {
|
if (self._joyent === undefined) {
|
||||||
self._joyent = new Joyent({log: log});
|
self._joyent = new JoyentCloud({log: log});
|
||||||
}
|
}
|
||||||
return self._joyent;
|
return self._joyent;
|
||||||
});
|
});
|
||||||
@ -199,14 +199,16 @@ CLI.prototype.do_machines = function (subcmd, opts, args, callback) {
|
|||||||
if (opts.json) {
|
if (opts.json) {
|
||||||
p(JSON.stringify(machines, null, 4));
|
p(JSON.stringify(machines, null, 4));
|
||||||
} else {
|
} else {
|
||||||
|
/* BEGIN JSSTYLED */
|
||||||
// TODO: get short output down to something like
|
// TODO: get short output down to something like
|
||||||
// 'us-west-1 e91897cf testforyunong2 linux running 2013-11-08'
|
// 'us-west-1 e91897cf testforyunong2 linux running 2013-11-08'
|
||||||
// 'us-west-1 e91897cf testforyunong2 ubuntu/13.3.0 running 2013-11-08'
|
// 'us-west-1 e91897cf testforyunong2 ubuntu/13.3.0 running 2013-11-08'
|
||||||
|
/* END JSSTYLED */
|
||||||
common.tabulate(machines, {
|
common.tabulate(machines, {
|
||||||
//columns: 'dc,id,name,type,state,created,image,package,memory,disk',
|
|
||||||
columns: 'dc,id,name,state,created',
|
columns: 'dc,id,name,state,created',
|
||||||
sort: 'created',
|
sort: 'created',
|
||||||
validFields: 'dc,id,name,type,state,image,package,memory,disk,created,updated,compute_node,primaryIp'
|
validFields: 'dc,id,name,type,state,image,package,memory,'
|
||||||
|
+ 'disk,created,updated,compute_node,primaryIp'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, Joyent, Inc. All rights reserved.
|
* Copyright (c) 2014, Joyent, Inc. All rights reserved.
|
||||||
*
|
*
|
||||||
* Core Joyent driver class.
|
* Core JoyentCloud driver class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var p = console.log;
|
var p = console.log;
|
||||||
@ -17,21 +17,20 @@ var loadConfigSync = require('./config').loadConfigSync;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---- Joyent class
|
//---- JoyentCloud class
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Joyent.
|
* Create a JoyentCloud client.
|
||||||
*
|
*
|
||||||
* @param options {Object}
|
* @param options {Object}
|
||||||
* - log {Bunyan Logger}
|
* - log {Bunyan Logger}
|
||||||
* - profile {String} Optional. Name of profile to use. Defaults to
|
* - profile {String} Optional. Name of profile to use. Defaults to
|
||||||
* 'defaultProfile' in the config.
|
* 'defaultProfile' in the config.
|
||||||
*/
|
*/
|
||||||
function Joyent(options) {
|
function JoyentCloud(options) {
|
||||||
assert.object(options, 'options');
|
assert.object(options, 'options');
|
||||||
assert.object(options.log, 'options.log');
|
assert.object(options.log, 'options.log');
|
||||||
assert.optionalString(options.profile, 'options.profile');
|
assert.optionalString(options.profile, 'options.profile');
|
||||||
var self = this;
|
|
||||||
|
|
||||||
this.config = loadConfigSync();
|
this.config = loadConfigSync();
|
||||||
this.profiles = this.config.profiles;
|
this.profiles = this.config.profiles;
|
||||||
@ -43,7 +42,8 @@ function Joyent(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Joyent.prototype.setDefaultProfile = function setDefaultProfile(name, callback) {
|
JoyentCloud.prototype.setDefaultProfile =
|
||||||
|
function setDefaultProfile(name, callback) {
|
||||||
if (!this.getProfile(name)) {
|
if (!this.getProfile(name)) {
|
||||||
return callback(new Error('no such profile: ' + name));
|
return callback(new Error('no such profile: ' + name));
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ Joyent.prototype.setDefaultProfile = function setDefaultProfile(name, callback)
|
|||||||
callback();
|
callback();
|
||||||
};
|
};
|
||||||
|
|
||||||
Joyent.prototype.getProfile = function getProfile(name) {
|
JoyentCloud.prototype.getProfile = function getProfile(name) {
|
||||||
for (var i = 0; i < this.profiles.length; i++) {
|
for (var i = 0; i < this.profiles.length; i++) {
|
||||||
if (this.profiles[i].name === name) {
|
if (this.profiles[i].name === name) {
|
||||||
return this.profiles[i];
|
return this.profiles[i];
|
||||||
@ -68,16 +68,16 @@ Joyent.prototype.getProfile = function getProfile(name) {
|
|||||||
* - setDefault {Boolean}
|
* - setDefault {Boolean}
|
||||||
* @param callback {Function} `function (err)`
|
* @param callback {Function} `function (err)`
|
||||||
*/
|
*/
|
||||||
Joyent.prototype.createOrUpdateProfile = function createOrUpdateProfile(
|
JoyentCloud.prototype.createOrUpdateProfile = function createOrUpdateProfile(
|
||||||
profile, options, callback) {
|
profile, options, callback) {
|
||||||
assert.object(profile, 'profile');
|
assert.object(profile, 'profile');
|
||||||
if (typeof (options) === 'function') {
|
if (typeof (options) === 'function') {
|
||||||
callback = options;
|
callback = options;
|
||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
assert.object(options, 'options')
|
assert.object(options, 'options');
|
||||||
assert.optionalBool(options.setDefault, 'options.setDefault')
|
assert.optionalBool(options.setDefault, 'options.setDefault');
|
||||||
assert.func(callback, 'callback')
|
assert.func(callback, 'callback');
|
||||||
|
|
||||||
var found = false;
|
var found = false;
|
||||||
for (var i = 0; i < this.profiles.length; i++) {
|
for (var i = 0; i < this.profiles.length; i++) {
|
||||||
@ -96,7 +96,7 @@ Joyent.prototype.createOrUpdateProfile = function createOrUpdateProfile(
|
|||||||
callback();
|
callback();
|
||||||
};
|
};
|
||||||
|
|
||||||
Joyent.prototype.deleteProfile = function deleteProfile(name, callback) {
|
JoyentCloud.prototype.deleteProfile = function deleteProfile(name, callback) {
|
||||||
var found = false;
|
var found = false;
|
||||||
for (var i = 0; i < this.profiles.length; i++) {
|
for (var i = 0; i < this.profiles.length; i++) {
|
||||||
if (this.profiles[i].name === name) {
|
if (this.profiles[i].name === name) {
|
||||||
@ -115,7 +115,7 @@ Joyent.prototype.deleteProfile = function deleteProfile(name, callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Joyent.prototype._clientFromDc = function _clientFromDc(dc) {
|
JoyentCloud.prototype._clientFromDc = function _clientFromDc(dc) {
|
||||||
assert.string(dc, 'dc');
|
assert.string(dc, 'dc');
|
||||||
|
|
||||||
if (!this._clientFromDcCache) {
|
if (!this._clientFromDcCache) {
|
||||||
@ -159,11 +159,11 @@ Joyent.prototype._clientFromDc = function _clientFromDc(dc) {
|
|||||||
* - {Function} onDcError `function (dc, err)` called for each DC client
|
* - {Function} onDcError `function (dc, err)` called for each DC client
|
||||||
* error.
|
* error.
|
||||||
*/
|
*/
|
||||||
Joyent.prototype.listMachines = function listMachines(options, callback) {
|
JoyentCloud.prototype.listMachines = function listMachines(options, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
if (callback === undefined) {
|
if (callback === undefined) {
|
||||||
callback = options;
|
callback = options;
|
||||||
options = {}
|
options = {};
|
||||||
}
|
}
|
||||||
assert.object(options, 'options');
|
assert.object(options, 'options');
|
||||||
assert.optionalFunc(options.onDcError, 'options.onDcError');
|
assert.optionalFunc(options.onDcError, 'options.onDcError');
|
||||||
@ -198,4 +198,4 @@ Joyent.prototype.listMachines = function listMachines(options, callback) {
|
|||||||
|
|
||||||
//---- exports
|
//---- exports
|
||||||
|
|
||||||
module.exports = Joyent;
|
module.exports = JoyentCloud;
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "joyent",
|
"name": "joyentcloud",
|
||||||
"description": "Joyent Public Cloud CLI (https://my.joyentcloud.com/)",
|
"description": "Joyent Compute Service CLI (http://www.joyent.com/products/compute-service)",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"author": "Joyent (joyent.com)",
|
"author": "Joyent (joyent.com)",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
Reference in New Issue
Block a user