From 0435a4c17cebe1de84a2907bd894f1db4771afdc Mon Sep 17 00:00:00 2001 From: Michel Pavan Macedo Date: Sun, 8 Jul 2012 06:29:01 -0300 Subject: [PATCH] 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. --- lib/guard/rails/runner.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/guard/rails/runner.rb b/lib/guard/rails/runner.rb index e457b43..fea5996 100644 --- a/lib/guard/rails/runner.rb +++ b/lib/guard/rails/runner.rb @@ -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