renaming to 'sdc'

This commit is contained in:
Trent Mick 2014-02-19 19:49:49 -08:00
parent d10b13cbfa
commit d64ea56308
2 changed files with 30 additions and 11 deletions

View File

@ -12,7 +12,7 @@ var sprintf = require('extsprintf').sprintf;
var common = require('./common'); var common = require('./common');
var CONFIG_PATH = path.resolve(process.env.HOME, '.joyentcloudconfig.json'); var CONFIG_PATH = path.resolve(process.env.HOME, '.sdcconfig.json');
var DEFAULTS_PATH = path.resolve(__dirname, '..', 'etc', 'defaults.json'); var DEFAULTS_PATH = path.resolve(__dirname, '..', 'etc', 'defaults.json');
@ -29,7 +29,7 @@ function loadConfigSync() {
} }
config.profiles.push({ config.profiles.push({
name: 'env', name: 'env',
account: process.env.SDC_USER || process.env.SDC_ACCOUNT, user: process.env.SDC_USER || process.env.SDC_ACCOUNT,
keyId: process.env.SDC_KEY_ID, keyId: process.env.SDC_KEY_ID,
rejectUnauthorized: common.boolFromString( rejectUnauthorized: common.boolFromString(
process.env.SDC_TESTING || process.env.SDC_TLS_INSECURE) process.env.SDC_TESTING || process.env.SDC_TLS_INSECURE)

View File

@ -19,7 +19,7 @@ var verror = require('verror'),
* Base error. Instances will always have a string `message` and * Base error. Instances will always have a string `message` and
* a string `code` (a CamelCase string). * a string `code` (a CamelCase string).
*/ */
function JoyentError(options) { function SDCError(options) {
assert.object(options, 'options'); assert.object(options, 'options');
assert.string(options.message, 'options.message'); assert.string(options.message, 'options.message');
assert.string(options.code, 'options.code'); assert.string(options.code, 'options.code');
@ -38,7 +38,7 @@ function JoyentError(options) {
self[k] = options[k]; self[k] = options[k];
}); });
} }
util.inherits(JoyentError, VError); util.inherits(SDCError, VError);
function InternalError(cause, message) { function InternalError(cause, message) {
if (message === undefined) { if (message === undefined) {
@ -46,29 +46,47 @@ function InternalError(cause, message) {
cause = undefined; cause = undefined;
} }
assert.string(message); assert.string(message);
JoyentError.call(this, { SDCError.call(this, {
cause: cause, cause: cause,
message: message, message: message,
code: 'InternalError', code: 'InternalError',
exitStatus: 1 exitStatus: 1
}); });
} }
util.inherits(InternalError, JoyentError); util.inherits(InternalError, SDCError);
/**
* CLI usage error
*/
function UsageError(cause, message) { function UsageError(cause, message) {
if (message === undefined) { if (message === undefined) {
message = cause; message = cause;
cause = undefined; cause = undefined;
} }
assert.string(message); assert.string(message);
JoyentError.call(this, { SDCError.call(this, {
cause: cause, cause: cause,
message: message, message: message,
code: 'Usage', code: 'Usage',
exitStatus: 1 exitStatus: 1
}); });
} }
util.inherits(UsageError, JoyentError); util.inherits(UsageError, SDCError);
/**
* An error signing a request.
*/
function SigningError(cause) {
SDCError.call(this, {
cause: cause,
message: 'error signing request',
code: 'Signing',
exitStatus: 1
});
}
util.inherits(SigningError, SDCError);
/** /**
@ -81,7 +99,7 @@ function MultiError(errs) {
var err = errs[i]; var err = errs[i];
lines.push(format(' error (%s): %s', err.code, err.message)); lines.push(format(' error (%s): %s', err.code, err.message));
} }
JoyentError.call(this, { SDCError.call(this, {
cause: errs[0], cause: errs[0],
message: lines.join('\n'), message: lines.join('\n'),
code: 'MultiError', code: 'MultiError',
@ -89,16 +107,17 @@ function MultiError(errs) {
}); });
} }
MultiError.description = 'Multiple errors.'; MultiError.description = 'Multiple errors.';
util.inherits(MultiError, JoyentError); util.inherits(MultiError, SDCError);
// ---- exports // ---- exports
module.exports = { module.exports = {
JoyentError: JoyentError, SDCError: SDCError,
InternalError: InternalError, InternalError: InternalError,
UsageError: UsageError, UsageError: UsageError,
SigningError: SigningError,
MultiError: MultiError MultiError: MultiError
}; };
// vim: set softtabstop=4 shiftwidth=4: // vim: set softtabstop=4 shiftwidth=4: