Merge pull request #2 from joelmoss/debugger

Added support for setting the debugger (-u flag)
This commit is contained in:
John Bintz 2011-08-25 08:08:11 -07:00
commit 0a82cb086e
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`) * `: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`). * `: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`). * `: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`). * `:timeout` waits this number of seconds when restarting the Rails server before reporting there's a problem (default `20`).
This is super-alpha, but it works for me! Only really hand-tested in Mac OS X. Feel free to fork'n'fix for other This is super-alpha, but it works for me! Only really hand-tested in Mac OS X. Feel free to fork'n'fix for other

View File

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

View File

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

View File

@ -47,6 +47,14 @@ describe Guard::RailsRunner do
end end
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 context 'custom server' do
let(:options) { default_options.merge(:server => 'thin') } let(:options) { default_options.merge(:server => 'thin') }