-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathirbrc
executable file
·41 lines (32 loc) · 988 Bytes
/
irbrc
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
#!/usr/bin/ruby
require 'irb/completion'
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
IRB.conf[:PROMPT_MODE] = :SIMPLE
# looksee/shortcuts ??
%w[rubygems wirble hirb].each do |gem|
begin
require gem
rescue LoadError
end
end
if defined? Wirble
Wirble.init
Wirble.colorize
end
# pretty print
# require 'pp'
if defined? Hirb
Hirb.enable
puts "Hirb enabled (disable with Hirb.disable)"
end
# console logging
script_console_running = ENV.include?('RAILS_ENV') && IRB.conf[:LOAD_MODULES] && IRB.conf[:LOAD_MODULES].include?('console_with_helpers')
rails_running = ENV.include?('RAILS_ENV') && !(IRB.conf[:LOAD_MODULES] && IRB.conf[:LOAD_MODULES].include?('console_with_helpers'))
irb_standalone_running = !script_console_running && !rails_running
if script_console_running
require 'logger'
Object.const_set(:RAILS_DEFAULT_LOGGER, Logger.new(STDOUT))
end
IRB.conf[:PROMPT_MODE] = :DEFAULT