Created
September 13, 2008 01:56
-
-
Save methodmissing/10550 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# modified <RAILS_ROOT/script/console overloading the irb executeable ( assumes script/irb ) | |
#!/usr/bin/env ruby | |
ARGV << "--irb=#{File.dirname(__FILE__)}/irb" | |
require File.dirname(__FILE__) + '/../config/boot' | |
require 'commands/console' | |
#<RAILS_ROOT>/script/irb or elsewhere | |
#!/usr/bin/env ruby | |
require "irb" | |
require "rubygems" | |
require "eventmachine" | |
module IRB | |
class Irb | |
alias :original_signal_handle :signal_handle | |
def signal_handle | |
begin | |
original_signal_handle | |
ensure | |
::EventMachine.stop | |
end | |
end | |
end | |
end | |
EventMachine.run do | |
if __FILE__ == $0 | |
IRB.start(__FILE__) | |
else | |
# check -e option | |
if /^-e$/ =~ $0 | |
IRB.start(__FILE__) | |
else | |
IRB.setup(__FILE__) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment