forked from ryanb/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrailsrc
More file actions
32 lines (27 loc) · 696 Bytes
/
railsrc
File metadata and controls
32 lines (27 loc) · 696 Bytes
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
#!/usr/bin/ruby
begin
require 'hirb' # sudo gem install cldwalker-hirb --source http://gems.github.com
Hirb.enable
rescue LoadError
end
# Display the RAILS ENV in the prompt
# ie : [Development]>>
IRB.conf[:PROMPT][:CUSTOM] = {
:PROMPT_N => "[#{(ENV["RAILS_ENV"] || 'development').capitalize}]>> ",
:PROMPT_I => "[#{(ENV["RAILS_ENV"] || 'development').capitalize}]>> ",
:PROMPT_S => nil,
:PROMPT_C => "?> ",
:RETURN => "=> %s\n"
}
# Set default prompt
IRB.conf[:PROMPT_MODE] = :CUSTOM
def change_log(stream)
ActiveRecord::Base.logger = Logger.new(stream)
ActiveRecord::Base.clear_active_connections!
end
def show_log
change_log(STDOUT)
end
def hide_log
change_log(nil)
end