pry-byebug-reloaded 3.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +230 -0
- data/LICENSE +20 -0
- data/README.md +195 -0
- data/lib/byebug/processors/pry_processor.rb +158 -0
- data/lib/pry/byebug/breakpoints.rb +167 -0
- data/lib/pry-byebug/base.rb +29 -0
- data/lib/pry-byebug/cli.rb +6 -0
- data/lib/pry-byebug/commands/backtrace.rb +31 -0
- data/lib/pry-byebug/commands/breakpoint.rb +137 -0
- data/lib/pry-byebug/commands/continue.rb +43 -0
- data/lib/pry-byebug/commands/down.rb +35 -0
- data/lib/pry-byebug/commands/exit_all.rb +18 -0
- data/lib/pry-byebug/commands/finish.rb +28 -0
- data/lib/pry-byebug/commands/frame.rb +35 -0
- data/lib/pry-byebug/commands/next.rb +39 -0
- data/lib/pry-byebug/commands/step.rb +34 -0
- data/lib/pry-byebug/commands/up.rb +35 -0
- data/lib/pry-byebug/commands.rb +12 -0
- data/lib/pry-byebug/control_d_handler.rb +9 -0
- data/lib/pry-byebug/helpers/breakpoints.rb +82 -0
- data/lib/pry-byebug/helpers/location.rb +24 -0
- data/lib/pry-byebug/helpers/multiline.rb +23 -0
- data/lib/pry-byebug/helpers/navigation.rb +19 -0
- data/lib/pry-byebug/pry_ext.rb +20 -0
- data/lib/pry-byebug/pry_remote_ext.rb +44 -0
- data/lib/pry-byebug/version.rb +8 -0
- data/lib/pry-byebug.rb +4 -0
- metadata +108 -0
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug"
|
4
|
+
|
5
|
+
module PryByebug
|
6
|
+
module Helpers
|
7
|
+
#
|
8
|
+
# Common helpers for breakpoint related commands
|
9
|
+
#
|
10
|
+
module Breakpoints
|
11
|
+
#
|
12
|
+
# Byebug's array of breakpoints.
|
13
|
+
#
|
14
|
+
def breakpoints
|
15
|
+
Pry::Byebug::Breakpoints
|
16
|
+
end
|
17
|
+
|
18
|
+
#
|
19
|
+
# Prints a message with bold font.
|
20
|
+
#
|
21
|
+
def bold_puts(msg)
|
22
|
+
output.puts(bold(msg))
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# Print out full information about a breakpoint.
|
27
|
+
#
|
28
|
+
# Includes surrounding code at that point.
|
29
|
+
#
|
30
|
+
def print_full_breakpoint(breakpoint)
|
31
|
+
header = "Breakpoint #{breakpoint.id}:"
|
32
|
+
status = breakpoint.enabled? ? "Enabled" : "Disabled"
|
33
|
+
code = breakpoint.source_code.with_line_numbers.to_s
|
34
|
+
condition = if breakpoint.expr
|
35
|
+
"#{bold('Condition:')} #{breakpoint.expr}\n"
|
36
|
+
else
|
37
|
+
""
|
38
|
+
end
|
39
|
+
|
40
|
+
output.puts <<-BREAKPOINT.gsub(/ {8}/, "")
|
41
|
+
|
42
|
+
#{bold(header)} #{breakpoint} (#{status}) #{condition}
|
43
|
+
|
44
|
+
#{code}
|
45
|
+
|
46
|
+
BREAKPOINT
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# Print out concise information about a breakpoint.
|
51
|
+
#
|
52
|
+
def print_short_breakpoint(breakpoint)
|
53
|
+
id = format("%*d", max_width, breakpoint.id)
|
54
|
+
status = breakpoint.enabled? ? "Yes" : "No "
|
55
|
+
expr = breakpoint.expr ? " #{breakpoint.expr} " : ""
|
56
|
+
|
57
|
+
output.puts(" #{id} #{status} #{breakpoint}#{expr}")
|
58
|
+
end
|
59
|
+
|
60
|
+
#
|
61
|
+
# Prints a header for the breakpoint list.
|
62
|
+
#
|
63
|
+
def print_breakpoints_header
|
64
|
+
header = "#{' ' * (max_width - 1)}# Enabled At "
|
65
|
+
|
66
|
+
output.puts <<-BREAKPOINTS.gsub(/ {8}/, "")
|
67
|
+
|
68
|
+
#{bold(header)}
|
69
|
+
#{bold('-' * header.size)}
|
70
|
+
|
71
|
+
BREAKPOINTS
|
72
|
+
end
|
73
|
+
|
74
|
+
#
|
75
|
+
# Max width of breakpoints id column
|
76
|
+
#
|
77
|
+
def max_width
|
78
|
+
breakpoints.last ? breakpoints.last.id.to_s.length : 1
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PryByebug
|
4
|
+
module Helpers
|
5
|
+
#
|
6
|
+
# Compatibility helper to handle source location
|
7
|
+
#
|
8
|
+
module Location
|
9
|
+
module_function
|
10
|
+
|
11
|
+
#
|
12
|
+
# Current file in the target binding. Used as the default breakpoint
|
13
|
+
# location.
|
14
|
+
#
|
15
|
+
def current_file(source = target)
|
16
|
+
# Guard clause for Ruby >= 2.6 providing now Binding#source_location ...
|
17
|
+
return source.source_location[0] if source.respond_to?(:source_location)
|
18
|
+
|
19
|
+
# ... to avoid warning: 'eval may not return location in binding'
|
20
|
+
source.eval("__FILE__")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PryByebug
|
4
|
+
module Helpers
|
5
|
+
#
|
6
|
+
# Helpers to help handling multiline inputs
|
7
|
+
#
|
8
|
+
module Multiline
|
9
|
+
#
|
10
|
+
# Returns true if we are in a multiline context and, as a side effect,
|
11
|
+
# updates the partial evaluation string with the current input.
|
12
|
+
#
|
13
|
+
# Returns false otherwise
|
14
|
+
#
|
15
|
+
def check_multiline_context
|
16
|
+
return false if eval_string.empty?
|
17
|
+
|
18
|
+
eval_string.replace("#{eval_string}#{match} #{arg_string}\n")
|
19
|
+
true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PryByebug
|
4
|
+
module Helpers
|
5
|
+
#
|
6
|
+
# Helpers to aid breaking out of the REPL loop
|
7
|
+
#
|
8
|
+
module Navigation
|
9
|
+
#
|
10
|
+
# Breaks out of the REPL loop and signals tracer
|
11
|
+
#
|
12
|
+
def breakout_navigation(action, options = {})
|
13
|
+
pry_instance.binding_stack.clear
|
14
|
+
|
15
|
+
throw :breakout_nav, action: action, options: options, pry: pry_instance
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "byebug/processors/pry_processor"
|
4
|
+
|
5
|
+
class << Pry::REPL
|
6
|
+
alias start_without_pry_byebug start
|
7
|
+
|
8
|
+
def start_with_pry_byebug(options = {})
|
9
|
+
target = options[:target]
|
10
|
+
|
11
|
+
if target.is_a?(Binding) && PryByebug.file_context?(target)
|
12
|
+
Byebug::PryProcessor.start unless ENV["DISABLE_PRY"]
|
13
|
+
else
|
14
|
+
# No need for the tracer unless we have a file context to step through
|
15
|
+
start_without_pry_byebug(options)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
alias start start_with_pry_byebug
|
20
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "pry-remote"
|
4
|
+
|
5
|
+
module PryRemote
|
6
|
+
#
|
7
|
+
# Overrides PryRemote::Server
|
8
|
+
#
|
9
|
+
class Server
|
10
|
+
#
|
11
|
+
# Override the call to Pry.start to save off current Server, and not
|
12
|
+
# teardown the server right after Pry.start finishes.
|
13
|
+
#
|
14
|
+
def run
|
15
|
+
raise("Already running a pry-remote session!") if
|
16
|
+
PryByebug.current_remote_server
|
17
|
+
|
18
|
+
PryByebug.current_remote_server = self
|
19
|
+
|
20
|
+
setup
|
21
|
+
Pry.start @object, input: client.input_proxy, output: client.output
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
# Override to reset our saved global current server session.
|
26
|
+
#
|
27
|
+
alias teardown_without_pry_byebug teardown
|
28
|
+
def teardown_with_pry_byebug
|
29
|
+
return if @torn
|
30
|
+
|
31
|
+
teardown_without_pry_byebug
|
32
|
+
PryByebug.current_remote_server = nil
|
33
|
+
@torn = true
|
34
|
+
end
|
35
|
+
alias teardown teardown_with_pry_byebug
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Ensure cleanup when a program finishes without another break. For example,
|
40
|
+
# 'next' on the last line of a program won't hit Byebug::PryProcessor#run,
|
41
|
+
# which normally handles cleanup.
|
42
|
+
at_exit do
|
43
|
+
PryByebug.current_remote_server&.teardown
|
44
|
+
end
|
data/lib/pry-byebug.rb
ADDED
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pry-byebug-reloaded
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.10.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Rodríguez
|
8
|
+
- Gopal Patel
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2023-12-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: byebug
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '11.0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '11.0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: pry
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0.13'
|
35
|
+
- - "<"
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0.15'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0.13'
|
45
|
+
- - "<"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.15'
|
48
|
+
description: |-
|
49
|
+
Combine 'pry' with 'byebug'. Adds 'step', 'next', 'finish',
|
50
|
+
'continue' and 'break' commands to control execution.
|
51
|
+
email: deivid.rodriguez@gmail.com
|
52
|
+
executables: []
|
53
|
+
extensions: []
|
54
|
+
extra_rdoc_files:
|
55
|
+
- CHANGELOG.md
|
56
|
+
- README.md
|
57
|
+
files:
|
58
|
+
- CHANGELOG.md
|
59
|
+
- LICENSE
|
60
|
+
- README.md
|
61
|
+
- lib/byebug/processors/pry_processor.rb
|
62
|
+
- lib/pry-byebug.rb
|
63
|
+
- lib/pry-byebug/base.rb
|
64
|
+
- lib/pry-byebug/cli.rb
|
65
|
+
- lib/pry-byebug/commands.rb
|
66
|
+
- lib/pry-byebug/commands/backtrace.rb
|
67
|
+
- lib/pry-byebug/commands/breakpoint.rb
|
68
|
+
- lib/pry-byebug/commands/continue.rb
|
69
|
+
- lib/pry-byebug/commands/down.rb
|
70
|
+
- lib/pry-byebug/commands/exit_all.rb
|
71
|
+
- lib/pry-byebug/commands/finish.rb
|
72
|
+
- lib/pry-byebug/commands/frame.rb
|
73
|
+
- lib/pry-byebug/commands/next.rb
|
74
|
+
- lib/pry-byebug/commands/step.rb
|
75
|
+
- lib/pry-byebug/commands/up.rb
|
76
|
+
- lib/pry-byebug/control_d_handler.rb
|
77
|
+
- lib/pry-byebug/helpers/breakpoints.rb
|
78
|
+
- lib/pry-byebug/helpers/location.rb
|
79
|
+
- lib/pry-byebug/helpers/multiline.rb
|
80
|
+
- lib/pry-byebug/helpers/navigation.rb
|
81
|
+
- lib/pry-byebug/pry_ext.rb
|
82
|
+
- lib/pry-byebug/pry_remote_ext.rb
|
83
|
+
- lib/pry-byebug/version.rb
|
84
|
+
- lib/pry/byebug/breakpoints.rb
|
85
|
+
homepage: https://github.com/Jack12816/pry-byebug-reloaded
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 2.5.0
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubygems_version: 3.3.8
|
105
|
+
signing_key:
|
106
|
+
specification_version: 4
|
107
|
+
summary: Fast debugging with Pry.
|
108
|
+
test_files: []
|