DEV: Add pry-byebug and optionally require pry behind a ENV var for better spec debugging (#9984)

We removed pry-nav a while back because it is not up to date with pry but it is super useful. Luckily pry-byebug is here to save us all from Satan's power.

To get this to work you need to add the following to your $HOME/.pryrc file.

```
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

Pry::Commands.command /^$/, "repeat last command" do
  pry_instance.run_command Pry.history.to_a.last
end
```

The require-ing of pry, pry-rails, and pry-byebug in specs is controlled by the IMPROVED_SPEC_DEBUGGING flag (disabled by default).
This commit is contained in:
Martin Brennan 2020-06-05 12:30:34 +10:00 committed by GitHub
parent 0f20a6f0aa
commit e84ffb4861
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -112,6 +112,7 @@ gem 'oj'
gem 'pg' gem 'pg'
gem 'mini_sql' gem 'mini_sql'
gem 'pry-rails', require: false gem 'pry-rails', require: false
gem 'pry-byebug', require: false
gem 'r2', require: false gem 'r2', require: false
gem 'rake' gem 'rake'

View File

@ -267,6 +267,9 @@ GEM
pry (0.13.1) pry (0.13.1)
coderay (~> 1.1) coderay (~> 1.1)
method_source (~> 1.0) method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
pry-rails (0.3.9) pry-rails (0.3.9)
pry (>= 0.10.4) pry (>= 0.10.4)
public_suffix (4.0.5) public_suffix (4.0.5)
@ -516,6 +519,7 @@ DEPENDENCIES
onebox onebox
parallel_tests parallel_tests
pg pg
pry-byebug
pry-rails pry-rails
puma puma
r2 r2

View File

@ -8,6 +8,12 @@ end
require 'rubygems' require 'rubygems'
require 'rbtrace' require 'rbtrace'
if ENV['IMPROVED_SPEC_DEBUGGING']
require 'pry'
require 'pry-byebug'
require 'pry-rails'
end
# Loading more in this block will cause your tests to run faster. However, # Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll # if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect. # need to restart spork for it take effect.