From 082b8f650b58012c27d8b976ae7152e87fa0b6e4 Mon Sep 17 00:00:00 2001 From: Ranmocy Date: Sat, 19 Jan 2013 23:44:22 +0800 Subject: [PATCH] refactory build_rails_command --- lib/guard/rails/runner.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/guard/rails/runner.rb b/lib/guard/rails/runner.rb index 8dad1aa..0a7daf1 100644 --- a/lib/guard/rails/runner.rb +++ b/lib/guard/rails/runner.rb @@ -35,13 +35,12 @@ module Guard rails_options = [ '-e', options[:environment], '-p', options[:port], - '--pid', options[:pid_file] || pid_file + '--pid', options[:pid_file] || pid_file, + options[:daemon] ? '-d' : '', + options[:debugger] ? '-u' : '', + options[:server].nil? ? '' : options[:server], ] - rails_options << '-d' if options[:daemon] - rails_options << '-u' if options[:debugger] - rails_options << options[:server] if options[:server] - rails_command = options[:zeus] ? 'zeus' : 'rails' %{sh -c 'cd #{Dir.pwd} && RAILS_ENV=#{options[:environment]} #{rails_command} s #{rails_options.join(' ')} &'}