Ensure specified environment is used

If for any reason RAILS_ENV was set to test this command will start a
Rails server with test environment:

    rails s -e development

But this one will start with development environment:

    RAILS_ENV=development rails s

I am not sure who is at fault here, but this ensures guard-rails will
always use the environment specified by the environment option.
This commit is contained in:
Michel Pavan Macedo 2012-07-08 06:29:01 -03:00
parent 885fc3c837
commit 0435a4c17c
1 changed files with 1 additions and 1 deletions

View File

@ -40,7 +40,7 @@ module Guard
rails_options << '-u' if options[:debugger]
rails_options << options[:server] if options[:server]
%{sh -c 'cd #{Dir.pwd} && rails s #{rails_options.join(' ')} &'}
%{sh -c 'cd #{Dir.pwd} && RAILS_ENV=#{options[:environment]} rails s #{rails_options.join(' ')} &'}
end
def pid_file