pry-debugger 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,18 @@
1
+ ## 0.2.1 (2012-12-26)
2
+
3
+ * Support breakpoints on methods defined in the pry console. (@banister)
4
+ * Fix support for specifying breakpoints by *file:line_number*. (@nviennot)
5
+ * Validate breakpoint conditionals are real Ruby expressions.
6
+ * Support for [debugger][debugger] ~> 1.2.0. (@jshou)
7
+ * Safer `alias_method_chain`-style patching of `Pry.start` and
8
+ `PryRemote::Server#teardown`. (@benizi)
9
+
10
+
1
11
  ## 0.2.0 (2012-06-11)
2
12
 
3
- # Breakpoints.
4
- * **finish** command.
5
- * Internal cleanup and bug fixes.
13
+ * Breakpoints
14
+ * **finish** command
15
+ * Internal cleanup and bug fixes
6
16
 
7
17
 
8
18
  ## 0.1.0 (2012-06-07)
@@ -12,3 +22,4 @@
12
22
 
13
23
 
14
24
  [pry-remote]: https://github.com/Mon-Ouie/pry-remote
25
+ [debugger]: https://github.com/cldwalker/debugger
data/README.md CHANGED
@@ -123,7 +123,14 @@ Pry.commands.alias_command 'f', 'finish'
123
123
  ```
124
124
 
125
125
 
126
- ## Contributions
126
+ ## Contributors
127
+
128
+ * Gopal Patel (@nixme)
129
+ * John Mair (@banister)
130
+ * Nicolas Viennot (@nviennot)
131
+ * Benjamin R. Haskell (@benizi)
132
+ * Joshua Hou (@jshou)
133
+ * ...and others who helped with [pry-nav][pry-nav]
127
134
 
128
135
  Patches and bug reports are welcome. Just send a [pull request][pullrequests] or
129
136
  file an [issue][issues]. [Project changelog][changelog].
@@ -10,13 +10,20 @@ module PryDebugger
10
10
 
11
11
  # Add a new breakpoint.
12
12
  def add(file, line, expression = nil)
13
- raise ArgumentError, 'Invalid file!' unless File.exist?(file)
13
+ real_file = (file != Pry.eval_path)
14
+ raise ArgumentError, 'Invalid file!' if real_file && !File.exist?(file)
15
+ validate_expression expression
16
+
14
17
  Pry.processor.debugging = true
15
- Debugger.add_breakpoint(File.expand_path(file), line, expression)
18
+
19
+ path = (real_file ? File.expand_path(file) : file)
20
+ Debugger.add_breakpoint(path, line, expression)
16
21
  end
17
22
 
18
23
  # Change the conditional expression for a breakpoint.
19
24
  def change(id, expression = nil)
25
+ validate_expression expression
26
+
20
27
  breakpoint = find_by_id(id)
21
28
  breakpoint.expr = expression
22
29
  breakpoint
@@ -79,5 +86,12 @@ module PryDebugger
79
86
  breakpoint.enabled = enabled
80
87
  breakpoint
81
88
  end
89
+
90
+ def validate_expression(expression)
91
+ if expression && # `nil` implies no expression given, so pass
92
+ (expression.empty? || !Pry::Code.complete_expression?(expression))
93
+ raise "Invalid breakpoint conditional: #{expression}"
94
+ end
95
+ end
82
96
  end
83
97
  end
@@ -142,13 +142,13 @@ module PryDebugger
142
142
 
143
143
  file, line =
144
144
  case place
145
- when /(\d+)/ # Line number only
145
+ when /^(\d+)$/ # Line number only
146
146
  line = $1
147
147
  unless PryDebugger.check_file_context(target)
148
148
  raise ArgumentError, 'Line number declaration valid only in a file context.'
149
149
  end
150
150
  [target.eval('__FILE__'), line]
151
- when /(.+):(\d+)/ # File and line number
151
+ when /^(.+):(\d+)$/ # File and line number
152
152
  [$1, $2]
153
153
  else # Method or class name
154
154
  self.args = [place]
@@ -2,21 +2,22 @@ require 'pry'
2
2
  require 'pry-debugger/processor'
3
3
 
4
4
  class << Pry
5
- alias_method :start_existing, :start
5
+ alias_method :start_without_pry_debugger, :start
6
6
  attr_reader :processor
7
7
 
8
- def start(target = TOPLEVEL_BINDING, options = {})
8
+ def start_with_pry_debugger(target = TOPLEVEL_BINDING, options = {})
9
9
  @processor ||= PryDebugger::Processor.new
10
10
 
11
11
  if target.is_a?(Binding) && PryDebugger.check_file_context(target)
12
12
  # Wrap the processer around the usual Pry.start to catch navigation
13
13
  # commands.
14
14
  @processor.run(true) do
15
- start_existing(target, options)
15
+ start_without_pry_debugger(target, options)
16
16
  end
17
17
  else
18
18
  # No need for the tracer unless we have a file context to step through
19
- start_existing(target, options)
19
+ start_without_pry_debugger(target, options)
20
20
  end
21
21
  end
22
+ alias_method :start, :start_with_pry_debugger
22
23
  end
@@ -19,14 +19,15 @@ module PryRemote
19
19
  end
20
20
 
21
21
  # Override to reset our saved global current server session.
22
- alias_method :teardown_existing, :teardown
23
- def teardown
22
+ alias_method :teardown_without_pry_debugger, :teardown
23
+ def teardown_with_pry_debugger
24
24
  return if @torn
25
25
 
26
- teardown_existing
26
+ teardown_without_pry_debugger
27
27
  PryDebugger.current_remote_server = nil
28
28
  @torn = true
29
29
  end
30
+ alias_method :teardown, :teardown_with_pry_debugger
30
31
  end
31
32
  end
32
33
 
@@ -1,3 +1,3 @@
1
1
  module PryDebugger
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  # Dependencies
21
21
  gem.required_ruby_version = '>= 1.9.2'
22
- gem.add_runtime_dependency 'pry', '~> 0.9.9'
23
- gem.add_runtime_dependency 'debugger', '~> 1.1.3'
24
- gem.add_development_dependency 'pry-remote', '~> 0.1.4'
22
+ gem.add_runtime_dependency 'pry', '~> 0.9.10'
23
+ gem.add_runtime_dependency 'debugger', '~> 1.2.0'
24
+ gem.add_development_dependency 'pry-remote', '~> 0.1.6'
25
25
  end
metadata CHANGED
@@ -1,49 +1,64 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-debugger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
4
  prerelease:
5
+ version: 0.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Gopal Patel
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-11 00:00:00.000000000 Z
12
+ date: 2012-12-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: pry
16
- requirement: &70204822544220 !ruby/object:Gem::Requirement
17
- none: false
15
+ version_requirements: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 0.9.9
19
+ version: 0.9.10
20
+ none: false
21
+ name: pry
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70204822544220
25
- - !ruby/object:Gem::Dependency
26
- name: debugger
27
- requirement: &70204822543060 !ruby/object:Gem::Requirement
24
+ requirement: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ version: 0.9.10
28
29
  none: false
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
29
32
  requirements:
30
33
  - - ~>
31
34
  - !ruby/object:Gem::Version
32
- version: 1.1.3
35
+ version: 1.2.0
36
+ none: false
37
+ name: debugger
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70204822543060
36
- - !ruby/object:Gem::Dependency
37
- name: pry-remote
38
- requirement: &70204822541940 !ruby/object:Gem::Requirement
40
+ requirement: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 1.2.0
39
45
  none: false
46
+ - !ruby/object:Gem::Dependency
47
+ version_requirements: !ruby/object:Gem::Requirement
40
48
  requirements:
41
49
  - - ~>
42
50
  - !ruby/object:Gem::Version
43
- version: 0.1.4
51
+ version: 0.1.6
52
+ none: false
53
+ name: pry-remote
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70204822541940
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ version: 0.1.6
61
+ none: false
47
62
  description: Combine 'pry' with 'debugger'. Adds 'step', 'next', and 'continue' commands
48
63
  to control execution.
49
64
  email: nixme@stillhope.com
@@ -75,20 +90,20 @@ rdoc_options: []
75
90
  require_paths:
76
91
  - lib
77
92
  required_ruby_version: !ruby/object:Gem::Requirement
78
- none: false
79
93
  requirements:
80
94
  - - ! '>='
81
95
  - !ruby/object:Gem::Version
82
96
  version: 1.9.2
83
- required_rubygems_version: !ruby/object:Gem::Requirement
84
97
  none: false
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
99
  requirements:
86
100
  - - ! '>='
87
101
  - !ruby/object:Gem::Version
88
102
  version: '0'
103
+ none: false
89
104
  requirements: []
90
105
  rubyforge_project:
91
- rubygems_version: 1.8.11
106
+ rubygems_version: 1.8.23
92
107
  signing_key:
93
108
  specification_version: 3
94
109
  summary: Fast debugging with Pry.