Skip to content

Instantly share code, notes, and snippets.

@methodmissing
Created September 13, 2008 01:56
Show Gist options
  • Save methodmissing/10550 to your computer and use it in GitHub Desktop.
Save methodmissing/10550 to your computer and use it in GitHub Desktop.
# 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