File tree Expand file tree Collapse file tree 8 files changed +75
-14
lines changed Expand file tree Collapse file tree 8 files changed +75
-14
lines changed Original file line number Diff line number Diff line change 1
1
PATH
2
2
remote: .
3
3
specs:
4
- pry-byebug-reloaded (3.10.1 )
4
+ pry-byebug-reloaded (3.10.2 )
5
5
byebug (~> 11.0 )
6
6
pry (>= 0.13 , < 0.15 )
7
7
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ class ExitAllCommand < Pry::Command::ExitAll
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
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ class FinishCommand < Pry::ClassCommand
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
Original file line number Diff line number Diff line change 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
7
8
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 )
16
22
end
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
Original file line number Diff line number Diff line change 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 @@ class Server
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
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments