diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-09-13 20:25:18 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-09-13 20:25:18 +0100 |
commit | f6c0f688680778a7bf693a69ffee021e1122b01c (patch) | |
tree | 09699984d7a4f612689f19e3e0ccb663ae207d3f /railties/lib | |
parent | 25fd841fe0f1d6f43019595a06aef6d825f5f4d1 (diff) | |
parent | 96055414d6197b9705e408c17236f79372a007e5 (diff) | |
download | rails-f6c0f688680778a7bf693a69ffee021e1122b01c.tar.gz rails-f6c0f688680778a7bf693a69ffee021e1122b01c.tar.bz2 rails-f6c0f688680778a7bf693a69ffee021e1122b01c.zip |
Merge commit 'mainstream/master'
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/commands/console.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/railties/lib/commands/console.rb b/railties/lib/commands/console.rb index 2b9d92f647..63df834639 100644 --- a/railties/lib/commands/console.rb +++ b/railties/lib/commands/console.rb @@ -1,11 +1,13 @@ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb' require 'optparse' + options = { :sandbox => false, :irb => irb } OptionParser.new do |opt| opt.banner = "Usage: console [environment] [options]" opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |v| options[:sandbox] = v } opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |v| options[:irb] = v } + opt.on("--debugger", 'Enable ruby-debugging for the console.') { |v| options[:debugger] = v } opt.parse!(ARGV) end @@ -15,6 +17,17 @@ libs << " -r console_app" libs << " -r console_sandbox" if options[:sandbox] libs << " -r console_with_helpers" +if options[:debugger] + begin + require 'ruby-debug' + libs << " -r ruby-debug" + puts "=> Debugger enabled" + rescue Exception + puts "You need to install ruby-debug to run the console in debugging mode. With gems, use 'gem install ruby-debug'" + exit + end +end + ENV['RAILS_ENV'] = case ARGV.first when "p"; "production" when "d"; "development" |