pry-debugger-jruby 1.0.0-java → 2.0.0-java

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
- SHA1:
3
- metadata.gz: 81ff16ce021c8e8175681bf7680c0aaf3265d74e
4
- data.tar.gz: 7a8faa1b0040ae47666c530080924cff69541c5e
2
+ SHA256:
3
+ metadata.gz: f66248f5198a5529ad65de81da42c927c0e39ac15efc25dc6b3fd78b4d4cc467
4
+ data.tar.gz: d29533cdc8958e271b006007127f05ecb54ff99b0e8dfbc3ccb775b22f31141e
5
5
  SHA512:
6
- metadata.gz: 4226ab1696b4932d899e25b5886ced67d816c42b4531fff5ea488a23652a02ac083522b212dc8684f055113452d405872f18abf4c3338aa04eb6c341cd821e3f
7
- data.tar.gz: 7e13eee633369b8f0ed1745e5a934ee45b5406c6c9f3c9acd055180b4ef46877f4038f1bc8adfbdd17cf68a76a4d5c0a84c255426074cb5f08050cf2efecab45
6
+ metadata.gz: 2a8cc5d89f81a8c6dc02449d9f95d3035932bf364327a1d418691c6ffa28d3209e7ed9f3bf33269bcdd871bfdf466aa3c0a67f86fbaf7bfd7918fe862de7d329
7
+ data.tar.gz: 1f4725014906da70199b946c3d53eb8836782be94b16318344dd7d42e6e709650ae2df39981b8d0d9bab063f8824516bf654676c7b8684475ed815d1c061e4be
data/.gitignore CHANGED
@@ -4,6 +4,7 @@
4
4
  .config
5
5
  .yardoc
6
6
  Gemfile.lock
7
+ gems.locked
7
8
  InstalledFiles
8
9
  _yardoc
9
10
  coverage
@@ -1 +1 @@
1
- jruby-9.1.5.0
1
+ jruby-9.2.13.0
@@ -1,3 +1,27 @@
1
+ ## 2.0.0 (2020-11-11)
2
+
3
+ * Allow syntax highlighting when printing breakpoints
4
+ * Improve documentation for next and breakpoints commands
5
+ * Add support for Pry 0.13, drop support for older Pry versions
6
+
7
+ ## 1.2.2 (2020-08-18)
8
+
9
+ * Bump dependencies: `pry`, `ruby-debug-base` ([@stergiom](https://gitlab.com/stergiom))
10
+
11
+ ## 1.2.1 (2018-06-06)
12
+
13
+ * Moved gem to gitlab
14
+
15
+ ## 1.2.0 (2017-12-03)
16
+
17
+ * Fix breaking using `Class#method` syntax
18
+ * Allow pry-debugger-jruby to be used with pry 0.11
19
+
20
+ ## 1.1.0 (2016-12-02)
21
+
22
+ * Avoid stepping into pry code
23
+ * Add help text when running without `--debug`
24
+
1
25
  ## 1.0.0 (2016-12-01)
2
26
 
3
27
  * Revamp documentation for JRuby usage
data/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  # pry-debugger-jruby
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/pry-debugger-jruby.svg)](https://badge.fury.io/rb/pry-debugger-jruby)
4
+
3
5
  _JRuby 9k-compatible pry debugging!_
4
6
 
7
+ Requires JRuby >= 9.1.3.0.
8
+
5
9
  Using MRI? I strongly recommend [`pry-byebug`](https://github.com/deivid-rodriguez/pry-byebug) instead!
6
10
 
7
- Adds `step`, `next`, `finish`, and `continue` commands and `breakpoints` to [Pry](http://pry.github.com).
11
+ Adds `step`, `next`, `finish`, and `continue` commands and breakpoints (`break`/`breakpoints`) to [Pry](http://pry.github.com).
8
12
 
9
13
  To use, run JRuby with the `--debug` flag, and then invoke `pry` normally:
10
14
 
@@ -21,7 +25,7 @@ You can also add the `--debug` flag to your `JRUBY_OPTS` environment variable, s
21
25
 
22
26
  * `step`: Step execution into the next line or method. Takes an optional numeric argument to step multiple times.
23
27
 
24
- * `next`: Step over to the next line within the same frame. Also takes an optional numeric argument to step multiple lines.
28
+ * `next`: Step over to the next line within the same frame. Takes an optional numeric argument to step multiple times. Differs from `step` in that it always stays within the same frame (e.g. does not go into other method calls).
25
29
 
26
30
  * `finish`: Execute until current stack frame returns.
27
31
 
@@ -31,11 +35,11 @@ You can also add the `--debug` flag to your `JRUBY_OPTS` environment variable, s
31
35
 
32
36
  You can set and adjust breakpoints directly from a Pry session using the following commands:
33
37
 
34
- * `break`: Set a new breakpoint from a line number in the current file, a file and line number, or a method. Pass an optional expression to create a conditional breakpoint. Edit existing breakpoints via various flags.
38
+ * `break`: Set a new breakpoint from a line number in the current file, a file and line number, or a method. Pass an optional expression to create a conditional breakpoint. Edit existing breakpoints via various flags. Type `break --help` from a Pry session to see all available options.
35
39
 
36
40
  Examples:
37
41
 
38
- ```ruby
42
+ ```ruby
39
43
  break SomeClass#run Break at the start of `SomeClass#run`.
40
44
  break Foo#bar if baz? Break at `Foo#bar` only if `baz?`.
41
45
  break app/models/user.rb:15 Break at line 15 in user.rb.
@@ -49,9 +53,7 @@ break --disable-all Disable all breakpoints.
49
53
 
50
54
  break List all breakpoints. (Same as `breakpoints`)
51
55
  break --show 2 Show details about breakpoint #2.
52
- ```
53
-
54
- Type `break --help` from a Pry session to see all available options.
56
+ ```
55
57
 
56
58
  * `breakpoints`: List all defined breakpoints. Pass `-v` or `--verbose` to see the source code around each breakpoint.
57
59
 
@@ -70,6 +72,8 @@ gem 'pry-debugger-jruby'
70
72
  Then add `binding.remote_pry` where you want to pause:
71
73
 
72
74
  ```ruby
75
+ require 'pry-remote'
76
+
73
77
  class UsersController < ApplicationController
74
78
  def index
75
79
  binding.remote_pry
@@ -99,13 +103,13 @@ end
99
103
 
100
104
  ## Contributors
101
105
 
102
- `pry-debugger-jruby` is maintained by [@ivoanjo](https://github.com/ivoanjo/) and is based off the awesome previous work from the [`pry-debugger`](https://github.com/nixme/pry-debugger) creators:
106
+ `pry-debugger-jruby` is maintained by [Ivo Anjo](https://ivoanjo.me) and is based off the awesome previous work from the [`pry-debugger`](https://github.com/nixme/pry-debugger) creators:
103
107
 
104
- * Gopal Patel (@nixme)
105
- * John Mair (@banister)
106
- * Nicolas Viennot (@nviennot)
107
- * Benjamin R. Haskell (@benizi)
108
- * Joshua Hou (@jshou)
108
+ * [Gopal Patel](https://github.com/nixme)
109
+ * [John Mair](https://github.com/banister)
110
+ * [Nicolas Viennot](https://github.com/nviennot)
111
+ * [Benjamin R. Haskell](https://github.com/benizi)
112
+ * [Joshua Hou](https://github.com/jshou)
109
113
  * ...and others who helped with [`pry-nav`](https://github.com/nixme/pry-nav)
110
114
 
111
115
  Patches and bug reports are welcome. Just send in a pull request or issue :)
data/bin/pry ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'pry' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
12
+ load(bundle_binstub) if File.file?(bundle_binstub)
13
+
14
+ require "pathname"
15
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
16
+ Pathname.new(__FILE__).realpath)
17
+
18
+ require "rubygems"
19
+ require "bundler/setup"
20
+
21
+ load Gem.bin_path("pry", "pry")
File without changes
@@ -1,8 +1,29 @@
1
- module PryDebuggerJRuby
2
- TRACE_IGNORE_FILES = Dir[File.join(File.dirname(__FILE__), '..', '**', '*.rb')].map { |f| File.expand_path(f) }
1
+ require 'rubygems'
2
+ require 'java'
3
3
 
4
+ module PryDebuggerJRuby
4
5
  extend self
5
6
 
7
+ private
8
+
9
+ def list_pry_files
10
+ spec = Gem::Specification.find_by_name('pry')
11
+
12
+ if spec
13
+ Dir[File.join(spec.gem_dir, '**', '*rb')]
14
+ else
15
+ []
16
+ end
17
+ end
18
+
19
+ def list_debugger_files
20
+ Dir[File.join(File.dirname(__FILE__), '..', '**', '*.rb')].map { |f| File.expand_path(f) }
21
+ end
22
+
23
+ public
24
+
25
+ TRACE_IGNORE_FILES = [*list_debugger_files, *list_pry_files].freeze
26
+
6
27
  # Checks that a binding is in a local file context. Extracted from
7
28
  # https://github.com/pry/pry/blob/master/lib/pry/default_commands/context.rb
8
29
  def check_file_context(target)
@@ -10,6 +31,23 @@ module PryDebuggerJRuby
10
31
  file == Pry.eval_path || (file !~ /(\(.*\))|<.*>/ && file != '' && file != '-e')
11
32
  end
12
33
 
34
+ def check_trace_enabled
35
+ return true if org.jruby.RubyInstanceConfig.FULL_TRACE_ENABLED
36
+ warn <<-EOS
37
+ You are currently running JRuby without the --debug flag enabled, and without it this command will not work correctly.
38
+
39
+ To fix it, either:
40
+
41
+ * add the --debug flag to your ruby/jruby command
42
+ * or add the --debug flag to the JRUBY_OPTS environment variable
43
+ * or enable the jruby.debug.fullTrace option
44
+
45
+ Do note that having this option on all the time has a performance penalty, so we recommend you only enable it while debugging.
46
+ Safe prying, fellow rubyst!
47
+ EOS
48
+ false
49
+ end
50
+
13
51
  # Reference to currently running pry-remote server. Used by the processor.
14
52
  attr_accessor :current_remote_server
15
53
  end
@@ -31,6 +31,8 @@ module PryDebuggerJRuby
31
31
 
32
32
  Step over within the same frame. By default, moves forward a single
33
33
  line.
34
+ Differs from `step` in that it always stays within the same frame
35
+ (e.g. does not go into other method calls).
34
36
 
35
37
  Examples:
36
38
 
@@ -118,7 +120,7 @@ module PryDebuggerJRuby
118
120
  end
119
121
 
120
122
  def process
121
- Pry.processor.pry = _pry_
123
+ Pry.processor.pry = pry_instance
122
124
 
123
125
  {
124
126
  delete: :delete,
@@ -141,6 +143,7 @@ module PryDebuggerJRuby
141
143
  elsif args.empty?
142
144
  run 'breakpoints'
143
145
  else
146
+ return unless PryDebuggerJRuby.check_trace_enabled
144
147
  new_breakpoint
145
148
  end
146
149
  end
@@ -161,7 +164,9 @@ module PryDebuggerJRuby
161
164
  [$1, $2]
162
165
  else # Method or class name
163
166
  self.args = [place]
164
- method_object.source_location
167
+ location = method_object.source_location
168
+ location[1] += 1
169
+ location
165
170
  end
166
171
 
167
172
  print_full_breakpoint Breakpoints.add(file, line.to_i, condition)
@@ -173,7 +178,7 @@ module PryDebuggerJRuby
173
178
  description 'List defined breakpoints.'
174
179
 
175
180
  banner <<-BANNER
176
- Usage: breakpoints [OPTIONS]
181
+ Usage: breakpoints [--verbose]
177
182
  Aliases: breaks
178
183
 
179
184
  List registered breakpoints and their current status.
@@ -192,8 +197,8 @@ module PryDebuggerJRuby
192
197
  header = "#{' ' * (max_width - 1)}# Enabled At "
193
198
 
194
199
  output.puts
195
- output.puts text.bold(header)
196
- output.puts text.bold('-' * header.size)
200
+ output.puts Pry::Helpers::Text.bold(header)
201
+ output.puts Pry::Helpers::Text.bold('-' * header.size)
197
202
  Breakpoints.each do |breakpoint|
198
203
  output.printf "%#{max_width}d ", breakpoint.id
199
204
  output.print breakpoint.enabled? ? 'Yes ' : 'No '
@@ -204,7 +209,7 @@ module PryDebuggerJRuby
204
209
  output.puts
205
210
  end
206
211
  else
207
- output.puts text.bold('No breakpoints defined.')
212
+ output.puts Pry::Helpers::Text.bold('No breakpoints defined.')
208
213
  end
209
214
  end
210
215
  end
@@ -212,11 +217,13 @@ module PryDebuggerJRuby
212
217
 
213
218
  helpers do
214
219
  def breakout_navigation(action, times = nil)
215
- _pry_.binding_stack.clear # Clear the binding stack
220
+ return unless PryDebuggerJRuby.check_trace_enabled
221
+
222
+ pry_instance.binding_stack.clear # Clear the binding stack
216
223
  throw :breakout_nav, { # Break out of the REPL loop and
217
224
  action: action, # signal the tracer
218
225
  times: times,
219
- pry: _pry_,
226
+ pry: pry_instance,
220
227
  }
221
228
  end
222
229
 
@@ -231,17 +238,17 @@ module PryDebuggerJRuby
231
238
  # at that point.
232
239
  def print_full_breakpoint(breakpoint)
233
240
  line = breakpoint.pos
234
- output.print text.bold("Breakpoint #{breakpoint.id}: ")
241
+ output.print Pry::Helpers::Text.bold("Breakpoint #{breakpoint.id}: ")
235
242
  output.print "#{breakpoint.source} @ line #{line} "
236
243
  output.print breakpoint.enabled? ? '(Enabled)' : '(Disabled)'
237
244
  output.puts ' :'
238
245
  if (expr = breakpoint.expr)
239
- output.puts "#{text.bold('Condition:')} #{expr}"
246
+ output.puts "#{Pry::Helpers::Text.bold('Condition:')} #{expr}"
240
247
  end
241
248
  output.puts
242
249
  output.puts(
243
250
  Pry::Code.from_file(breakpoint.source)
244
- .around(line, 3).with_line_numbers.with_marker(line).to_s
251
+ .around(line, 3).with_line_numbers.with_marker(line).highlighted
245
252
  )
246
253
  output.puts
247
254
  end
@@ -1,3 +1,3 @@
1
1
  module PryDebuggerJRuby
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end
@@ -8,11 +8,11 @@ Gem::Specification.new do |spec|
8
8
  spec.version = PryDebuggerJRuby::VERSION
9
9
  spec.platform = 'java'
10
10
  spec.author = 'Ivo Anjo'
11
- spec.email = 'ivo.anjo@ist.utl.pt'
11
+ spec.email = 'ivo@ivoanjo.me'
12
12
  spec.license = 'MIT'
13
- spec.homepage = 'https://github.com/ivoanjo/pry-debugger-jruby'
13
+ spec.homepage = 'https://gitlab.com/ivoanjo/pry-debugger-jruby'
14
14
  spec.summary = 'JRuby 9k-compatible pry debugging!'
15
- spec.description = "Add a JRuby-compatible debugger to 'pry'. Adds 'step', 'next', and 'continue' commands to control execution."
15
+ spec.description = "Add a JRuby-compatible debugger to 'pry'. Adds 'step', 'next', 'continue', `break` and `breakpoints` commands to control execution."
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
18
  f.match(%r{^(test|spec|features)/})
@@ -21,9 +21,10 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.required_ruby_version = '>= 2.2.0'
23
23
 
24
- spec.add_runtime_dependency 'pry', '>= 0.10', '< 0.11'
25
- spec.add_runtime_dependency 'ruby-debug-base', '~> 0.10.4'
24
+ spec.add_dependency 'pry', '>= 0.13', '< 0.14'
25
+ spec.add_dependency 'ruby-debug-base', '>= 0.10.4', '< 0.12'
26
26
 
27
+ spec.add_development_dependency 'bundler', '~> 2.1'
27
28
  spec.add_development_dependency 'pry-remote', '~> 0.1.6'
28
- spec.add_development_dependency 'rake', '~> 11.3'
29
+ spec.add_development_dependency 'rake', '~> 13.0'
29
30
  end
metadata CHANGED
@@ -1,49 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-debugger-jruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: java
6
6
  authors:
7
7
  - Ivo Anjo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-01 00:00:00.000000000 Z
11
+ date: 2020-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '0.10'
18
+ version: '0.13'
19
19
  - - "<"
20
20
  - !ruby/object:Gem::Version
21
- version: '0.11'
21
+ version: '0.14'
22
22
  name: pry
23
- prerelease: false
24
23
  type: :runtime
24
+ prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '0.10'
29
+ version: '0.13'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '0.11'
32
+ version: '0.14'
33
33
  - !ruby/object:Gem::Dependency
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  requirements:
36
- - - "~>"
36
+ - - ">="
37
37
  - !ruby/object:Gem::Version
38
38
  version: 0.10.4
39
+ - - "<"
40
+ - !ruby/object:Gem::Version
41
+ version: '0.12'
39
42
  name: ruby-debug-base
40
- prerelease: false
41
43
  type: :runtime
44
+ prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
44
- - - "~>"
47
+ - - ">="
45
48
  - !ruby/object:Gem::Version
46
49
  version: 0.10.4
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.12'
53
+ - !ruby/object:Gem::Dependency
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - "~>"
57
+ - !ruby/object:Gem::Version
58
+ version: '2.1'
59
+ name: bundler
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '2.1'
47
67
  - !ruby/object:Gem::Dependency
48
68
  requirement: !ruby/object:Gem::Requirement
49
69
  requirements:
@@ -51,8 +71,8 @@ dependencies:
51
71
  - !ruby/object:Gem::Version
52
72
  version: 0.1.6
53
73
  name: pry-remote
54
- prerelease: false
55
74
  type: :development
75
+ prerelease: false
56
76
  version_requirements: !ruby/object:Gem::Requirement
57
77
  requirements:
58
78
  - - "~>"
@@ -63,17 +83,18 @@ dependencies:
63
83
  requirements:
64
84
  - - "~>"
65
85
  - !ruby/object:Gem::Version
66
- version: '11.3'
86
+ version: '13.0'
67
87
  name: rake
68
- prerelease: false
69
88
  type: :development
89
+ prerelease: false
70
90
  version_requirements: !ruby/object:Gem::Requirement
71
91
  requirements:
72
92
  - - "~>"
73
93
  - !ruby/object:Gem::Version
74
- version: '11.3'
75
- description: Add a JRuby-compatible debugger to 'pry'. Adds 'step', 'next', and 'continue' commands to control execution.
76
- email: ivo.anjo@ist.utl.pt
94
+ version: '13.0'
95
+ description: Add a JRuby-compatible debugger to 'pry'. Adds 'step', 'next', 'continue',
96
+ `break` and `breakpoints` commands to control execution.
97
+ email: ivo@ivoanjo.me
77
98
  executables: []
78
99
  extensions: []
79
100
  extra_rdoc_files: []
@@ -81,10 +102,11 @@ files:
81
102
  - ".gitignore"
82
103
  - ".ruby-version"
83
104
  - CHANGELOG.md
84
- - Gemfile
85
105
  - LICENSE
86
106
  - README.md
87
107
  - Rakefile
108
+ - bin/pry
109
+ - gems.rb
88
110
  - lib/pry-debugger-jruby.rb
89
111
  - lib/pry-debugger-jruby/base.rb
90
112
  - lib/pry-debugger-jruby/breakpoints.rb
@@ -95,7 +117,7 @@ files:
95
117
  - lib/pry-debugger-jruby/pry_remote_ext.rb
96
118
  - lib/pry-debugger-jruby/version.rb
97
119
  - pry-debugger-jruby.gemspec
98
- homepage: https://github.com/ivoanjo/pry-debugger-jruby
120
+ homepage: https://gitlab.com/ivoanjo/pry-debugger-jruby
99
121
  licenses:
100
122
  - MIT
101
123
  metadata: {}
@@ -114,8 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
136
  - !ruby/object:Gem::Version
115
137
  version: '0'
116
138
  requirements: []
117
- rubyforge_project:
118
- rubygems_version: 2.6.6
139
+ rubygems_version: 3.0.6
119
140
  signing_key:
120
141
  specification_version: 4
121
142
  summary: JRuby 9k-compatible pry debugging!