-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow loading multiple ENV files #77
Conversation
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
@slnode ok to test |
@@ -138,6 +139,20 @@ function loadEnvs(path) { | |||
return env; | |||
} | |||
|
|||
function loadEnvs(path) { | |||
if (path.indexOf(',') === -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? I think path.split(',')
below will handle this case as a single item Array and "just work", won't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're correct. Was keeping the existing behavior when there's no ','
for a slight performance gain. It's negligible though, so I can remove it if that's preferred.
@joeyespo thanks for the pull request! Is there any chance you could update the help message to indicate the added support for a comma separated list? And address my comments, if you don't mind. |
@rmg Sure, will do! |
@rmg Any idea what's up with these test failures? My initial commit passed, now there's a bunch of failed linting errors from what I could see. Looks like they might be from generated |
It's the env tests, all the keys are now in a different order than the fixtures. Hm... |
@rmg Closing and re-opening to see if a fresh PR will fix the tests. |
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
@slnode ok to test |
@joeyespo do the tests pass for you locally when you run |
@rmg Here's my node-foreman>npm run test
> foreman@1.4.1 test node-foreman
> tap test
total ................................................... 0/0
ok |
85901d1
to
f295db8
Compare
@rmg Done. |
@joeyespo do the tests give you anything more useful when you run them locally now? You'll need to do |
@rmg Getting the following output now, both on bash-4.3$ npm run test
> foreman@1.4.1 pretest node-foreman
> jshint *.js lib/*.js
ERROR: Can't open *.js
ERROR: Can't open lib/*.js
> foreman@1.4.1 test node-foreman
> tap test/*.test.*
ok test/console-output.test.js .......................... 1/1
ok test/console-trim.test.js ............................ 1/1
ok test/envs-commented.test.js .......................... 1/1
ok test/envs-empty.test.js .............................. 1/1
ok test/envs-json.test.js ............................... 1/1
ok test/envs-quoted.test.js ............................. 1/1
assert.js:89
throw new assert.AssertionError({
^
AssertionError: false == true
at process.<anonymous> (node-foreman\test\run-once.test.js:29:12)
at emitOne (events.js:77:13)
at process.emit (events.js:169:7)
not ok test/run-once.test.js ............................ 0/1
Command: "C:\Program Files\nodejs\node.exe run-once.test.js"
TAP version 13
not ok 1 test/run-once.test.js
---
exit: 1
stderr: |
assert.js:89
throw new assert.AssertionError({
^
AssertionError: false == true
at process.<anonymous> (node-foreman\test\run-once.test.js:29:12)
at emitOne (events.js:77:13)
at process.emit (events.js:169:7)
command: |
"C:\Program Files\nodejs\node.exe run-once.test.js"
...
1..1
# tests 1
# fail 1
total ................................................... 6/7
not ok
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
npm ERR! node v4.1.0
npm ERR! npm v2.14.3
npm ERR! code ELIFECYCLE
npm ERR! foreman@1.4.1 test: `tap test/*.test.*`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the foreman@1.4.1 test script 'tap test/*.test.*'.
npm ERR! This is most likely a problem with the foreman package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! tap test/*.test.*
npm ERR! You can get their info via:
npm ERR! npm owner ls foreman
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! node-foreman\npm-debug.log On Windows though, so I had to run within git's
Looks like the tests are passing locally. While I'm at it, want me to make |
Ah, right.. Windows wouldn't recognize all the tests that are actually shell scripts. Might need to port those to node to make them more portable. |
@rmg Let me know what else you need from me. |
+1 for this feature |
nevermind - I see this works if you supply the -e flag to the nf command directly. e.g.
Nice one! |
This is to match the way Foreman works.