pry-byebug-reloaded 3.10.1 → 3.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac5c1a8ef056c4fda6d4517ee478ddbc804b1f1cf1fc85b2cd851bb7ec8696fb
4
- data.tar.gz: eed33b1993ad70645eef3676c041022845c71fb2e3d61251a58bde53d3ce4de3
3
+ metadata.gz: cfffbb2ef748ad7fe06cd24a45ea92c8fa856fcfe721750dc8d04562b68dc7b8
4
+ data.tar.gz: 4d55be7aae55a7b229afa6ef511a984e7465c3ba6cb0608a0981ed507e8f6bac
5
5
  SHA512:
6
- metadata.gz: cd49c629b3b8b8fed2583ccfd60f4e0989d951d322e0715de367318cdc1757afb00270477e726b090372962da2922fe3a80a17b9f05076f9a5bb1938b06dbfb3
7
- data.tar.gz: 509840deca1bead6f397d8f737eceba6e3f6b3910a6dc7ce780f331fbcb00a605a9244c0a7d857b0b10b52a1618e667b40be8fe6eeea2949a35157c7f91bb678
6
+ metadata.gz: 30e84211d6818a52fa650c93ae52d487410932e633e45e2f2b75284cca9531f564d4649ed00643a55777a4dbbd4f9e85facae97d451b1520ef9d1de9cce64980
7
+ data.tar.gz: cfd11763708b7279ec12443d5bb016467f822480a6e8878b83820de5540ebfd7163337a373c40baf0f3edd44b8145753f154832a9ed9827a24d2211a0101313a
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "byebug/core"
4
+
5
+ module Byebug
6
+ #
7
+ # Extends the PryProcessor to make it work with Pry-Remote
8
+ #
9
+ class PryRemoteProcessor < PryProcessor
10
+ def self.start
11
+ super
12
+
13
+ Byebug.current_context.step_out(5, true)
14
+ end
15
+
16
+ def resume_pry
17
+ new_binding = frame._binding
18
+
19
+ run do
20
+ return unless server
21
+
22
+ if defined?(@pry) && @pry
23
+ @pry.repl(new_binding)
24
+ else
25
+ @pry = Pry::REPL.start_without_pry_byebug(target: new_binding,
26
+ input: input,
27
+ output: output)
28
+ end
29
+ end
30
+ rescue Errno::ECONNREFUSED
31
+ nil
32
+ end
33
+
34
+ private
35
+
36
+ def input
37
+ server.client.input_proxy
38
+ end
39
+
40
+ def output
41
+ server.client.output
42
+ end
43
+
44
+ def server
45
+ PryByebug.current_remote_server
46
+ end
47
+ end
48
+ end
@@ -7,7 +7,9 @@ require "pry-byebug/helpers/location"
7
7
  #
8
8
  module PryByebug
9
9
  # Reference to currently running pry-remote server. Used by the processor.
10
- attr_accessor :current_remote_server
10
+ class << self
11
+ attr_accessor :current_remote_server
12
+ end
11
13
 
12
14
  module_function
13
15
 
@@ -10,6 +10,7 @@ module PryByebug
10
10
  def process
11
11
  super
12
12
  ensure
13
+ PryByebug.current_remote_server&.teardown
13
14
  Byebug.stop if Byebug.stoppable?
14
15
  end
15
16
  end
@@ -18,6 +18,7 @@ module PryByebug
18
18
  BANNER
19
19
 
20
20
  def process
21
+ PryByebug.current_remote_server&.teardown
21
22
  PryByebug.check_file_context(target)
22
23
 
23
24
  breakout_navigation :finish
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "byebug/processors/pry_processor"
4
+ require "byebug/processors/pry_remote_processor"
4
5
 
5
6
  class << Pry::REPL
6
7
  alias start_without_pry_byebug start
@@ -8,8 +9,13 @@ class << Pry::REPL
8
9
  def start_with_pry_byebug(options = {})
9
10
  target = options[:target]
10
11
 
11
- if target.is_a?(Binding) && PryByebug.file_context?(target)
12
- Byebug::PryProcessor.start unless ENV["DISABLE_PRY"]
12
+ if target.is_a?(Binding) && PryByebug.file_context?(target) && !ENV["DISABLE_PRY"]
13
+ if run_remote?
14
+ Byebug::PryRemoteProcessor.start
15
+ return start_without_pry_byebug(options)
16
+ end
17
+
18
+ Byebug::PryProcessor.start
13
19
  else
14
20
  # No need for the tracer unless we have a file context to step through
15
21
  start_without_pry_byebug(options)
@@ -17,4 +23,8 @@ class << Pry::REPL
17
23
  end
18
24
 
19
25
  alias start start_with_pry_byebug
26
+
27
+ def run_remote?
28
+ PryByebug.current_remote_server
29
+ end
20
30
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "pry-remote"
3
+ require "pry-remote-reloaded"
4
4
 
5
- module PryRemote
5
+ module PryRemoteReloaded
6
6
  #
7
7
  # Overrides PryRemote::Server
8
8
  #
@@ -11,28 +11,27 @@ module PryRemote
11
11
  # Override the call to Pry.start to save off current Server, and not
12
12
  # teardown the server right after Pry.start finishes.
13
13
  #
14
+ alias original_run run
14
15
  def run
15
16
  raise("Already running a pry-remote session!") if
16
17
  PryByebug.current_remote_server
17
18
 
18
19
  PryByebug.current_remote_server = self
19
20
 
20
- setup
21
- Pry.start @object, input: client.input_proxy, output: client.output
21
+ catch(:breakout_nav) { original_run }
22
22
  end
23
23
 
24
24
  #
25
25
  # Override to reset our saved global current server session.
26
26
  #
27
- alias teardown_without_pry_byebug teardown
28
- def teardown_with_pry_byebug
29
- return if @torn
27
+ alias original_teardown teardown
28
+ def teardown
29
+ original_teardown
30
30
 
31
- teardown_without_pry_byebug
31
+ return if @torn
32
32
  PryByebug.current_remote_server = nil
33
33
  @torn = true
34
34
  end
35
- alias teardown teardown_with_pry_byebug
36
35
  end
37
36
  end
38
37
 
@@ -4,5 +4,5 @@
4
4
  # Main container module for Pry-Byebug functionality
5
5
  #
6
6
  module PryByebug
7
- VERSION = "3.10.1"
7
+ VERSION = "3.10.2"
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-byebug-reloaded
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.1
4
+ version: 3.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rodríguez
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-12-07 00:00:00.000000000 Z
12
+ date: 2023-12-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: byebug
@@ -59,6 +59,7 @@ files:
59
59
  - LICENSE
60
60
  - README.md
61
61
  - lib/byebug/processors/pry_processor.rb
62
+ - lib/byebug/processors/pry_remote_processor.rb
62
63
  - lib/pry-byebug.rb
63
64
  - lib/pry-byebug/base.rb
64
65
  - lib/pry-byebug/cli.rb