Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "irb"
- # FIXME: can this be done better?
- # travel up until we find config/boot
- old_path = File.expand_path(__FILE__)
- path = File.dirname(old_path)
- until File.exist?("#{path}/config/boot.rb") || old_path == path
- old_path = path
- path = File.dirname(old_path)
- end
- require "#{path}/config/boot.rb"
- # /FIXME
- require "#{RAILS_ROOT}/config/environment"
- require "console_app"
- require "console_with_helpers"
- ENV['RAILS_ENV'] = case ARGV.last
- when "p"; "production"
- when "d"; "development"
- when "t"; "test"
- when nil; ENV['RAILS_ENV'] || 'development'
- else
- ARGV.pop
- end
- IRB.setup(nil)
- irb = IRB::Irb.new()
- IRB.conf[:IRB_RC].call(irb.context) if IRB.conf[:IRB_RC] # loads the irbrc?
- IRB.conf[:MAIN_CONTEXT] = irb.context # why would the main context be set here?
- trap("SIGINT") do
- irb.signal_handle
- end
- catch(:IRB_EXIT) do
- irb.eval_input
- end
Add Comment
Please, Sign In to add comment