Created
September 29, 2010 02:36
-
-
Save vargonaut/602215 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
| require 'pp' | |
| require 'irb/completion' | |
| IRB.conf[:AUTO_INDENT]=true | |
| require 'irb/ext/save-history' | |
| IRB.conf[:SAVE_HISTORY] = 100 | |
| IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history" | |
| IRB.conf[:USE_READLINE] = true | |
| IRB.conf[:LOAD_MODULES] = [] unless IRB.conf.key?(:LOAD_MODULES) | |
| unless IRB.conf[:LOAD_MODULES].include?('irb/completion') | |
| IRB.conf[:LOAD_MODULES] << 'irb/completion' | |
| end | |
| if rails_env = ENV['RAILS_ENV'] | |
| rails_root = File.basename(Dir.pwd) | |
| IRB.conf[:PROMPT] ||= {} | |
| IRB.conf[:PROMPT][:RAILS] = { | |
| :PROMPT_I => "[#{ENV["RAILS_ENV"][0..2]}] #{rails_root} >> ", | |
| :PROMPT_S => "[#{ENV["RAILS_ENV"][0..2]}] #{rails_root} * ", | |
| :PROMPT_C => "[#{ENV["RAILS_ENV"][0..2]}] #{rails_root} ? ", | |
| :RETURN => "=> %s\n" | |
| } | |
| IRB.conf[:PROMPT_MODE] = :RAILS | |
| end | |
| class Object | |
| def local_methods | |
| (self.methods - Class.methods).sort | |
| end | |
| end | |
| def loud_logger | |
| set_logger_to Logger.new(STDOUT) | |
| end | |
| def quiet_logger | |
| set_logger_to nil | |
| end | |
| def set_logger_to(logger) | |
| ActiveRecord::Base.logger = logger | |
| ActiveRecord::Base.clear_active_connections! | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment