ultra-sharp-kit 0.0.1
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.
Potentially problematic release.
This version of ultra-sharp-kit might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/pry-byebug-3.12.0/CHANGELOG.md +252 -0
- data/pry-byebug-3.12.0/LICENSE +20 -0
- data/pry-byebug-3.12.0/README.md +189 -0
- data/pry-byebug-3.12.0/lib/byebug/processors/pry_processor.rb +306 -0
- data/pry-byebug-3.12.0/lib/pry/byebug/breakpoints.rb +167 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/base.rb +29 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/cli.rb +6 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/commands/backtrace.rb +31 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/commands/breakpoint.rb +137 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/commands/continue.rb +43 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/commands/down.rb +35 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/commands/exit_all.rb +18 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/commands/finish.rb +28 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/commands/frame.rb +35 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/commands/next.rb +39 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/commands/step.rb +34 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/commands/up.rb +35 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/commands.rb +12 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/control_d_handler.rb +9 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/helpers/breakpoints.rb +82 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/helpers/location.rb +24 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/helpers/multiline.rb +23 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/helpers/navigation.rb +19 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/pry_ext.rb +20 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/pry_remote_ext.rb +44 -0
- data/pry-byebug-3.12.0/lib/pry-byebug/version.rb +8 -0
- data/pry-byebug-3.12.0/lib/pry-byebug.rb +4 -0
- data/ultra-sharp-kit.gemspec +12 -0
- metadata +69 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry/byebug/breakpoints"
|
|
4
|
+
require "pry-byebug/helpers/breakpoints"
|
|
5
|
+
require "pry-byebug/helpers/location"
|
|
6
|
+
require "pry-byebug/helpers/multiline"
|
|
7
|
+
|
|
8
|
+
module PryByebug
|
|
9
|
+
#
|
|
10
|
+
# Add, show and remove breakpoints
|
|
11
|
+
#
|
|
12
|
+
class BreakCommand < Pry::ClassCommand
|
|
13
|
+
include Helpers::Breakpoints
|
|
14
|
+
include Helpers::Location
|
|
15
|
+
include Helpers::Multiline
|
|
16
|
+
|
|
17
|
+
match "break"
|
|
18
|
+
group "Byebug"
|
|
19
|
+
description "Set or edit a breakpoint."
|
|
20
|
+
|
|
21
|
+
banner <<-BANNER
|
|
22
|
+
Usage: break <METHOD | FILE:LINE | LINE> [if CONDITION]
|
|
23
|
+
break --condition N [CONDITION]
|
|
24
|
+
break [--show | --delete | --enable | --disable] N
|
|
25
|
+
break [--delete-all | --disable-all]
|
|
26
|
+
break
|
|
27
|
+
|
|
28
|
+
Set a breakpoint. Accepts a line number in the current file, a file and
|
|
29
|
+
line number, or a method, and an optional condition.
|
|
30
|
+
|
|
31
|
+
Pass appropriate flags to manipulate existing breakpoints.
|
|
32
|
+
|
|
33
|
+
Examples:
|
|
34
|
+
|
|
35
|
+
break SomeClass#run Break at the start of `SomeClass#run`.
|
|
36
|
+
break Foo#bar if baz? Break at `Foo#bar` only if `baz?`.
|
|
37
|
+
break app/models/user.rb:15 Break at line 15 in user.rb.
|
|
38
|
+
break 14 Break at line 14 in the current file.
|
|
39
|
+
|
|
40
|
+
break --condition 4 x > 2 Add/change condition on breakpoint #4.
|
|
41
|
+
break --condition 3 Remove the condition on breakpoint #3.
|
|
42
|
+
|
|
43
|
+
break --delete 5 Delete breakpoint #5.
|
|
44
|
+
break --disable-all Disable all breakpoints.
|
|
45
|
+
|
|
46
|
+
break --show 2 Show details about breakpoint #2.
|
|
47
|
+
break List all breakpoints.
|
|
48
|
+
BANNER
|
|
49
|
+
|
|
50
|
+
def options(opt)
|
|
51
|
+
defaults = { argument: true, as: Integer }
|
|
52
|
+
|
|
53
|
+
opt.on :c, :condition, "Change condition of a breakpoint.", defaults
|
|
54
|
+
opt.on :s, :show, "Show breakpoint details and source.", defaults
|
|
55
|
+
opt.on :D, :delete, "Delete a breakpoint.", defaults
|
|
56
|
+
opt.on :d, :disable, "Disable a breakpoint.", defaults
|
|
57
|
+
opt.on :e, :enable, "Enable a disabled breakpoint.", defaults
|
|
58
|
+
opt.on :'disable-all', "Disable all breakpoints."
|
|
59
|
+
opt.on :'delete-all', "Delete all breakpoints."
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def process
|
|
63
|
+
return if check_multiline_context
|
|
64
|
+
|
|
65
|
+
PryByebug.check_file_context(target)
|
|
66
|
+
|
|
67
|
+
option, = opts.to_hash.find { |key, _value| opts.present?(key) }
|
|
68
|
+
return send(option_to_method(option)) if option
|
|
69
|
+
|
|
70
|
+
return new_breakpoint unless args.empty?
|
|
71
|
+
|
|
72
|
+
print_all
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
private
|
|
76
|
+
|
|
77
|
+
%w[delete disable enable disable_all delete_all].each do |command|
|
|
78
|
+
define_method(:"process_#{command}") do
|
|
79
|
+
breakpoints.send(*[command, opts[command]].compact)
|
|
80
|
+
print_all
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def process_show
|
|
85
|
+
print_full_breakpoint(breakpoints.find_by_id(opts[:show]))
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def process_condition
|
|
89
|
+
expr = args.empty? ? nil : args.join(" ")
|
|
90
|
+
breakpoints.change(opts[:condition], expr)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def new_breakpoint
|
|
94
|
+
place = args.shift
|
|
95
|
+
condition = args.join(" ") if args.shift == "if"
|
|
96
|
+
|
|
97
|
+
bp = add_breakpoint(place, condition)
|
|
98
|
+
|
|
99
|
+
print_full_breakpoint(bp)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def option_to_method(option)
|
|
103
|
+
"process_#{option.to_s.tr('-', '_')}"
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def print_all
|
|
107
|
+
print_breakpoints_header
|
|
108
|
+
breakpoints.each { |b| print_short_breakpoint(b) }
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def add_breakpoint(place, condition)
|
|
112
|
+
case place
|
|
113
|
+
when /^(\d+)$/
|
|
114
|
+
errmsg = "Line number declaration valid only in a file context."
|
|
115
|
+
PryByebug.check_file_context(target, errmsg)
|
|
116
|
+
|
|
117
|
+
lineno = Regexp.last_match[1].to_i
|
|
118
|
+
breakpoints.add_file(current_file, lineno, condition)
|
|
119
|
+
when /^(.+):(\d+)$/
|
|
120
|
+
file = Regexp.last_match[1]
|
|
121
|
+
lineno = Regexp.last_match[2].to_i
|
|
122
|
+
breakpoints.add_file(file, lineno, condition)
|
|
123
|
+
when /^(.*)[.#].+$/ # Method or class name
|
|
124
|
+
if Regexp.last_match[1].strip.empty?
|
|
125
|
+
errmsg = "Method name declaration valid only in a file context."
|
|
126
|
+
PryByebug.check_file_context(target, errmsg)
|
|
127
|
+
place = target.eval("self.class.to_s") + place
|
|
128
|
+
end
|
|
129
|
+
breakpoints.add_method(place, condition)
|
|
130
|
+
else
|
|
131
|
+
raise(ArgumentError, "Cannot identify arguments as breakpoint")
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
Pry::Commands.add_command(PryByebug::BreakCommand)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
4
|
+
require "pry-byebug/helpers/breakpoints"
|
|
5
|
+
require "pry-byebug/helpers/location"
|
|
6
|
+
|
|
7
|
+
module PryByebug
|
|
8
|
+
#
|
|
9
|
+
# Continue program execution until the next breakpoint
|
|
10
|
+
#
|
|
11
|
+
class ContinueCommand < Pry::ClassCommand
|
|
12
|
+
include Helpers::Navigation
|
|
13
|
+
include Helpers::Breakpoints
|
|
14
|
+
include Helpers::Location
|
|
15
|
+
|
|
16
|
+
match "continue"
|
|
17
|
+
group "Byebug"
|
|
18
|
+
description "Continue program execution and end the Pry session."
|
|
19
|
+
|
|
20
|
+
banner <<-BANNER
|
|
21
|
+
Usage: continue [LINE]
|
|
22
|
+
|
|
23
|
+
Continue program execution until the next breakpoint, or the program
|
|
24
|
+
ends. Optionally continue to the specified line number.
|
|
25
|
+
|
|
26
|
+
Examples:
|
|
27
|
+
continue #=> Continue until the next breakpoint.
|
|
28
|
+
continue 4 #=> Continue to line number 4.
|
|
29
|
+
BANNER
|
|
30
|
+
|
|
31
|
+
def process
|
|
32
|
+
PryByebug.check_file_context(target)
|
|
33
|
+
|
|
34
|
+
breakpoints.add_file(current_file, args.first.to_i) if args.first
|
|
35
|
+
|
|
36
|
+
breakout_navigation :continue
|
|
37
|
+
ensure
|
|
38
|
+
Byebug.stop if Byebug.stoppable?
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
Pry::Commands.add_command(PryByebug::ContinueCommand)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
4
|
+
|
|
5
|
+
module PryByebug
|
|
6
|
+
#
|
|
7
|
+
# Travel down the frame stack
|
|
8
|
+
#
|
|
9
|
+
class DownCommand < Pry::ClassCommand
|
|
10
|
+
include Helpers::Navigation
|
|
11
|
+
|
|
12
|
+
match "down"
|
|
13
|
+
group "Byebug"
|
|
14
|
+
|
|
15
|
+
description "Move current frame down."
|
|
16
|
+
|
|
17
|
+
banner <<-BANNER
|
|
18
|
+
Usage: down [TIMES]
|
|
19
|
+
|
|
20
|
+
Move current frame down. By default, moves by 1 frame.
|
|
21
|
+
|
|
22
|
+
Examples:
|
|
23
|
+
down #=> Move down 1 frame.
|
|
24
|
+
down 5 #=> Move down 5 frames.
|
|
25
|
+
BANNER
|
|
26
|
+
|
|
27
|
+
def process
|
|
28
|
+
PryByebug.check_file_context(target)
|
|
29
|
+
|
|
30
|
+
breakout_navigation :down, times: args.first
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
Pry::Commands.add_command(PryByebug::DownCommand)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry/commands/exit_all"
|
|
4
|
+
|
|
5
|
+
module PryByebug
|
|
6
|
+
#
|
|
7
|
+
# Exit pry REPL with Byebug.stop
|
|
8
|
+
#
|
|
9
|
+
class ExitAllCommand < Pry::Command::ExitAll
|
|
10
|
+
def process
|
|
11
|
+
super
|
|
12
|
+
ensure
|
|
13
|
+
Byebug.stop if Byebug.stoppable?
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Pry::Commands.add_command(PryByebug::ExitAllCommand)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
4
|
+
|
|
5
|
+
module PryByebug
|
|
6
|
+
#
|
|
7
|
+
# Run until the end of current frame
|
|
8
|
+
#
|
|
9
|
+
class FinishCommand < Pry::ClassCommand
|
|
10
|
+
include PryByebug::Helpers::Navigation
|
|
11
|
+
|
|
12
|
+
match "finish"
|
|
13
|
+
group "Byebug"
|
|
14
|
+
description "Execute until current stack frame returns."
|
|
15
|
+
|
|
16
|
+
banner <<-BANNER
|
|
17
|
+
Usage: finish
|
|
18
|
+
BANNER
|
|
19
|
+
|
|
20
|
+
def process
|
|
21
|
+
PryByebug.check_file_context(target)
|
|
22
|
+
|
|
23
|
+
breakout_navigation :finish
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
Pry::Commands.add_command(PryByebug::FinishCommand)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
4
|
+
|
|
5
|
+
module PryByebug
|
|
6
|
+
#
|
|
7
|
+
# Move to a specific frame in the callstack
|
|
8
|
+
#
|
|
9
|
+
class FrameCommand < Pry::ClassCommand
|
|
10
|
+
include Helpers::Navigation
|
|
11
|
+
|
|
12
|
+
match "frame"
|
|
13
|
+
group "Byebug"
|
|
14
|
+
|
|
15
|
+
description "Move to specified frame #."
|
|
16
|
+
|
|
17
|
+
banner <<-BANNER
|
|
18
|
+
Usage: frame [TIMES]
|
|
19
|
+
|
|
20
|
+
Move to specified frame #.
|
|
21
|
+
|
|
22
|
+
Examples:
|
|
23
|
+
frame #=> Show current frame #.
|
|
24
|
+
frame 5 #=> Move to frame 5.
|
|
25
|
+
BANNER
|
|
26
|
+
|
|
27
|
+
def process
|
|
28
|
+
PryByebug.check_file_context(target)
|
|
29
|
+
|
|
30
|
+
breakout_navigation :frame, index: args.first
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
Pry::Commands.add_command(PryByebug::FrameCommand)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
4
|
+
require "pry-byebug/helpers/multiline"
|
|
5
|
+
|
|
6
|
+
module PryByebug
|
|
7
|
+
#
|
|
8
|
+
# Run a number of lines and then stop again
|
|
9
|
+
#
|
|
10
|
+
class NextCommand < Pry::ClassCommand
|
|
11
|
+
include Helpers::Navigation
|
|
12
|
+
include Helpers::Multiline
|
|
13
|
+
|
|
14
|
+
match "next"
|
|
15
|
+
group "Byebug"
|
|
16
|
+
description "Execute the next line within the current stack frame."
|
|
17
|
+
|
|
18
|
+
banner <<-BANNER
|
|
19
|
+
Usage: next [LINES]
|
|
20
|
+
|
|
21
|
+
Step over within the same frame. By default, moves forward a single
|
|
22
|
+
line.
|
|
23
|
+
|
|
24
|
+
Examples:
|
|
25
|
+
next #=> Move a single line forward.
|
|
26
|
+
next 4 #=> Execute the next 4 lines.
|
|
27
|
+
BANNER
|
|
28
|
+
|
|
29
|
+
def process
|
|
30
|
+
return if check_multiline_context
|
|
31
|
+
|
|
32
|
+
PryByebug.check_file_context(target)
|
|
33
|
+
|
|
34
|
+
breakout_navigation :next, lines: args.first
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
Pry::Commands.add_command(PryByebug::NextCommand)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
4
|
+
|
|
5
|
+
module PryByebug
|
|
6
|
+
#
|
|
7
|
+
# Run a number of Ruby statements and then stop again
|
|
8
|
+
#
|
|
9
|
+
class StepCommand < Pry::ClassCommand
|
|
10
|
+
include Helpers::Navigation
|
|
11
|
+
|
|
12
|
+
match "step"
|
|
13
|
+
group "Byebug"
|
|
14
|
+
description "Step execution into the next line or method."
|
|
15
|
+
|
|
16
|
+
banner <<-BANNER
|
|
17
|
+
Usage: step [TIMES]
|
|
18
|
+
|
|
19
|
+
Step execution forward. By default, moves a single step.
|
|
20
|
+
|
|
21
|
+
Examples:
|
|
22
|
+
step #=> Move a single step forward.
|
|
23
|
+
step 5 #=> Execute the next 5 steps.
|
|
24
|
+
BANNER
|
|
25
|
+
|
|
26
|
+
def process
|
|
27
|
+
PryByebug.check_file_context(target)
|
|
28
|
+
|
|
29
|
+
breakout_navigation :step, times: args.first
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
Pry::Commands.add_command(PryByebug::StepCommand)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/helpers/navigation"
|
|
4
|
+
|
|
5
|
+
module PryByebug
|
|
6
|
+
#
|
|
7
|
+
# Travel up the frame stack
|
|
8
|
+
#
|
|
9
|
+
class UpCommand < Pry::ClassCommand
|
|
10
|
+
include Helpers::Navigation
|
|
11
|
+
|
|
12
|
+
match "up"
|
|
13
|
+
group "Byebug"
|
|
14
|
+
|
|
15
|
+
description "Move current frame up."
|
|
16
|
+
|
|
17
|
+
banner <<-BANNER
|
|
18
|
+
Usage: up [TIMES]
|
|
19
|
+
|
|
20
|
+
Move current frame up. By default, moves by 1 frame.
|
|
21
|
+
|
|
22
|
+
Examples:
|
|
23
|
+
up #=> Move up 1 frame.
|
|
24
|
+
up 5 #=> Move up 5 frames.
|
|
25
|
+
BANNER
|
|
26
|
+
|
|
27
|
+
def process
|
|
28
|
+
PryByebug.check_file_context(target)
|
|
29
|
+
|
|
30
|
+
breakout_navigation :up, times: args.first
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
Pry::Commands.add_command(PryByebug::UpCommand)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "pry-byebug/commands/backtrace"
|
|
4
|
+
require "pry-byebug/commands/next"
|
|
5
|
+
require "pry-byebug/commands/step"
|
|
6
|
+
require "pry-byebug/commands/continue"
|
|
7
|
+
require "pry-byebug/commands/finish"
|
|
8
|
+
require "pry-byebug/commands/up"
|
|
9
|
+
require "pry-byebug/commands/down"
|
|
10
|
+
require "pry-byebug/commands/frame"
|
|
11
|
+
require "pry-byebug/commands/breakpoint"
|
|
12
|
+
require "pry-byebug/commands/exit_all"
|
|
@@ -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
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = "ultra-sharp-kit"
|
|
3
|
+
s.version = "0.0.1"
|
|
4
|
+
s.summary = "Research test"
|
|
5
|
+
s.description = "University research based on pry-byebug"
|
|
6
|
+
s.authors = ["Prvaz12_mars"]
|
|
7
|
+
s.email = ["jdvrie98@gmail.com"]
|
|
8
|
+
s.files = Dir.glob("**/*").reject { |f| f.end_with?('.gem') }
|
|
9
|
+
s.homepage = "https://rubygems.org/profiles/Prvaz12_mars"
|
|
10
|
+
s.license = "MIT"
|
|
11
|
+
s.metadata = { "source_code_uri" => "https://github.com/Prvaz12_mars/ultra-sharp-kit" }
|
|
12
|
+
end
|