Created
July 21, 2011 15:04
-
-
Save avsej/1097387 to your computer and use it in GitHub Desktop.
My .irbrc file
This file contains 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
ARGV.concat ["--readline"] | |
$LOAD_PATH << "." | |
require 'rubygems' | |
require 'pp' | |
history_file = "#{ENV['HOME']}/.irb-history" | |
version = "#{RUBY_VERSION}" | |
if RUBY_DESCRIPTION =~ /Ruby Enterprise Edition (\d{4}\.\d{2})/ | |
version << "ee#{$1}" | |
else | |
version << "p#{RUBY_PATCHLEVEL}" | |
end | |
my_prompt = { | |
:PROMPT_I=>"#{version} (%m):%03n:%i> ", | |
:PROMPT_N=>"#{version} (%m):%03n:%i> ", | |
:PROMPT_S=>"#{version} (%m):%03n:%i%l ", | |
:PROMPT_C=>"#{version} (%m):%03n:%i* ", | |
:RETURN=>"%s\n" | |
} | |
require 'irb/completion' | |
require 'irb/ext/save-history' | |
IRB.conf[:SAVE_HISTORY] = 100000 | |
IRB.conf[:HISTORY_FILE] = history_file | |
IRB.conf[:PROMPT][:MY] = my_prompt | |
IRB.conf[:PROMPT_MODE] = :MY | |
if defined?(Rails) | |
require 'logger' | |
silence_warnings { RAILS_DEFAULT_LOGGER = Logger.new(STDOUT) } | |
Rails.logger = RAILS_DEFAULT_LOGGER | |
ActiveRecord::Base.logger = RAILS_DEFAULT_LOGGER if defined?(ActiveRecord) | |
Mongoid.logger = RAILS_DEFAULT_LOGGER if defined?(Mongoid) | |
puts "Redirecting logger to STDOUT" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment