Closed wicz closed 12 years ago
How about we do something like:
system(ENV['EDITOR'], file) unless ENV['EDITOR'].blank?
I just don't want the setup to catastrophically fail if the EDITOR
variable isn't set.
Sounds good to me.
BTW, any special reason to use unless/blank?
instead of if ENV['EDITOR']
BTW, any special reason to use unless/blank? instead of if ENV['EDITOR']
Special reason? Not really. I just like the way it reads: "Do this unless this thing is blank". Plus I don't know how the ENV
constant works and if ENV['EDITOR']
returns nil
or ""
if it isn't set. Calling .blank?
covers us either way.
You're right, just test it. if ENV['EDITOR']
will eval to true
even if EDITOR
is blank.
I'll fix this in a minute.
When your
$EDITOR
isvi
and you runbundle exec rake setup
you get the following error:Vim: Warning: Output is not to a terminal
.I don't know why exactly this happen, maybe because
vi
expectsSTDOUT
and backticks somehow changes it to read and return it from the subshell after execution (!?)Some solutions:
$EDITOR
execution fromrequires_edit
system(ENV['EDITOR'], file)
rather than backticks (we don't need the output anyway)cat
the contents ofconfig/database.yml
Feel free to assign me this issue when we decide the best solution.