Skip to content

Instantly share code, notes, and snippets.

@tonycoco
Created April 1, 2011 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonycoco/898325 to your computer and use it in GitHub Desktop.
Save tonycoco/898325 to your computer and use it in GitHub Desktop.
Just a few good things to do for your Rails 3 applications in IRBRC
%w[rubygems wirble pp ap].each do |gem_name|
begin
require gem_name
rescue LoadError => err
warn "Please do: gem install #{gem_name.sub(/\/.*/,'')}"
end
end
Wirble.init
Wirble.colorize
alias q exit
IRB.conf[:AUTO_INDENT] = true
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:EVAL_HISTORY] = 200
# Rails 3
if defined?(Rails)
require 'irb/completion'
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.clear_active_connections!
IRB.conf[:PROMPT][:CUSTOM] = {
:PROMPT_N => "[#{Rails.application.class.parent_name.downcase}::#{Rails.env}] >> ",
:PROMPT_I => "[#{Rails.application.class.parent_name.downcase}::#{Rails.env}] >> ",
:PROMPT_S => nil,
:PROMPT_C => "?> ",
:RETURN => "=> %s\n"
}
IRB.conf[:PROMPT_MODE] = :CUSTOM
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment