Skip to content

Instantly share code, notes, and snippets.

@rhaamo
Created June 6, 2010 12:32
Show Gist options
  • Save rhaamo/427559 to your computer and use it in GitHub Desktop.
Save rhaamo/427559 to your computer and use it in GitHub Desktop.
require 'rubygems'
d=Dir.new(Dir.pwd)
if d.include? "Gemfile"
load "~/.railsrc"
end
require 'pp'
require 'wirble'
Wirble.init
Wirble.colorize
# Log to STDOUT if in Rails
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER')
require 'logger'
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
end
history = "History?"
#if rails_env = ENV['RAILS_ENV']
rails_root = File.basename(Dir.pwd)
rails_env_string = "dev"
#rails_env_string = case rails_env
#when 'development'
# 'dev'
#when 'production'
# 'prod'
#else
# rails_env
#end
IRB.conf[:PROMPT] ||= {}
IRB.conf[:PROMPT][:RAILS] = {
:PROMPT_I => "#{rails_root} #{rails_env_string}> ",
:PROMPT_S => "#{rails_root} #{rails_env_string}* ",
:PROMPT_C => "#{rails_root} #{rails_env_string}? ",
:RETURN => "=> %s\n"
}
IRB.conf[:PROMPT_MODE] = :RAILS
# Called after the irb session is initialized and Rails has
# been loaded (props: Mike Clark).
IRB.conf[:IRB_RC] = Proc.new do
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.instance_eval { alias :[] :find }
alias :r! :reload!
end
#end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment