Skip to content

Loading…

Three little fixes #45

Merged
merged 2 commits into from

2 participants

@fgnass
  • Nodester now honors the NODESTER_XXX env vars even if process.nodester is set.
  • The usage hint For more help, type <brand> help now displays the correct brand.
  • nodester app setup no longer throws ENOENT, no such file or directory ''
fgnass added some commits
@fgnass fgnass Fix: don't try to mkdir() an empty string 30a8ef6
@fgnass fgnass Fix: make the davster example work again
Nodester now honors the NODESTER env vars even if process.nodester is set. Also the usage hint (For more help, type <brand> help) now displays the correct brand.
892e86f
@nodester nodester merged commit 67ab96c into nodester:master
@nodester
Owner

Merged and published to NPM. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 26, 2012
  1. @fgnass
  2. @fgnass

    Fix: make the davster example work again

    fgnass committed
    Nodester now honors the NODESTER env vars even if process.nodester is set. Also the usage hint (For more help, type <brand> help) now displays the correct brand.
Showing with 16 additions and 23 deletions.
  1. +14 −21 lib/commands.js
  2. +2 −2 lib/config.js
View
35 lib/commands.js
@@ -1,41 +1,34 @@
var log = require('./log');
- brand = "nodester",
- apihost = "api.nodester.com",
- apisecure = false,
env = process.env,
fs = require('fs');
-
-
+ cfg = process.nodester || (process.nodester = {})
process.argv = process.argv.slice(2);
if (env.NODESTER_APIHOST) {
- apihost = env.NODESTER_APIHOST;
+ cfg.apihost = env.NODESTER_APIHOST;
}
if (env.NODESTER_APISECURE) {
- apisecure = true;
+ cfg.apisecure = true;
}
if (env.NODESTER_BRAND) {
- brand = env.NODESTER_BRAND;
+ cfg.brand = env.NODESTER_BRAND;
}
-var nodester_config = {
- apisecure: apisecure,
- apihost: apihost,
- brand: brand,
+var defaults = {
+ apisecure: false,
+ apihost: "api.nodester.com",
+ brand: "nodester",
appname: '',
config: {
username: '',
password: ''
}
};
-if (!process.nodester) {
- process.nodester = {};
-}
-for (var i in nodester_config) {
- if (!process.nodester[i]) {
- process.nodester[i] = nodester_config[i];
+for (var i in defaults) {
+ if (!cfg[i]) {
+ cfg[i] = defaults[i];
}
}
@@ -89,8 +82,8 @@ exports.run = function(cmds, command) {
showHelp(exports.commands);
process.exit(1);
}
-
- if (!cmds[command] && process.nodester.appname) {
+
+ if (!cmds[command] && cfg.appname) {
command = 'app';
process.argv.unshift('app');
}
@@ -122,7 +115,7 @@ var showHelp = exports.showHelp = function(args) {
log.usage(i);
}
}
- log.info('For more help, type', brand, 'help <command>');
+ log.info('For more help, type', cfg.brand, 'help <command>');
}
}
View
4 lib/config.js
@@ -49,8 +49,8 @@ exports.writeApp = function(appname, folder) {
if (!folder) {
folder = '';
}
- if(!exists(folder)){
- fs.mkdirSync(folder, '0777');
+ else if(!exists(folder)) {
+ fs.mkdirSync(folder, '0777');
}
var config_file = path.join("./" + folder, "." + process.nodester.brand + ".appconfig");
log.info('Writing app data to config in ' + config_file);
Something went wrong with that request. Please try again.