joyentcloud name picked

This commit is contained in:
Trent Mick 2014-02-07 16:49:07 -08:00
parent 120f3198cf
commit 5b2e74d09f
6 changed files with 32 additions and 30 deletions

View File

@ -1 +1 @@
# joyent CLI Changelog
# node-joyentcloud CLI Changelog

View File

@ -1,13 +1,13 @@
#
# Copyright (c) 2014, Joyent, Inc. All rights reserved.
#
# Makefile for joyent/joyent
# Makefile for node-joyentcloud
#
#
# Vars, Tools, Files, Flags
#
JS_FILES := bin/joyent \
JS_FILES := bin/joyentcloud \
$(shell find lib -name '*.js' | grep -v '/tmp/')
JSL_CONF_NODE = tools/jsl.node.conf
JSL_FILES_NODE = $(JS_FILES)

View File

@ -2,7 +2,7 @@
/*
* Copyright (c) 2014 Joyent Inc. All rights reserved.
*
* joyent - Joyent public cloud (https://my.joyentcloud.com/) CLI
* joyentcloud
*/
var p = console.log;

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2014 Joyent Inc. All rights reserved.
*
* The 'joyent' CLI class.
* The 'joyentcloud' CLI class.
*/
var p = console.log;
@ -21,14 +21,14 @@ var cmdln = require('cmdln'),
Cmdln = cmdln.Cmdln;
var common = require('./common');
var Joyent = require('./joyent');
var JoyentCloud = require('./joyentcloud');
//---- globals
var pkg = require('../package.json');
var name = 'joyent';
var name = 'joyentcloud';
var log = bunyan.createLogger({
name: name,
serializers: bunyan.stdSerializers,
@ -68,14 +68,14 @@ CLI.prototype.init = function (opts, args, callback) {
}
this.opts = opts;
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.src = true;
}
this.__defineGetter__('joyent', function () {
if (self._joyent === undefined) {
self._joyent = new Joyent({log: log});
self._joyent = new JoyentCloud({log: log});
}
return self._joyent;
});
@ -199,14 +199,16 @@ CLI.prototype.do_machines = function (subcmd, opts, args, callback) {
if (opts.json) {
p(JSON.stringify(machines, null, 4));
} else {
/* BEGIN JSSTYLED */
// TODO: get short output down to something like
// 'us-west-1 e91897cf testforyunong2 linux running 2013-11-08'
// 'us-west-1 e91897cf testforyunong2 ubuntu/13.3.0 running 2013-11-08'
/* END JSSTYLED */
common.tabulate(machines, {
//columns: 'dc,id,name,type,state,created,image,package,memory,disk',
columns: 'dc,id,name,state,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();

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2014, Joyent, Inc. All rights reserved.
*
* Core Joyent driver class.
* Core JoyentCloud driver class.
*/
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}
* - log {Bunyan Logger}
* - profile {String} Optional. Name of profile to use. Defaults to
* 'defaultProfile' in the config.
*/
function Joyent(options) {
function JoyentCloud(options) {
assert.object(options, 'options');
assert.object(options.log, 'options.log');
assert.optionalString(options.profile, 'options.profile');
var self = this;
this.config = loadConfigSync();
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)) {
return callback(new Error('no such profile: ' + name));
}
@ -52,7 +52,7 @@ Joyent.prototype.setDefaultProfile = function setDefaultProfile(name, callback)
callback();
};
Joyent.prototype.getProfile = function getProfile(name) {
JoyentCloud.prototype.getProfile = function getProfile(name) {
for (var i = 0; i < this.profiles.length; i++) {
if (this.profiles[i].name === name) {
return this.profiles[i];
@ -68,16 +68,16 @@ Joyent.prototype.getProfile = function getProfile(name) {
* - setDefault {Boolean}
* @param callback {Function} `function (err)`
*/
Joyent.prototype.createOrUpdateProfile = function createOrUpdateProfile(
JoyentCloud.prototype.createOrUpdateProfile = function createOrUpdateProfile(
profile, options, callback) {
assert.object(profile, 'profile');
if (typeof(options) === 'function') {
if (typeof (options) === 'function') {
callback = options;
options = {};
}
assert.object(options, 'options')
assert.optionalBool(options.setDefault, 'options.setDefault')
assert.func(callback, 'callback')
assert.object(options, 'options');
assert.optionalBool(options.setDefault, 'options.setDefault');
assert.func(callback, 'callback');
var found = false;
for (var i = 0; i < this.profiles.length; i++) {
@ -96,7 +96,7 @@ Joyent.prototype.createOrUpdateProfile = function createOrUpdateProfile(
callback();
};
Joyent.prototype.deleteProfile = function deleteProfile(name, callback) {
JoyentCloud.prototype.deleteProfile = function deleteProfile(name, callback) {
var found = false;
for (var i = 0; i < this.profiles.length; i++) {
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');
if (!this._clientFromDcCache) {
@ -159,11 +159,11 @@ Joyent.prototype._clientFromDc = function _clientFromDc(dc) {
* - {Function} onDcError `function (dc, err)` called for each DC client
* error.
*/
Joyent.prototype.listMachines = function listMachines(options, callback) {
JoyentCloud.prototype.listMachines = function listMachines(options, callback) {
var self = this;
if (callback === undefined) {
callback = options;
options = {}
options = {};
}
assert.object(options, 'options');
assert.optionalFunc(options.onDcError, 'options.onDcError');
@ -198,4 +198,4 @@ Joyent.prototype.listMachines = function listMachines(options, callback) {
//---- exports
module.exports = Joyent;
module.exports = JoyentCloud;

View File

@ -1,6 +1,6 @@
{
"name": "joyent",
"description": "Joyent Public Cloud CLI (https://my.joyentcloud.com/)",
"name": "joyentcloud",
"description": "Joyent Compute Service CLI (http://www.joyent.com/products/compute-service)",
"version": "1.0.0",
"author": "Joyent (joyent.com)",
"private": true,