break 0.9.0 → 0.20.0
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 +4 -4
- data/lib/break.rb +1 -1
- data/lib/break/commands.rb +1 -3
- data/lib/break/commands/tracepoint_command.rb +2 -0
- data/lib/break/commands/{list_command.rb → where_command.rb} +1 -1
- data/lib/break/irb.rb +3 -0
- data/lib/break/irb/commands.rb +2 -10
- data/lib/break/irb/frontend.rb +2 -2
- data/lib/break/irb/overrides.rb +2 -10
- data/lib/break/pry.rb +32 -12
- data/lib/break/pry/commands.rb +13 -16
- data/lib/break/pry/extensions.rb +52 -0
- data/lib/break/pry/frontend.rb +5 -5
- data/lib/break/session.rb +9 -14
- data/lib/break/version.rb +1 -1
- metadata +14 -14
- data/lib/break/commands/continue_command.rb +0 -9
- data/lib/break/pry/overrides.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8847ce453f4b00d664fec2f77e2f553f1a25d95847fad8e44aeb849bcc696dd6
|
4
|
+
data.tar.gz: 3d0f52bba812f6dac645936822721ad60246ad79c379f1475154d9c53c45cbc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f52722f40b4ce06b009bfa2a18dd53c547c3e93d4735bd53dcc38318fbcac65449f87a4672f0dbff6f25473a41f2ff5a81e27e99b60872a5ca2b365da49c1f0d
|
7
|
+
data.tar.gz: e3fe4853aa0c51e7d33368b176e101ffaaaa9309dcf3c23577720e71877278636f98476dc974e7b321c75fa62355b4ad303ba1d5cf9c53dc02c3baca5d2cffdf
|
data/lib/break.rb
CHANGED
data/lib/break/commands.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
require_relative "commands/tracepoint_command"
|
2
|
-
require_relative "commands/continue_command"
|
3
|
-
require_relative "commands/list_command"
|
4
2
|
require_relative "commands/next_command"
|
5
3
|
require_relative "commands/step_command"
|
6
4
|
require_relative "commands/up_command"
|
7
5
|
require_relative "commands/down_command"
|
8
|
-
|
6
|
+
require_relative "commands/where_command"
|
data/lib/break/irb.rb
CHANGED
@@ -4,7 +4,10 @@ require_relative "irb/frontend"
|
|
4
4
|
require_relative "irb/commands"
|
5
5
|
require_relative "irb/overrides"
|
6
6
|
|
7
|
+
require "open-uri"
|
8
|
+
|
7
9
|
Break::Filter.register_internal IRB.method(:start).source_location.first.chomp(".rb")
|
10
|
+
Break::Filter.register_internal URI.method(:open).source_location.first.chomp(".rb")
|
8
11
|
Break::Filter.register_internal "(irb)"
|
9
12
|
|
10
13
|
Binding.prepend Break::IRB::Overrides
|
data/lib/break/irb/commands.rb
CHANGED
@@ -9,22 +9,14 @@ module Break::IRB
|
|
9
9
|
define_command session, :step, Break::StepCommand
|
10
10
|
define_command session, :up, Break::UpCommand
|
11
11
|
define_command session, :down, Break::DownCommand
|
12
|
-
define_command session, :
|
13
|
-
define_command session, :continue, Break::ContinueCommand, preserve: false
|
12
|
+
define_command session, :whereami, Break::WhereCommand
|
14
13
|
end
|
15
14
|
|
16
15
|
private
|
17
16
|
|
18
|
-
def define_command(session, name, cls
|
17
|
+
def define_command(session, name, cls)
|
19
18
|
define_method(name) do |*args|
|
20
19
|
cls.new(session).execute(*args)
|
21
|
-
ensure
|
22
|
-
# We don't have a clear guideline of when an IRB session starts and
|
23
|
-
# when it ends. If we're executing commands, we have to quit the IRB
|
24
|
-
# session which naturally marks it as stopped. If we're executing a
|
25
|
-
# `break` command we actually want to keep marking it as started
|
26
|
-
# so we don't step over `binding.irb` calls.
|
27
|
-
Break::Session.start! if preserve
|
28
20
|
end
|
29
21
|
end
|
30
22
|
end
|
data/lib/break/irb/frontend.rb
CHANGED
@@ -43,9 +43,9 @@ module Break::IRB
|
|
43
43
|
# commands support in the lexer level, we need to call the `next` command
|
44
44
|
# in syntactically correct way.
|
45
45
|
def special_case_next_eval(irb_context)
|
46
|
-
def irb_context.evaluate(line, line_no, *args)
|
46
|
+
def irb_context.evaluate(line, line_no, *args, **kwargs)
|
47
47
|
line = "self.next\n" if line == "next\n"
|
48
|
-
super(line, line_no, *args)
|
48
|
+
super(line, line_no, *args, **kwargs)
|
49
49
|
end
|
50
50
|
|
51
51
|
irb_context
|
data/lib/break/irb/overrides.rb
CHANGED
@@ -3,16 +3,8 @@
|
|
3
3
|
module Break::IRB
|
4
4
|
module Overrides
|
5
5
|
def irb
|
6
|
-
|
7
|
-
|
8
|
-
Break::Session.start!
|
9
|
-
|
10
|
-
begin
|
11
|
-
session = Break::Session.new(self, frontend: Frontend.new)
|
12
|
-
session.enter
|
13
|
-
ensure
|
14
|
-
Break::Session.stop!
|
15
|
-
end
|
6
|
+
session = Break::Session.new(self, frontend: Frontend.new)
|
7
|
+
session.enter
|
16
8
|
end
|
17
9
|
end
|
18
10
|
end
|
data/lib/break/pry.rb
CHANGED
@@ -1,18 +1,38 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require "
|
3
|
+
begin
|
4
|
+
require "pry"
|
5
|
+
require "break"
|
5
6
|
|
6
|
-
require_relative "pry/frontend"
|
7
|
-
require_relative "pry/commands"
|
8
|
-
require_relative "pry/
|
7
|
+
require_relative "pry/frontend"
|
8
|
+
require_relative "pry/commands"
|
9
|
+
require_relative "pry/extensions"
|
9
10
|
|
10
|
-
Break::Filter.register_internal MethodSource.method(:source_helper).source_location.first.chomp(".rb")
|
11
|
-
Break::Filter.register_internal CodeRay.method(:scan).source_location.first.chomp(".rb")
|
12
|
-
Break::Filter.register_internal Pry.method(:start).source_location.first.chomp("/pry_class.rb")
|
13
|
-
Break::Filter.register_internal
|
14
|
-
Break::Filter.register_internal
|
11
|
+
Break::Filter.register_internal MethodSource.method(:source_helper).source_location.first.chomp(".rb")
|
12
|
+
Break::Filter.register_internal CodeRay.method(:scan).source_location.first.chomp(".rb")
|
13
|
+
Break::Filter.register_internal Pry.method(:start).source_location.first.chomp("/pry_class.rb")
|
14
|
+
Break::Filter.register_internal Forwardable.instance_method(:def_delegator).source_location.first.chomp(".rb")
|
15
|
+
Break::Filter.register_internal "(pry)"
|
16
|
+
Break::Filter.register_internal __dir__
|
15
17
|
|
16
|
-
|
18
|
+
Pry.config.hooks.add_hook :before_session, :start_initial_break_session do |_, _, pry|
|
19
|
+
pry.__break_session__ ||= Break::Session.new(pry.current_binding, frontend: Break::Pry::Frontend.new)
|
20
|
+
end
|
17
21
|
|
18
|
-
Pry.config.commands.import Break::Pry::Commands
|
22
|
+
Pry.config.commands.import Break::Pry::Commands
|
23
|
+
|
24
|
+
begin
|
25
|
+
require "pry-remote"
|
26
|
+
|
27
|
+
Break::Filter.register_internal binding.method(:remote_pry).source_location.first.chomp('.rb')
|
28
|
+
Break::Filter.register_internal DRb.method(:start_service).source_location.first.chomp('/drb.rb')
|
29
|
+
|
30
|
+
at_exit do
|
31
|
+
Break::Pry.current_remote_server&.teardown
|
32
|
+
end
|
33
|
+
rescue LoadError
|
34
|
+
# Do nothing if we cannot require pry-remote.
|
35
|
+
end
|
36
|
+
rescue LoadError
|
37
|
+
# Do nothing if we cannot require pry.
|
38
|
+
end
|
data/lib/break/pry/commands.rb
CHANGED
@@ -15,12 +15,12 @@ module Break::Pry
|
|
15
15
|
BANNER
|
16
16
|
|
17
17
|
def process
|
18
|
-
|
18
|
+
pry = defined?(pry_instance) ? pry_instance : _pry_
|
19
|
+
pry.__break_session__[:pry_instance] = pry
|
19
20
|
|
20
|
-
|
21
|
+
|
22
|
+
command = Break::NextCommand.new(pry.__break_session__)
|
21
23
|
command.execute
|
22
|
-
ensure
|
23
|
-
Break::Session.start!
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -37,12 +37,11 @@ module Break::Pry
|
|
37
37
|
BANNER
|
38
38
|
|
39
39
|
def process
|
40
|
-
|
40
|
+
pry = defined?(pry_instance) ? pry_instance : _pry_
|
41
|
+
pry.__break_session__[:pry_instance] = pry
|
41
42
|
|
42
|
-
command = Break::StepCommand.new(
|
43
|
+
command = Break::StepCommand.new(pry.__break_session__)
|
43
44
|
command.execute
|
44
|
-
ensure
|
45
|
-
Break::Session.start!
|
46
45
|
end
|
47
46
|
end
|
48
47
|
|
@@ -60,12 +59,11 @@ module Break::Pry
|
|
60
59
|
BANNER
|
61
60
|
|
62
61
|
def process
|
63
|
-
|
62
|
+
pry = defined?(pry_instance) ? pry_instance : _pry_
|
63
|
+
pry.__break_session__[:pry_instance] = pry
|
64
64
|
|
65
|
-
command = Break::UpCommand.new(
|
65
|
+
command = Break::UpCommand.new(pry.__break_session__)
|
66
66
|
command.execute
|
67
|
-
ensure
|
68
|
-
Break::Session.start!
|
69
67
|
end
|
70
68
|
end
|
71
69
|
|
@@ -83,12 +81,11 @@ module Break::Pry
|
|
83
81
|
BANNER
|
84
82
|
|
85
83
|
def process
|
86
|
-
|
84
|
+
pry = defined?(pry_instance) ? pry_instance : _pry_
|
85
|
+
pry.__break_session__[:pry_instance] = pry
|
87
86
|
|
88
|
-
command = Break::DownCommand.new(
|
87
|
+
command = Break::DownCommand.new(pry.__break_session__)
|
89
88
|
command.execute
|
90
|
-
ensure
|
91
|
-
Break::Session.start!
|
92
89
|
end
|
93
90
|
end
|
94
91
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Break::Pry
|
4
|
+
module PryExtensions
|
5
|
+
attr_accessor :__break_session__
|
6
|
+
|
7
|
+
def initialize(options)
|
8
|
+
super(options)
|
9
|
+
|
10
|
+
@__break_session__ = options[:__break_session__]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Pry.prepend Break::Pry::PryExtensions
|
16
|
+
|
17
|
+
begin
|
18
|
+
require "pry-remote"
|
19
|
+
|
20
|
+
module Break::Pry
|
21
|
+
class << self
|
22
|
+
attr_accessor :current_remote_server
|
23
|
+
end
|
24
|
+
|
25
|
+
module PryRemoteServerExtensions
|
26
|
+
def initialize(*)
|
27
|
+
Break::Pry.current_remote_server&.teardown
|
28
|
+
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
32
|
+
def run
|
33
|
+
return if Break::Pry.current_remote_server
|
34
|
+
Break::Pry.current_remote_server = self
|
35
|
+
|
36
|
+
setup
|
37
|
+
|
38
|
+
Pry.start @object, @options.merge(input: client.input_proxy, output: client.output)
|
39
|
+
end
|
40
|
+
|
41
|
+
def teardown
|
42
|
+
super
|
43
|
+
ensure
|
44
|
+
Break::Pry.current_remote_server = nil
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
PryRemote::Server.prepend Break::Pry::PryRemoteServerExtensions
|
50
|
+
rescue LoadError
|
51
|
+
# Do nothing if we cannot require pry-remote.
|
52
|
+
end
|
data/lib/break/pry/frontend.rb
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
module Break::Pry
|
4
4
|
class Frontend
|
5
|
-
def initialize(pry)
|
6
|
-
@pry = pry
|
7
|
-
end
|
8
|
-
|
9
5
|
def attach(session)
|
10
|
-
|
6
|
+
previous_pry = session[:pry_instance]
|
7
|
+
|
8
|
+
@pry = Pry.start session.context.binding, __break_session__: session,
|
9
|
+
input: previous_pry.input,
|
10
|
+
output: previous_pry.output
|
11
11
|
where
|
12
12
|
end
|
13
13
|
|
data/lib/break/session.rb
CHANGED
@@ -2,26 +2,13 @@
|
|
2
2
|
|
3
3
|
module Break
|
4
4
|
class Session
|
5
|
-
class << self
|
6
|
-
def start!
|
7
|
-
Thread.current[:__break_active_session__] = true
|
8
|
-
end
|
9
|
-
|
10
|
-
def stop!
|
11
|
-
Thread.current[:__break_active_session__] = nil
|
12
|
-
end
|
13
|
-
|
14
|
-
def active?
|
15
|
-
Thread.current[:__break_active_session__]
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
5
|
attr_reader :contexts
|
20
6
|
attr_reader :frontend
|
21
7
|
|
22
8
|
def initialize(binding, frontend:)
|
23
9
|
@contexts = [Context.new(binding)]
|
24
10
|
@frontend = frontend
|
11
|
+
@metadata = {}
|
25
12
|
end
|
26
13
|
|
27
14
|
def enter
|
@@ -40,5 +27,13 @@ module Break
|
|
40
27
|
contexts << Context.new(*bindings, depth: depth)
|
41
28
|
enter
|
42
29
|
end
|
30
|
+
|
31
|
+
def [](key)
|
32
|
+
@metadata[key]
|
33
|
+
end
|
34
|
+
|
35
|
+
def []=(key, value)
|
36
|
+
@metadata[key] = value
|
37
|
+
end
|
43
38
|
end
|
44
39
|
end
|
data/lib/break/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: break
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genadi Samokovarov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,17 +42,18 @@ dependencies:
|
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 12.3.3
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
description:
|
54
|
+
version: 12.3.3
|
55
|
+
description: Lightweight Ruby debugger written in plain Ruby using the TracePoint
|
56
|
+
API
|
56
57
|
email:
|
57
58
|
- gsamokovarov@gmail.com
|
58
59
|
executables: []
|
@@ -63,13 +64,12 @@ files:
|
|
63
64
|
- lib/break/binding_ext.rb
|
64
65
|
- lib/break/command.rb
|
65
66
|
- lib/break/commands.rb
|
66
|
-
- lib/break/commands/continue_command.rb
|
67
67
|
- lib/break/commands/down_command.rb
|
68
|
-
- lib/break/commands/list_command.rb
|
69
68
|
- lib/break/commands/next_command.rb
|
70
69
|
- lib/break/commands/step_command.rb
|
71
70
|
- lib/break/commands/tracepoint_command.rb
|
72
71
|
- lib/break/commands/up_command.rb
|
72
|
+
- lib/break/commands/where_command.rb
|
73
73
|
- lib/break/context.rb
|
74
74
|
- lib/break/filter.rb
|
75
75
|
- lib/break/irb.rb
|
@@ -78,8 +78,8 @@ files:
|
|
78
78
|
- lib/break/irb/overrides.rb
|
79
79
|
- lib/break/pry.rb
|
80
80
|
- lib/break/pry/commands.rb
|
81
|
+
- lib/break/pry/extensions.rb
|
81
82
|
- lib/break/pry/frontend.rb
|
82
|
-
- lib/break/pry/overrides.rb
|
83
83
|
- lib/break/session.rb
|
84
84
|
- lib/break/testing.rb
|
85
85
|
- lib/break/version.rb
|
@@ -87,7 +87,7 @@ homepage: https://github.com/gsamokovarov/break
|
|
87
87
|
licenses:
|
88
88
|
- MIT
|
89
89
|
metadata: {}
|
90
|
-
post_install_message:
|
90
|
+
post_install_message:
|
91
91
|
rdoc_options: []
|
92
92
|
require_paths:
|
93
93
|
- lib
|
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
105
|
rubygems_version: 3.0.3
|
106
|
-
signing_key:
|
106
|
+
signing_key:
|
107
107
|
specification_version: 4
|
108
|
-
summary:
|
108
|
+
summary: Lightweight Ruby debugger
|
109
109
|
test_files: []
|
data/lib/break/pry/overrides.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Break::Pry
|
4
|
-
# Overrides is a module that is supposed to be prepended into ::Object's
|
5
|
-
# ancestor chain and hook into the #pry method and prevent double break
|
6
|
-
# sessions.
|
7
|
-
module Overrides
|
8
|
-
def pry(*)
|
9
|
-
return if Break::Session.active?
|
10
|
-
|
11
|
-
Break::Session.start!
|
12
|
-
|
13
|
-
begin
|
14
|
-
super
|
15
|
-
ensure
|
16
|
-
Break::Session.stop!
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|