Skip to content

Instantly share code, notes, and snippets.

@anhang
Created February 22, 2013 08:53
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 anhang/5011874 to your computer and use it in GitHub Desktop.
Save anhang/5011874 to your computer and use it in GitHub Desktop.
~/.irbrc that shows Rails environments
if Rails.env
rails_env = Rails.env.production? ? 'PROD' : Rails.env[0...3].downcase
current_app = Dir.pwd.split('/').last.capitalize
IRB.conf[:PROMPT].reverse_merge!(:RAILS_ENV => {:PROMPT_I=>"#{current_app} #{rails_env} >> ", :PROMPT_N=>"#{current_app} #{rails_env} >> ", :PROMPT_S=>nil, :PROMPT_C=>"?> ", :RETURN=>"=> %s\n"})
IRB.conf[:PROMPT_MODE] = :RAILS_ENV
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment