Skip to content

Instantly share code, notes, and snippets.

@timriley
Created July 1, 2009 02:39
Show Gist options
  • Save timriley/138561 to your computer and use it in GitHub Desktop.
Save timriley/138561 to your computer and use it in GitHub Desktop.
require 'irb/completion'
require 'irb/ext/save-history'
require 'rubygems'
require 'wirble'
require 'pp'
ARGV.concat [ "--readline" ]
Wirble.init
Wirble.colorize
class Object
def local_methods
(methods - Object.instance_methods).sort
end
end
IRB.conf[:SAVE_HISTORY] = 200
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
IRB.conf[:PROMPT_MODE] = :SIMPLE
if rails_env = ENV['RAILS_ENV']
rails_root = File.basename(Dir.pwd)
IRB.conf[:PROMPT] ||= {}
IRB.conf[:PROMPT][:RAILS] = {
:PROMPT_I => "#{rails_root}> ",
:PROMPT_S => "#{rails_root}* ",
:PROMPT_C => "#{rails_root}? ",
:RETURN => "=> %s\n"
}
IRB.conf[:PROMPT_MODE] = :RAILS
if !Object.const_defined?('RAILS_DEFAULT_LOGGER')
require 'logger'
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
end
# Called after the irb session is initialized and Rails has
# been loaded (props: Mike Clark).
# IRB.conf[:IRB_RC] = Proc.new do
# logger = Logger.new(STDOUT)
# ActiveRecord::Base.logger = logger
# ActiveResource::Base.logger = logger
# ActiveRecord::Base.instance_eval { alias :[] :find }
# end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment