Created
April 8, 2011 03:36
-
-
Save kbrock/909234 to your computer and use it in GitHub Desktop.
initializer to load debugger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lib/tasks/debugger.rake | |
task :restart do | |
system("touch tmp/restart.txt") | |
end | |
task :debug => :restart do | |
system("touch tmp/debug.txt") | |
puts "after hitting a page, type `rdebug -c` to debug" | |
end | |
# or | |
# bundle exec rdebug -c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/debugger.rb | |
if Rails.env.development? | |
if File.exists?(File.join(Rails.root,'tmp', 'debug.txt')) | |
require 'rdebug/base' | |
require 'ruby-debug' | |
Debugger.wait_connection = true | |
Rails.logger.debug('Waiting for debugger: type `rdebug -c` to debug') | |
Debugger.start_remote | |
Rails.logger.debug('debugger connected') | |
File.delete(File.join(Rails.root,'tmp', 'debug.txt')) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'rdebug', '0.1', :group => :development, :require => false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment