pry-byebug 3.2.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3769aa2736d9bf6a9ebab95ddf421e9ae696f3c9
4
- data.tar.gz: ac34175906a7f0a79724558cedf23c3e073a77a3
3
+ metadata.gz: 1d546d7bb0c6f46c48b3a640b5f03dd486116fad
4
+ data.tar.gz: 08f05ab518a9b5c028c03532c34452cbfba30ef2
5
5
  SHA512:
6
- metadata.gz: 40e82bbce5bb4a06fda3e35012ebbd5ada29dba254227f52a0d8eeaf5a31f5caa045aae9812925dda5db1e9060752d0110369e875f1df8f834580db9ab48aaad
7
- data.tar.gz: e1b28d266d1ec106afd76d33325cbe8f1229ee93b7adbdf4cae6faaf7224e0e9cdc7919c97ff6dc7d3ef7695956226349669eb25c397ca79a582207c7f130a3b
6
+ metadata.gz: 7d9004bb5febdc7a7f9f0a6631ead052479269576b607ca2c5f48032c3860471ce9d7cdfa41360b2978530dea7734e698cc8460ee1f1569559539ca5c4e1d069
7
+ data.tar.gz: 5295c526616f549fdc98c49bc7601ca355acd7f8d7f7661924cf4fe286c62d7ca8e6785c87ab397d87ca8b5f25e2119000a2b40c27413360d7a8518e4e364af8
@@ -1,3 +1,13 @@
1
+ ## 3.3.0 (2015-11-05)
2
+
3
+ - Improvements:
4
+ * Up to date dependencies, including byebug 8.0 series.
5
+ * Faster debugger thanks to @k0kubun (#80).
6
+
7
+ - Bugfixes:
8
+ * Fix encoding error in gemspec file (#70).
9
+
10
+
1
11
  ## 3.2.0 (2015-07-18)
2
12
 
3
13
  - Improvements:
data/README.md CHANGED
@@ -24,6 +24,16 @@ puts 'Goodbye World' # Run 'next' in the console to move here.
24
24
  ```
25
25
 
26
26
 
27
+ ## Requirements
28
+
29
+ * Required: MRI 2.0.0 or higher. For debugging ruby 1.9.3 or older, use
30
+ [pry-debugger][].
31
+
32
+ * Recommended:
33
+ - MRI 2.1.7 or higher.
34
+ - MRI 2.2.3 or higher.
35
+
36
+
27
37
  ## Installation
28
38
 
29
39
  Drop
@@ -120,18 +130,12 @@ break --show 2 # Show details about breakpoint #2.
120
130
  Type `break --help` from a Pry session to see all available options.
121
131
 
122
132
 
123
- ## Caveats
124
-
125
- Only supports MRI 2.0.0 or newer. For MRI 1.9.3 or older, use
126
- [pry-debugger][pry-debugger]
127
-
128
-
129
133
  ## Credits
130
134
 
131
- * Gopal Patel (@nixme), creator of [pry-debugger][pry-debugger], and everybody
132
- who contributed to it. pry-byebug is a fork of pry-debugger so it wouldn't
133
- exist as it is without those contributions.
134
- * John Mair (@banister), creator of [pry][pry].
135
+ * Gopal Patel (@nixme), creator of [pry-debugger][], and everybody who
136
+ contributed to it. pry-byebug is a fork of pry-debugger so it wouldn't exist as
137
+ it is without those contributions.
138
+ * John Mair (@banister), creator of [pry][].
135
139
 
136
140
  Patches and bug reports are welcome.
137
141
 
@@ -1,41 +1,27 @@
1
- require 'byebug'
1
+ require 'byebug/core'
2
2
 
3
3
  module Byebug
4
4
  #
5
5
  # Extends raw byebug's processor.
6
6
  #
7
- class PryProcessor < Processor
7
+ class PryProcessor < CommandProcessor
8
8
  attr_accessor :pry
9
- attr_reader :state
10
9
 
11
10
  extend Forwardable
12
11
  def_delegators :@pry, :output
13
12
  def_delegators Pry::Helpers::Text, :bold
14
13
 
15
- def initialize(interface = LocalInterface.new)
16
- super(interface)
17
-
18
- Byebug.handler = self
19
- Byebug::Setting[:autolist] = false
20
- end
21
-
22
- def start
14
+ def self.start
23
15
  Byebug.start
24
- Byebug.current_context.step_out(3, true)
16
+ Setting[:autolist] = false
17
+ Context.processor = self
18
+ Byebug.current_context.step_out(4, true)
25
19
  end
26
20
 
27
21
  #
28
22
  # Wrap a Pry REPL to catch navigational commands and act on them.
29
23
  #
30
24
  def run(&_block)
31
- @state ||= Byebug::RegularState.new(
32
- Byebug.current_context,
33
- [],
34
- Byebug.current_context.frame_file,
35
- interface,
36
- Byebug.current_context.frame_line
37
- )
38
-
39
25
  return_value = nil
40
26
 
41
27
  command = catch(:breakout_nav) do # Throws from PryByebug::Commands
@@ -63,17 +49,25 @@ module Byebug
63
49
  # --- Callbacks from byebug C extension ---
64
50
 
65
51
  #
66
- # Called when the wants to stop at a regular line
52
+ # Called when the debugger wants to stop at a regular line
67
53
  #
68
- def at_line(context, _file, _line)
69
- resume_pry(context)
54
+ def at_line
55
+ resume_pry
70
56
  end
71
57
 
72
58
  #
73
- # Called when the wants to stop right before a method return
59
+ # Called when the debugger wants to stop right before a method return
74
60
  #
75
- def at_return(context, _file, _line)
76
- resume_pry(context)
61
+ def at_return(_return_value)
62
+ resume_pry
63
+ end
64
+
65
+ #
66
+ # Called when the debugger wants to stop right before the end of a class
67
+ # definition
68
+ #
69
+ def at_end
70
+ resume_pry
77
71
  end
78
72
 
79
73
  #
@@ -81,7 +75,7 @@ module Byebug
81
75
  # inmediately after with the context's `stop_reason == :breakpoint`, so we
82
76
  # must not resume the pry instance here
83
77
  #
84
- def at_breakpoint(_context, breakpoint)
78
+ def at_breakpoint(breakpoint)
85
79
  @pry ||= Pry.new
86
80
 
87
81
  output.puts bold("\n Breakpoint #{breakpoint.id}. ") + n_hits(breakpoint)
@@ -103,10 +97,8 @@ module Byebug
103
97
  #
104
98
  # Resume an existing Pry REPL at the paused point.
105
99
  #
106
- def resume_pry(context)
107
- frame_position = state ? state.frame : 0
108
-
109
- new_binding = context.frame_binding(frame_position)
100
+ def resume_pry
101
+ new_binding = frame._binding
110
102
 
111
103
  run do
112
104
  if defined?(@pry) && @pry
@@ -119,46 +111,40 @@ module Byebug
119
111
 
120
112
  def perform_next(options)
121
113
  lines = (options[:lines] || 1).to_i
122
- state.context.step_over(lines, state.frame)
114
+ context.step_over(lines, frame.pos)
123
115
  end
124
116
 
125
117
  def perform_step(options)
126
118
  times = (options[:times] || 1).to_i
127
- state.context.step_into(times, state.frame)
119
+ context.step_into(times, frame.pos)
128
120
  end
129
121
 
130
122
  def perform_finish(*)
131
- state.context.step_out(1)
123
+ context.step_out(1)
132
124
  end
133
125
 
134
126
  def perform_up(options)
135
127
  times = (options[:times] || 1).to_i
136
128
 
137
- command = Byebug::UpCommand.new(state)
138
- command.match("up #{times}")
139
- command.execute
129
+ Byebug::UpCommand.new(self, "up #{times}").execute
140
130
 
141
- resume_pry(state.context)
131
+ resume_pry
142
132
  end
143
133
 
144
134
  def perform_down(options)
145
135
  times = (options[:times] || 1).to_i
146
136
 
147
- command = Byebug::DownCommand.new(state)
148
- command.match("down #{times}")
149
- command.execute
137
+ Byebug::DownCommand.new(self, "down #{times}").execute
150
138
 
151
- resume_pry(state.context)
139
+ resume_pry
152
140
  end
153
141
 
154
142
  def perform_frame(options)
155
143
  index = options[:index] ? options[:index].to_i : ''
156
144
 
157
- command = Byebug::FrameCommand.new(state)
158
- command.match("frame #{index}")
159
- command.execute
145
+ Byebug::FrameCommand.new(self, "frame #{index}").execute
160
146
 
161
- resume_pry(state.context)
147
+ resume_pry
162
148
  end
163
149
  end
164
150
  end
@@ -2,3 +2,4 @@ require 'pry'
2
2
  require 'pry-byebug/base'
3
3
  require 'pry-byebug/pry_ext'
4
4
  require 'pry-byebug/commands'
5
+ require 'pry-byebug/control_d_handler'
@@ -6,3 +6,4 @@ require 'pry-byebug/commands/up'
6
6
  require 'pry-byebug/commands/down'
7
7
  require 'pry-byebug/commands/frame'
8
8
  require 'pry-byebug/commands/breakpoint'
9
+ require 'pry-byebug/commands/exit_all'
@@ -20,7 +20,6 @@ module PryByebug
20
20
  break [--show | --delete | --enable | --disable] N
21
21
  break [--delete-all | --disable-all]
22
22
  break
23
- Aliases: breakpoint
24
23
 
25
24
  Set a breakpoint. Accepts a line number in the current file, a file and
26
25
  line number, or a method, and an optional condition.
@@ -97,7 +96,7 @@ module PryByebug
97
96
  end
98
97
 
99
98
  def option_to_method(option)
100
- "process_#{option.to_s.gsub('-', '_')}"
99
+ "process_#{option.to_s.tr('-', '_')}"
101
100
  end
102
101
 
103
102
  def print_all
@@ -132,4 +131,3 @@ module PryByebug
132
131
  end
133
132
 
134
133
  Pry::Commands.add_command(PryByebug::BreakCommand)
135
- Pry::Commands.alias_command 'breakpoint', 'break'
@@ -30,6 +30,8 @@ module PryByebug
30
30
  breakpoints.add_file(current_file, args.first.to_i) if args.first
31
31
 
32
32
  breakout_navigation :continue
33
+ ensure
34
+ Byebug.stop if Byebug.stoppable?
33
35
  end
34
36
  end
35
37
  end
@@ -0,0 +1,14 @@
1
+ module PryByebug
2
+ #
3
+ # Exit pry REPL with Byebug.stop
4
+ #
5
+ class ExitAllCommand < Pry::Command::ExitAll
6
+ def process
7
+ super
8
+ ensure
9
+ Byebug.stop if Byebug.stoppable?
10
+ end
11
+ end
12
+ end
13
+
14
+ Pry::Commands.add_command(PryByebug::ExitAllCommand)
@@ -0,0 +1,7 @@
1
+ original_handler = Pry.config.control_d_handler
2
+
3
+ Pry.config.control_d_handler = proc do |eval_string, pry_|
4
+ Byebug.stop if Byebug.stoppable?
5
+
6
+ original_handler.call(eval_string, pry_)
7
+ end
@@ -2,18 +2,15 @@ require 'byebug/processors/pry_processor'
2
2
 
3
3
  class << Pry
4
4
  alias_method :start_without_pry_byebug, :start
5
- attr_reader :processor
6
5
 
7
6
  def start_with_pry_byebug(target = TOPLEVEL_BINDING, options = {})
8
- @processor ||= Byebug::PryProcessor.new
9
-
10
7
  if target.is_a?(Binding) && PryByebug.file_context?(target)
11
- # Wrap processor around the usual Pry.start to catch navigation commands
12
- @processor.start
8
+ Byebug::PryProcessor.start
13
9
  else
14
10
  # No need for the tracer unless we have a file context to step through
15
11
  start_without_pry_byebug(target, options)
16
12
  end
17
13
  end
14
+
18
15
  alias_method :start, :start_with_pry_byebug
19
16
  end
@@ -2,5 +2,5 @@
2
2
  # Main container module for Pry-Byebug functionality
3
3
  #
4
4
  module PryByebug
5
- VERSION = '3.2.0'
5
+ VERSION = '3.3.0'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-byebug
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rodríguez
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-18 00:00:00.000000000 Z
12
+ date: 2015-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '5.0'
34
+ version: '8.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '5.0'
41
+ version: '8.0'
42
42
  description: |-
43
43
  Combine 'pry' with 'byebug'. Adds 'step', 'next', 'finish',
44
44
  'continue' and 'break' commands to control execution.
@@ -60,11 +60,13 @@ files:
60
60
  - lib/pry-byebug/commands/breakpoint.rb
61
61
  - lib/pry-byebug/commands/continue.rb
62
62
  - lib/pry-byebug/commands/down.rb
63
+ - lib/pry-byebug/commands/exit_all.rb
63
64
  - lib/pry-byebug/commands/finish.rb
64
65
  - lib/pry-byebug/commands/frame.rb
65
66
  - lib/pry-byebug/commands/next.rb
66
67
  - lib/pry-byebug/commands/step.rb
67
68
  - lib/pry-byebug/commands/up.rb
69
+ - lib/pry-byebug/control_d_handler.rb
68
70
  - lib/pry-byebug/helpers/breakpoints.rb
69
71
  - lib/pry-byebug/helpers/multiline.rb
70
72
  - lib/pry-byebug/helpers/navigation.rb
@@ -92,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
94
  version: '0'
93
95
  requirements: []
94
96
  rubyforge_project:
95
- rubygems_version: 2.4.5
97
+ rubygems_version: 2.4.5.1
96
98
  signing_key:
97
99
  specification_version: 4
98
100
  summary: Fast debugging with Pry.