Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: deivid-rodriguez/pry-byebug
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: Jack12816/pry-byebug-reloaded
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 2 commits
  • 12 files changed
  • 1 contributor

Commits on Dec 7, 2023

  1. Forked the gem.

    Signed-off-by: Hermann Mayer <hermann.mayer92@gmail.com>
    Jack12816 committed Dec 7, 2023
    Copy the full SHA
    9b179b7 View commit details

Commits on Dec 8, 2023

  1. Appled #339.

    Signed-off-by: Hermann Mayer <hermann.mayer92@gmail.com>
    Jack12816 committed Dec 8, 2023
    Copy the full SHA
    fdf48d3 View commit details
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@ gemspec
group :development do
gem "rake", "~> 13.0"

gem "chandler", "0.9.0"
gem "mdl", "0.11.0"
gem "minitest", "~> 5.14"
gem "minitest-bisect", "~> 1.5"
25 changes: 4 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
PATH
remote: .
specs:
pry-byebug (3.10.1)
pry-byebug-reloaded (3.10.2)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)

GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.2)
byebug (11.1.3)
chandler (0.9.0)
netrc
octokit (>= 2.2.0)
chef-utils (16.4.41)
coderay (1.1.3)
faraday (1.0.0)
multipart-post (>= 1.2, < 3)
json (2.6.2)
kramdown (2.3.1)
rexml
@@ -42,19 +35,13 @@ GEM
tomlrb
mixlib-shellout (3.1.4)
chef-utils
multipart-post (2.1.1)
netrc (0.11.0)
octokit (4.15.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
parallel (1.22.1)
parser (3.1.2.1)
ast (~> 2.4.1)
path_expander (1.1.1)
pry (0.14.1)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (4.0.7)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.5.0)
@@ -72,21 +59,17 @@ GEM
rubocop-ast (1.21.0)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
sawyer (0.8.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
tomlrb (1.3.0)
unicode-display_width (2.2.0)

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
chandler (= 0.9.0)
mdl (= 0.11.0)
minitest (~> 5.14)
minitest-bisect (~> 1.5)
pry-byebug!
pry-byebug-reloaded!
rake (~> 13.0)
rubocop (~> 1.0)

40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# pry-byebug
# pry-byebug-reloaded

[![Version][VersionBadge]][VersionURL]
[![Build][CIBadge]][CIURL]
[![Inline docs][InchCIBadge]][InchCIURL]

A version-relaxed fork of
[pry-byebug-reloaded](https://github.com/deivid-rodriguez/pry-byebug) with some patches
applied:

* https://github.com/deivid-rodriguez/pry-byebug-reloaded/pull/339

Adds step-by-step debugging and stack navigation capabilities to [pry] using
[byebug].

@@ -29,7 +35,7 @@ MRI 2.4.0 or higher.
Add

```ruby
gem 'pry-byebug'
gem 'pry-byebug-reloaded'
```

to your Gemfile and run
@@ -73,7 +79,7 @@ current frame.

## Matching Byebug Behaviour

If you're coming from Byebug or from Pry-Byebug versions previous to 3.0, you
If you're coming from Byebug or from pry-byebug-reloaded versions previous to 3.0, you
may be lacking the 'n', 's', 'c' and 'f' aliases for the stepping commands.
These aliases were removed by default because they usually conflict with
scratch variable names. But it's very easy to reenable them if you still want
@@ -130,8 +136,8 @@ Type `break --help` from a Pry session to see all available options.

## Alternatives

Note that all of the alternatives here are incompatible with pry-byebug. If
your platform is supported by pry-byebug, you should remove any of the gems
Note that all of the alternatives here are incompatible with pry-byebug-reloaded. If
your platform is supported by pry-byebug-reloaded, you should remove any of the gems
mentioned here if they are present in your Gemfile.

* [pry-debugger]: Provides step-by-step debugging for MRI 1.9.3 or older
@@ -150,14 +156,14 @@ See [Getting Started with Development](CONTRIBUTING.md).

## Funding

Subscribe to [Tidelift] to ensure pry-byebug stays actively maintained, and at
Subscribe to [Tidelift] to ensure pry-byebug-reloaded stays actively maintained, and at
the same time get licensing assurances and timely security notifications for
your open source dependencies.

You can also help `pry-byebug` by leaving a small (or big) tip through [Liberapay].
You can also help `pry-byebug-reloaded` by leaving a small (or big) tip through [Liberapay].

[Tidelift]: https://tidelift.com/subscription/pkg/rubygems-pry-byebug?utm_source=rubygems-pry-byebug&utm_medium=referral&utm_campaign=readme
[Liberapay]: https://liberapay.com/pry-byebug/donate
[Tidelift]: https://tidelift.com/subscription/pkg/rubygems-pry-byebug-reloaded?utm_source=rubygems-pry-byebug-reloaded&utm_medium=referral&utm_campaign=readme
[Liberapay]: https://liberapay.com/pry-byebug-reloaded/donate

## Security contact information

@@ -169,21 +175,21 @@ Tidelift will coordinate the fix and disclosure.
## Credits

* Gopal Patel (@nixme), creator of [pry-debugger], and everybody who contributed
to it. pry-byebug is a fork of pry-debugger so it wouldn't exist as it is
to it. pry-byebug-reloaded is a fork of pry-debugger so it wouldn't exist as it is
without those contributions.
* John Mair (@banister), creator of [pry].

Patches and bug reports are welcome.

[pry]: https://pry.github.io
[byebug]: https://github.com/deivid-rodriguez/byebug
[byebug]: https://github.com/Jack12816/byebug
[pry-debugger]: https://github.com/nixme/pry-debugger
[pry-nav]: https://github.com/nixme/pry-nav
[pry-stack_explorer]: https://github.com/pry/pry-stack_explorer

[VersionBadge]: https://badge.fury.io/rb/pry-byebug.svg
[VersionURL]: http://badge.fury.io/rb/pry-byebug
[CIBadge]: https://github.com/deivid-rodriguez/pry-byebug/workflows/ubuntu/badge.svg?branch=master
[CIURL]: https://github.com/deivid-rodriguez/pry-byebug/actions?query=workflow%3Aubuntu
[InchCIBadge]: http://inch-ci.org/github/deivid-rodriguez/pry-byebug.svg?branch=master
[InchCIURL]: http://inch-ci.org/github/deivid-rodriguez/pry-byebug
[VersionBadge]: https://badge.fury.io/rb/pry-byebug-reloaded.svg
[VersionURL]: http://badge.fury.io/rb/pry-byebug-reloaded
[CIBadge]: https://github.com/Jack12816/pry-byebug-reloaded/workflows/ubuntu/badge.svg?branch=master
[CIURL]: https://github.com/Jack12816/pry-byebug-reloaded/actions?query=workflow%3Aubuntu
[InchCIBadge]: http://inch-ci.org/github/Jack12816/pry-byebug-reloaded.svg?branch=master
[InchCIURL]: http://inch-ci.org/github/Jack12816/pry-byebug-reloaded
6 changes: 0 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "chandler/tasks"
require "rake/testtask"
require "rubocop/rake_task"

#
# Add chandler as a prerequisite for `rake release`
#
task "release:rubygem_push" => "chandler:push"

desc "Run tests"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
48 changes: 48 additions & 0 deletions lib/byebug/processors/pry_remote_processor.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true

require "byebug/core"

module Byebug
#
# Extends the PryProcessor to make it work with Pry-Remote
#
class PryRemoteProcessor < PryProcessor
def self.start
super

Byebug.current_context.step_out(5, true)
end

def resume_pry
new_binding = frame._binding

run do
return unless server

if defined?(@pry) && @pry
@pry.repl(new_binding)
else
@pry = Pry::REPL.start_without_pry_byebug(target: new_binding,
input: input,
output: output)
end
end
rescue Errno::ECONNREFUSED
nil
end

private

def input
server.client.input_proxy
end

def output
server.client.output
end

def server
PryByebug.current_remote_server
end
end
end
4 changes: 3 additions & 1 deletion lib/pry-byebug/base.rb
Original file line number Diff line number Diff line change
@@ -7,7 +7,9 @@
#
module PryByebug
# Reference to currently running pry-remote server. Used by the processor.
attr_accessor :current_remote_server
class << self
attr_accessor :current_remote_server
end

module_function

1 change: 1 addition & 0 deletions lib/pry-byebug/commands/exit_all.rb
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ class ExitAllCommand < Pry::Command::ExitAll
def process
super
ensure
PryByebug.current_remote_server&.teardown
Byebug.stop if Byebug.stoppable?
end
end
1 change: 1 addition & 0 deletions lib/pry-byebug/commands/finish.rb
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ class FinishCommand < Pry::ClassCommand
BANNER

def process
PryByebug.current_remote_server&.teardown
PryByebug.check_file_context(target)

breakout_navigation :finish
14 changes: 12 additions & 2 deletions lib/pry-byebug/pry_ext.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
# frozen_string_literal: true

require "byebug/processors/pry_processor"
require "byebug/processors/pry_remote_processor"

class << Pry::REPL
alias start_without_pry_byebug start

def start_with_pry_byebug(options = {})
target = options[:target]

if target.is_a?(Binding) && PryByebug.file_context?(target)
Byebug::PryProcessor.start unless ENV["DISABLE_PRY"]
if target.is_a?(Binding) && PryByebug.file_context?(target) && !ENV["DISABLE_PRY"]
if run_remote?
Byebug::PryRemoteProcessor.start
return start_without_pry_byebug(options)
end

Byebug::PryProcessor.start
else
# No need for the tracer unless we have a file context to step through
start_without_pry_byebug(options)
end
end

alias start start_with_pry_byebug

def run_remote?
PryByebug.current_remote_server
end
end
17 changes: 8 additions & 9 deletions lib/pry-byebug/pry_remote_ext.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

require "pry-remote"
require "pry-remote-reloaded"

module PryRemote
module PryRemoteReloaded
#
# Overrides PryRemote::Server
#
@@ -11,28 +11,27 @@ class Server
# Override the call to Pry.start to save off current Server, and not
# teardown the server right after Pry.start finishes.
#
alias original_run run
def run
raise("Already running a pry-remote session!") if
PryByebug.current_remote_server

PryByebug.current_remote_server = self

setup
Pry.start @object, input: client.input_proxy, output: client.output
catch(:breakout_nav) { original_run }
end

#
# Override to reset our saved global current server session.
#
alias teardown_without_pry_byebug teardown
def teardown_with_pry_byebug
return if @torn
alias original_teardown teardown
def teardown
original_teardown

teardown_without_pry_byebug
return if @torn
PryByebug.current_remote_server = nil
@torn = true
end
alias teardown teardown_with_pry_byebug
end
end

2 changes: 1 addition & 1 deletion lib/pry-byebug/version.rb
Original file line number Diff line number Diff line change
@@ -4,5 +4,5 @@
# Main container module for Pry-Byebug functionality
#
module PryByebug
VERSION = "3.10.1"
VERSION = "3.10.2"
end
6 changes: 3 additions & 3 deletions pry-byebug.gemspec
Original file line number Diff line number Diff line change
@@ -3,12 +3,12 @@
require File.dirname(__FILE__) + "/lib/pry-byebug/version"

Gem::Specification.new do |gem|
gem.name = "pry-byebug"
gem.name = "pry-byebug-reloaded"
gem.version = PryByebug::VERSION
gem.authors = ["David Rodríguez", "Gopal Patel"]
gem.email = "deivid.rodriguez@gmail.com"
gem.license = "MIT"
gem.homepage = "https://github.com/deivid-rodriguez/pry-byebug"
gem.homepage = "https://github.com/Jack12816/pry-byebug-reloaded"
gem.summary = "Fast debugging with Pry."
gem.description = "Combine 'pry' with 'byebug'. Adds 'step', 'next', 'finish',
'continue' and 'break' commands to control execution."
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
gem.executables = []

# Dependencies
gem.required_ruby_version = ">= 2.7.0"
gem.required_ruby_version = ">= 2.5.0"

gem.add_runtime_dependency "byebug", "~> 11.0"
gem.add_runtime_dependency "pry", ">= 0.13", "< 0.15"