-
Notifications
You must be signed in to change notification settings - Fork 0
/
irbrc
36 lines (30 loc) · 977 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
begin
require 'amazing_print'
require 'irb'
require 'rainbow'
require 'rubygems'
require 'amazing_print'
# TODO: fix delegation to enable AmazingPrint again
# https://github.com/awesome-print/awesome_print/issues/339#issuecomment-790004674
AmazingPrint.irb!
rescue LoadError => e
puts "ERROR: Could not load gem #{e}"
end
IRB.conf[:ECHO_ON_ASSIGNMENT] = true
IRB.conf[:USE_AUTOCOMPLETE] = false
IRB.conf[:USE_MULTILINE] = false
# Add color coding based on Rails environment for safety
if defined? Rails
banner = if Rails.env.production?
"\e[41;97;1m #{Rails.env} \e[0m "
else
"\e[42;97;1m #{Rails.env} \e[0m "
end
# Build a custom prompt
IRB.conf[:PROMPT][:CUSTOM] = IRB.conf[:PROMPT][:DEFAULT].merge(
PROMPT_I: banner + IRB.conf[:PROMPT][:DEFAULT][:PROMPT_I]
)
IRB.conf[:SAVE_HISTORY] = false if Rails.env.production?
# Use custom prompt by default
IRB.conf[:PROMPT_MODE] = :CUSTOM
end