From 5b2e74d09fe7410998cf9e3c8131d698d4436c4e Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Fri, 7 Feb 2014 16:49:07 -0800 Subject: [PATCH] joyentcloud name picked --- CHANGES.md | 2 +- Makefile | 4 ++-- bin/{joyent => joyentcloud} | 2 +- lib/cli.js | 16 ++++++++------- lib/{joyent.js => joyentcloud.js} | 34 +++++++++++++++---------------- package.json | 4 ++-- 6 files changed, 32 insertions(+), 30 deletions(-) rename bin/{joyent => joyentcloud} (79%) rename lib/{joyent.js => joyentcloud.js} (86%) diff --git a/CHANGES.md b/CHANGES.md index 9c7cbaf..f5953b0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1 +1 @@ -# joyent CLI Changelog +# node-joyentcloud CLI Changelog diff --git a/Makefile b/Makefile index 2940ede..2749bb0 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/bin/joyent b/bin/joyentcloud similarity index 79% rename from bin/joyent rename to bin/joyentcloud index eadbcbe..694734b 100755 --- a/bin/joyent +++ b/bin/joyentcloud @@ -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; diff --git a/lib/cli.js b/lib/cli.js index ffa531e..940e135 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -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(); diff --git a/lib/joyent.js b/lib/joyentcloud.js similarity index 86% rename from lib/joyent.js rename to lib/joyentcloud.js index ddc9a9f..3f28325 100644 --- a/lib/joyent.js +++ b/lib/joyentcloud.js @@ -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; diff --git a/package.json b/package.json index 6819e64..70f8c76 100644 --- a/package.json +++ b/package.json @@ -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,