timriley (owner)

Revisions

gist: 138561 Download_button fork
public
Public Clone URL: git://gist.github.com/138561.git
Embed All Files: show embed
Text only #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require 'irb/completion'
require 'irb/ext/save-history'
require 'rubygems'
require 'wirble'
require 'pp'
 
ARGV.concat [ "--readline" ]
 
Wirble.init
Wirble.colorize
 
class Object
  def local_methods
    (methods - Object.instance_methods).sort
  end
end
 
IRB.conf[:SAVE_HISTORY] = 200
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
IRB.conf[:PROMPT_MODE] = :SIMPLE
 
 
 
if rails_env = ENV['RAILS_ENV']
  rails_root = File.basename(Dir.pwd)
  IRB.conf[:PROMPT] ||= {}
  IRB.conf[:PROMPT][:RAILS] = {
    :PROMPT_I => "#{rails_root}> ",
    :PROMPT_S => "#{rails_root}* ",
    :PROMPT_C => "#{rails_root}? ",
    :RETURN => "=> %s\n"
  }
  IRB.conf[:PROMPT_MODE] = :RAILS
  
  if !Object.const_defined?('RAILS_DEFAULT_LOGGER')
    require 'logger'
    RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
  end
 
  # Called after the irb session is initialized and Rails has
  # been loaded (props: Mike Clark).
  # IRB.conf[:IRB_RC] = Proc.new do
  # logger = Logger.new(STDOUT)
  # ActiveRecord::Base.logger = logger
  # ActiveResource::Base.logger = logger
  # ActiveRecord::Base.instance_eval { alias :[] :find }
  # end
end