lib/guard/rails/runner.rb in guard-rails-0.4.1 vs lib/guard/rails/runner.rb in guard-rails-0.4.2

- old
+ new

@@ -39,10 +39,20 @@ command ||= build_zeus_command if options[:zeus] command ||= build_rails_command "sh -c 'cd \"#{@root}\" && #{command} &'" end + def environment + rails_env = if options[:zeus] + nil + else + options[:environment] + end + + { "RAILS_ENV" => rails_env } + end + def pid_file File.expand_path(options[:pid_file] || File.join(@root, "tmp/pids/#{options[:environment]}.pid")) end def pid @@ -76,22 +86,18 @@ def build_zeus_command zeus_options = [ options[:zeus_plan] || 'server', ] - # To avoid warning of Zeus - # Since setup RAILS_ENV is useless for Zeus - ENV['RAILS_ENV'] = nil "zeus #{zeus_options.join(' ')} #{build_options}" end def build_rails_command - ENV['RAILS_ENV'] = options[:environment] if options[:environment] "rails server #{build_options}" end def run_rails_command! - system build_command + system environment, build_command end def has_pid? File.file?(pid_file) end