diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-01 19:03:38 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-01 19:04:32 -0800 |
commit | 04fdb6eccb3a49b26bdbf779031f427da23a8bb4 (patch) | |
tree | 158383301d6cf08d73662a44a16d3e0c867a2d87 /railties/lib/commands/console.rb | |
parent | a3ac1e1621506a6519b265ef6ec6abc70f6c8a27 (diff) | |
download | rails-04fdb6eccb3a49b26bdbf779031f427da23a8bb4.tar.gz rails-04fdb6eccb3a49b26bdbf779031f427da23a8bb4.tar.bz2 rails-04fdb6eccb3a49b26bdbf779031f427da23a8bb4.zip |
Revert "Speed up script/console by launching IRB directly."
[#2104 state:open]
This reverts commit 3b169cd693f45911ee71e26708fb9267811c8d83.
Diffstat (limited to 'railties/lib/commands/console.rb')
-rw-r--r-- | railties/lib/commands/console.rb | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/railties/lib/commands/console.rb b/railties/lib/commands/console.rb index 45acd18c2f..63df834639 100644 --- a/railties/lib/commands/console.rb +++ b/railties/lib/commands/console.rb @@ -1,23 +1,26 @@ +irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb' + require 'optparse' -options = { :sandbox => false } +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 -require 'irb' -require "irb/completion" -require "#{RAILS_ROOT}/config/environment" -require "console_app" -require "console_sandbox" if options[:sandbox] -require "console_with_helpers" +libs = " -r irb/completion" +libs << %( -r "#{RAILS_ROOT}/config/environment") +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'" @@ -39,6 +42,4 @@ if options[:sandbox] else puts "Loading #{ENV['RAILS_ENV']} environment (Rails #{Rails.version})" end - -ARGV.replace(["--simple-prompt"]) -IRB.start +exec "#{options[:irb]} #{libs} --simple-prompt" |