Skip to content
Permalink
Browse files

Merge pull request #242 from nodejitsu/gh-241

[fix] issue #241 (jitsu env set would set null: null)
  • Loading branch information...
indexzero committed Jul 10, 2012
2 parents 19c93ea + 57f7d4b commit 7fb440bca7d921bac168d1cf40bd4bb4eedc9f15
Showing with 17 additions and 0 deletions.
  1. +9 −0 lib/jitsu/commands/env.js
  2. +8 −0 test/commands/env-test.js
@@ -30,7 +30,15 @@ env.usage = [
// the application in the current directory.
//
env.set = function (appName, key, value, callback) {

if (value === null) {
if (key === null) {
jitsu.log.error(
'You must specify both an environment variable name and value.'
);
return callback({});
}

value = key;
key = appName;
return viewApp(callback, update);
@@ -39,6 +47,7 @@ env.set = function (appName, key, value, callback) {
viewAppByName(appName, callback, update);

function update(err, app) {

app.env = app.env || {};
app.env[key] = value;
jitsu.apps.update(app.name, { env: app.env }, callback);
@@ -134,6 +134,14 @@ vows.describe('jitsu/commands/env').addBatch({
}
}, { 'x-powered-by': 'Nodejitsu' })
})
}).addBatch({
'env set': shouldNodejitsuOk(
'Should exit with an error',
function assertion (ign, err) {
err = ign;
assert.isTrue(!!err);
}
)
}).addBatch({
'env set test truthy': shouldNodejitsuOk(function setup() {
nock('http://api.mockjitsu.com')

0 comments on commit 7fb440b

Please sign in to comment.
You can’t perform that action at this time.