break 0.9.1 → 0.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d19b577e2139f71aa7c0356cf5ffa4f8692f9741705f9c2947922b1cc82c2453
4
- data.tar.gz: f1fabd2a4e87bf30ea5ed3d4c7cc6c28e2af152b1dacdb15b147a1d6b3a7c417
3
+ metadata.gz: af4dd0d6737ce394ee1c9cccf79cb360f60d77cfb7d1868663795cc35558a7f0
4
+ data.tar.gz: 69dad3404a1e39c9d1e764a86d34ef11c9843ae18809cec75768844302816cd1
5
5
  SHA512:
6
- metadata.gz: 1eecf13aa8ac1e68be61facb297ee38fa43f70c4982d3c34f4217d5f7274ea7929d9e420cbb834f4b973dd39abbcc3aef16b2973e2908dde46b6e949a8373f9d
7
- data.tar.gz: 2db86aa56b5917a202068248be745fef6235cc3c5d7ce6937acb9ef63f5ac3ff37e3bcecdc8854fb5bf83e3bd326ebed40ddcdb8937ccc1369bd10720fb98751
6
+ metadata.gz: d05669cadd8fd151be98cc9e8066bfcbdf70bfff39464d4a802aa8575ae75f134c42ac0584eb27fccc80457c61ea46d87e796bb064d0cec9255fb96584b352ca
7
+ data.tar.gz: 92eedfd43a0f5e9506259a2cd394bd5f7b1b5928c0b5676863440532bd6cdeef26b39e6e60d9b906ac4dc4a726ea3ccc6cf591f2f14a8be54d14ae72461d89f9
@@ -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"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Break
4
- class ListCommand < Command
4
+ class WhereCommand < Command
5
5
  def execute(*)
6
6
  frontend.where
7
7
  end
@@ -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
@@ -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, :list, Break::ListCommand
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, preserve: true)
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
@@ -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
@@ -3,16 +3,8 @@
3
3
  module Break::IRB
4
4
  module Overrides
5
5
  def irb
6
- return if Break::Session.active?
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
@@ -5,7 +5,6 @@ require "break"
5
5
 
6
6
  require_relative "pry/frontend"
7
7
  require_relative "pry/commands"
8
- require_relative "pry/overrides"
9
8
 
10
9
  Break::Filter.register_internal MethodSource.method(:source_helper).source_location.first.chomp(".rb")
11
10
  Break::Filter.register_internal CodeRay.method(:scan).source_location.first.chomp(".rb")
@@ -13,6 +12,4 @@ Break::Filter.register_internal Pry.method(:start).source_location.first.chomp("
13
12
  Break::Filter.register_internal "(pry)"
14
13
  Break::Filter.register_internal __dir__
15
14
 
16
- Object.prepend Break::Pry::Overrides
17
-
18
15
  Pry.config.commands.import Break::Pry::Commands
@@ -19,8 +19,6 @@ module Break::Pry
19
19
 
20
20
  command = Break::NextCommand.new(session)
21
21
  command.execute
22
- ensure
23
- Break::Session.start!
24
22
  end
25
23
  end
26
24
 
@@ -41,8 +39,6 @@ module Break::Pry
41
39
 
42
40
  command = Break::StepCommand.new(session)
43
41
  command.execute
44
- ensure
45
- Break::Session.start!
46
42
  end
47
43
  end
48
44
 
@@ -64,8 +60,6 @@ module Break::Pry
64
60
 
65
61
  command = Break::UpCommand.new(session)
66
62
  command.execute
67
- ensure
68
- Break::Session.start!
69
63
  end
70
64
  end
71
65
 
@@ -87,8 +81,6 @@ module Break::Pry
87
81
 
88
82
  command = Break::DownCommand.new(session)
89
83
  command.execute
90
- ensure
91
- Break::Session.start!
92
84
  end
93
85
  end
94
86
  end
@@ -2,20 +2,6 @@
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Break
4
- VERSION = "0.9.1"
4
+ VERSION = "0.10.0"
5
5
  end
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.9.1
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genadi Samokovarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-10 00:00:00.000000000 Z
11
+ date: 2020-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -64,13 +64,12 @@ files:
64
64
  - lib/break/binding_ext.rb
65
65
  - lib/break/command.rb
66
66
  - lib/break/commands.rb
67
- - lib/break/commands/continue_command.rb
68
67
  - lib/break/commands/down_command.rb
69
- - lib/break/commands/list_command.rb
70
68
  - lib/break/commands/next_command.rb
71
69
  - lib/break/commands/step_command.rb
72
70
  - lib/break/commands/tracepoint_command.rb
73
71
  - lib/break/commands/up_command.rb
72
+ - lib/break/commands/where_command.rb
74
73
  - lib/break/context.rb
75
74
  - lib/break/filter.rb
76
75
  - lib/break/irb.rb
@@ -80,7 +79,6 @@ files:
80
79
  - lib/break/pry.rb
81
80
  - lib/break/pry/commands.rb
82
81
  - lib/break/pry/frontend.rb
83
- - lib/break/pry/overrides.rb
84
82
  - lib/break/session.rb
85
83
  - lib/break/testing.rb
86
84
  - lib/break/version.rb
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Break
4
- class ContinueCommand < Command
5
- def execute(*)
6
- session.leave
7
- end
8
- end
9
- end
@@ -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