Merge branch 'master' of github.com:guard/guard-rails

This commit is contained in:
John Bintz 2011-10-24 11:35:04 -04:00
commit 70d76d166d
4 changed files with 13 additions and 2 deletions

View File

@ -14,6 +14,7 @@ Lots of fun options!
* `:start_on_start` will start the server when starting Guard (default `true`)
* `:force_run` kills any process that's holding open the listen port before attempting to (re)start Rails (default `false`).
* `:daemon` runs the server as a daemon, without any output to the terminal that ran `guard` (default `false`).
* `:debugger` runs the server with the debugger enabled (default `false`). Required ruby-debug gem.
* `:timeout` waits this number of seconds when restarting the Rails server before reporting there's a problem (default `20`).
* `:server` lets you specify the webserver engine to use (try `:server => :thin`).

View File

@ -13,7 +13,8 @@ module Guard
:start_on_start => true,
:force_run => false,
:timeout => 20,
:server => nil
:server => nil,
:debugger => false
}
def initialize(watchers = [], options = {})

View File

@ -23,7 +23,7 @@ module Guard
FileUtils.rm pid_file
end
end
def restart
stop
start
@ -37,6 +37,7 @@ module Guard
]
rails_options << '-d' if options[:daemon]
rails_options << '-u' if options[:debugger]
rails_options << options[:server] if options[:server]
%{sh -c 'cd #{Dir.pwd} && rails s #{rails_options.join(' ')} &'}

View File

@ -47,6 +47,14 @@ describe Guard::RailsRunner do
runner.build_rails_command.should match(%r{ -d})
end
end
context 'debugger' do
let(:options) { default_options.merge(:debugger => true) }
it "should have a debugger switch" do
runner.build_rails_command.should match(%r{ -u})
end
end
context 'custom server' do
let(:options) { default_options.merge(:server => 'thin') }