-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.pryrc
47 lines (40 loc) · 1.18 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
Pry.config.editor = 'vim'
Pry.config.prompt = proc do |obj, _|
prompt = ''
prompt << "#{Rails.version}@" if defined?(Rails)
prompt << "#{RUBY_VERSION}"
"#{prompt} (#{obj})> "
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?(PryByebug)
if Pry.commands.collect(&:first).include?('continue')
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
if defined?(Rails)
begin
require 'rails/console/app'
require 'rails/console/helpers'
TOPLEVEL_BINDING.eval('self').extend ::Rails::ConsoleMethods
rescue
require 'console_app'
require 'console_with_helpers'
end
end
# Hit Enter to repeat last command
Pry::Commands.command(/^$/, 'repeat last command') do
_pry_.run_command Pry.history.to_a.last
end
begin
require 'awesome_print'
Pry.config.print = proc do |output, value|
Pry::Helpers::BaseHelpers.stagger_output("=> #{value.ai}", output)
end
rescue
warn '=> Unable to load awesome_print'
end