rename to 'sdc'

This commit is contained in:
Trent Mick 2014-02-12 12:22:08 -08:00
parent 0317fdb0db
commit d10b13cbfa
9 changed files with 36 additions and 57 deletions

View File

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

View File

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

View File

@ -1,17 +1,19 @@
`joyent` is a CLI for the Joyent Public Cloud (https://my.joyentcloud.com).
`sdc` is a CLI for Joyent SmartDataCenter and the
Joyent Public Cloud (<https://my.joyentcloud.com>,
<http://www.joyent.com/products/compute-service>).
# Installation
1. Install [node.js](http://nodejs.org/).
2. `npm install -g joyent`
2. `npm install -g sdc`
Verify that installed and is on your PATH:
$ joyent --version
joyent CLI 1.0.0
$ sdc --version
sdc CLI 1.0.0
Before you can used the CLI you'll need a Joyent account, an SSH key uploaded
and `joyent` configured with those account details.
and `sdc` configured with those account details.
# Setup

View File

@ -1,5 +1,6 @@
# first
- lib/cloudapi2.js and drop using node-smartdc
- machines:
- short default output
- long '-l' output, -H, -o, -s

View File

@ -2,7 +2,7 @@
/*
* Copyright (c) 2014 Joyent Inc. All rights reserved.
*
* joyentcloud
* sdc command
*/
var p = console.log;

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2014 Joyent Inc. All rights reserved.
*
* The 'joyentcloud' CLI class.
* The 'sdc' CLI class.
*/
var p = console.log;
@ -21,14 +21,14 @@ var cmdln = require('cmdln'),
var common = require('./common');
var errors = require('./errors');
var JoyentCloud = require('./joyentcloud');
var SDC = require('./sdc');
//---- globals
var pkg = require('../package.json');
var name = 'joyentcloud';
var name = 'sdc';
var log = bunyan.createLogger({
name: name,
serializers: bunyan.stdSerializers,
@ -75,11 +75,11 @@ CLI.prototype.init = function (opts, args, callback) {
log.src = true;
}
this.__defineGetter__('jc', function () {
if (self._jc === undefined) {
self._jc = new JoyentCloud({log: log, profile: opts.profile});
this.__defineGetter__('sdc', function () {
if (self._sdc === undefined) {
self._sdc = new SDC({log: log, profile: opts.profile});
}
return self._jc;
return self._sdc;
});
// Cmdln class handles `opts.help`.
@ -95,8 +95,8 @@ CLI.prototype.do_profile = function (subcmd, opts, args, callback) {
return callback(new Error('too many args: ' + args));
}
var profs = common.deepObjCopy(this.jc.profiles);
var currProfileName = this.jc.profile.name;
var profs = common.deepObjCopy(this.sdc.profiles);
var currProfileName = this.sdc.profile.name;
for (var i = 0; i < profs.length; i++) {
profs[i].curr = (profs[i].name === currProfileName ? '*' : ' ');
profs[i].dcs = (profs[i].dcs ? profs[i].dcs : ['all'])
@ -143,7 +143,7 @@ CLI.prototype.do_dcs = function (subcmd, opts, args, callback) {
return callback(new Error('too many args: ' + args));
}
var dcs = this.jc.config.dcs;
var dcs = this.sdc.config.dcs;
var dcsArray = Object.keys(dcs).map(
function (n) { return {name: n, url: dcs[n]}; });
if (opts.json) {
@ -190,7 +190,7 @@ CLI.prototype.do_machines = function (subcmd, opts, args, callback) {
var machines = [];
var errs = [];
var res = this.jc.listMachines();
var res = this.sdc.listMachines();
res.on('data', function (dc, dcMachines) {
for (var i = 0; i < dcMachines.length; i++) {
dcMachines[i].dc = dc;

View File

@ -1,7 +1,7 @@
/*
* Copyright (c) 2014, Joyent, Inc. All rights reserved.
*
* Core JoyentCloud driver class.
* Core SDC driver class.
*/
var p = console.log;
@ -18,17 +18,17 @@ var loadConfigSync = require('./config').loadConfigSync;
//---- JoyentCloud class
//---- SDC class
/**
* Create a JoyentCloud client.
* Create a SDC client.
*
* @param options {Object}
* - log {Bunyan Logger}
* - profile {String} Optional. Name of profile to use. Defaults to
* 'defaultProfile' in the config.
*/
function JoyentCloud(options) {
function SDC(options) {
assert.object(options, 'options');
assert.object(options.log, 'options.log');
assert.optionalString(options.profile, 'options.profile');
@ -42,7 +42,7 @@ function JoyentCloud(options) {
}
JoyentCloud.prototype.setDefaultProfile =
SDC.prototype.setDefaultProfile =
function setDefaultProfile(name, callback) {
if (!this.getProfile(name)) {
return callback(new Error('no such profile: ' + name));
@ -52,7 +52,7 @@ function setDefaultProfile(name, callback) {
callback();
};
JoyentCloud.prototype.getProfile = function getProfile(name) {
SDC.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,7 +68,7 @@ JoyentCloud.prototype.getProfile = function getProfile(name) {
* - setDefault {Boolean}
* @param callback {Function} `function (err)`
*/
JoyentCloud.prototype.createOrUpdateProfile = function createOrUpdateProfile(
SDC.prototype.createOrUpdateProfile = function createOrUpdateProfile(
profile, options, callback) {
assert.object(profile, 'profile');
if (typeof (options) === 'function') {
@ -96,7 +96,7 @@ JoyentCloud.prototype.createOrUpdateProfile = function createOrUpdateProfile(
callback();
};
JoyentCloud.prototype.deleteProfile = function deleteProfile(name, callback) {
SDC.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 @@ JoyentCloud.prototype.deleteProfile = function deleteProfile(name, callback) {
};
JoyentCloud.prototype._clientFromDc = function _clientFromDc(dc) {
SDC.prototype._clientFromDc = function _clientFromDc(dc) {
assert.string(dc, 'dc');
if (!this._clientFromDcCache) {
@ -168,7 +168,7 @@ JoyentCloud.prototype._clientFromDc = function _clientFromDc(dc) {
*
* @param {Object} options Optional
*/
JoyentCloud.prototype.listMachines = function listMachines(options) {
SDC.prototype.listMachines = function listMachines(options) {
var self = this;
if (options === undefined) {
options = {};
@ -201,4 +201,4 @@ JoyentCloud.prototype.listMachines = function listMachines(options) {
//---- exports
module.exports = JoyentCloud;
module.exports = SDC;

View File

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

View File

@ -1,24 +0,0 @@
#!/bin/bash
#
# Rsync the master in this working copy to the install on the given HN.
#
#set -o xtrace
set -o errexit
TOP=$(cd $(dirname $0)/../; pwd)
NODE=$1
[[ -z "$NODE" ]] && echo 'rsync-to: error: no headnode given' && exit 1
BASEDIR=/opt/smartdc/sdcadm
extraOpts=
if [[ $(uname -s) != "SunOS" ]]; then
extraOpts="--exclude *.node --exclude build"
else
# Clean node_modules everytime.
ssh $NODE rm -rf $BASEDIR/node_modules
fi
for f in bin lib node_modules package.json; do
rsync -av ${TOP}/$f $NODE:$BASEDIR/$f $extraOpts
done