-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpryrc
52 lines (43 loc) · 1.17 KB
/
pryrc
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
49
50
51
52
if defined? AwesomePrint
AwesomePrint.pry!
end
Pry.config.prompt = Pry::Prompt.new(
'ruby',
'lsdr ruby prompt',
[
proc do |obj, nest_level, _|
prompt = Pry::Helpers::Text.purple("#{RUBY_VERSION} [#{obj}]:")
"#{prompt} "
end
]
)
Pry.config.exception_handler = proc do |output, exception, _|
output.puts "\e[31m#{exception.class}: #{exception.message}"
output.puts "from #{exception.backtrace.first}\e[0m"
end
if defined?(Rails)
require "rails/console/app"
require "rails/console/helpers"
TOPLEVEL_BINDING.eval("self").extend ::Rails::ConsoleMethods
# load models, controllers eagerly; make console work easier
Rails.application.eager_load!
end
if defined?(PryByebug)
Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'
Pry.commands.alias_command 'f', 'finish'
end
begin
require 'hirb'
Hirb.enable
old_print = Pry.config.print
Pry.config.print = proc do |*args|
Hirb::View.view_or_page_output(args[1]) || old_print.call(*args)
end
rescue LoadError => e
warn e.message
end
# emacs support
Pry.config.correct_indent = false if ENV["EMACS"]
# vim: set ft=ruby: