pry 0.10.4-java → 0.11.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +52 -18
  3. data/LICENSE +1 -1
  4. data/README.md +32 -31
  5. data/bin/pry +3 -7
  6. data/lib/pry.rb +4 -4
  7. data/lib/pry/basic_object.rb +6 -0
  8. data/lib/pry/cli.rb +39 -34
  9. data/lib/pry/code.rb +6 -1
  10. data/lib/pry/code/code_file.rb +8 -2
  11. data/lib/pry/code_object.rb +23 -0
  12. data/lib/pry/color_printer.rb +20 -11
  13. data/lib/pry/command.rb +40 -16
  14. data/lib/pry/command_set.rb +9 -2
  15. data/lib/pry/commands/cat/exception_formatter.rb +11 -10
  16. data/lib/pry/commands/cat/file_formatter.rb +7 -3
  17. data/lib/pry/commands/code_collector.rb +16 -14
  18. data/lib/pry/commands/easter_eggs.rb +9 -9
  19. data/lib/pry/commands/edit.rb +7 -3
  20. data/lib/pry/commands/edit/file_and_line_locator.rb +1 -1
  21. data/lib/pry/commands/find_method.rb +1 -1
  22. data/lib/pry/commands/gem_open.rb +1 -1
  23. data/lib/pry/commands/gem_readme.rb +25 -0
  24. data/lib/pry/commands/gem_search.rb +40 -0
  25. data/lib/pry/commands/hist.rb +2 -2
  26. data/lib/pry/commands/jump_to.rb +7 -7
  27. data/lib/pry/commands/ls.rb +3 -1
  28. data/lib/pry/commands/ls/constants.rb +12 -1
  29. data/lib/pry/commands/ls/formatter.rb +1 -0
  30. data/lib/pry/commands/ls/jruby_hacks.rb +2 -2
  31. data/lib/pry/commands/ls/self_methods.rb +2 -0
  32. data/lib/pry/commands/play.rb +2 -2
  33. data/lib/pry/commands/reload_code.rb +2 -2
  34. data/lib/pry/commands/ri.rb +4 -0
  35. data/lib/pry/commands/shell_command.rb +34 -8
  36. data/lib/pry/commands/show_info.rb +10 -2
  37. data/lib/pry/commands/watch_expression/expression.rb +1 -1
  38. data/lib/pry/commands/whereami.rb +7 -6
  39. data/lib/pry/config.rb +3 -16
  40. data/lib/pry/config/behavior.rb +140 -49
  41. data/lib/pry/config/default.rb +21 -33
  42. data/lib/pry/config/memoization.rb +44 -0
  43. data/lib/pry/core_extensions.rb +12 -2
  44. data/lib/pry/editor.rb +1 -1
  45. data/lib/pry/exceptions.rb +1 -1
  46. data/lib/pry/forwardable.rb +23 -0
  47. data/lib/pry/helpers/base_helpers.rb +6 -10
  48. data/lib/pry/helpers/documentation_helpers.rb +1 -0
  49. data/lib/pry/helpers/options_helpers.rb +1 -1
  50. data/lib/pry/helpers/text.rb +69 -75
  51. data/lib/pry/history.rb +22 -1
  52. data/lib/pry/history_array.rb +1 -1
  53. data/lib/pry/hooks.rb +48 -107
  54. data/lib/pry/indent.rb +6 -2
  55. data/lib/pry/input_completer.rb +138 -120
  56. data/lib/pry/last_exception.rb +2 -2
  57. data/lib/pry/method.rb +15 -15
  58. data/lib/pry/method/disowned.rb +1 -0
  59. data/lib/pry/method/patcher.rb +0 -3
  60. data/lib/pry/output.rb +37 -38
  61. data/lib/pry/pager.rb +11 -8
  62. data/lib/pry/plugins.rb +20 -5
  63. data/lib/pry/pry_class.rb +30 -4
  64. data/lib/pry/pry_instance.rb +8 -6
  65. data/lib/pry/repl.rb +38 -8
  66. data/lib/pry/repl_file_loader.rb +1 -1
  67. data/lib/pry/rubygem.rb +3 -1
  68. data/lib/pry/slop.rb +661 -0
  69. data/lib/pry/slop/LICENSE +20 -0
  70. data/lib/pry/slop/commands.rb +196 -0
  71. data/lib/pry/slop/option.rb +208 -0
  72. data/lib/pry/terminal.rb +16 -5
  73. data/lib/pry/test/helper.rb +12 -3
  74. data/lib/pry/version.rb +1 -1
  75. data/lib/pry/wrapped_module.rb +7 -7
  76. data/lib/pry/{module_candidate.rb → wrapped_module/candidate.rb} +7 -13
  77. metadata +14 -19
@@ -54,7 +54,7 @@ module PryTestHelpers
54
54
  yield file
55
55
  ensure
56
56
  file.close(true) if file
57
- File.unlink("#{file.path}c") if File.exists?("#{file.path}c") # rbx
57
+ File.unlink("#{file.path}c") if File.exist?("#{file.path}c") # rbx
58
58
  end
59
59
 
60
60
  def unindent(*args)
@@ -73,6 +73,12 @@ module PryTestHelpers
73
73
  e.define_singleton_method(:backtrace) { mock_backtrace }
74
74
  end
75
75
  end
76
+
77
+ def inner_scope
78
+ catch(:inner_scope) do
79
+ yield ->{ throw(:inner_scope, self) }
80
+ end
81
+ end
76
82
  end
77
83
 
78
84
  def pry_tester(*args, &block)
@@ -96,7 +102,7 @@ def pry_eval(*eval_strs)
96
102
  end
97
103
 
98
104
  class PryTester
99
- extend Forwardable
105
+ extend Pry::Forwardable
100
106
 
101
107
  attr_reader :pry, :out
102
108
 
@@ -115,7 +121,10 @@ class PryTester
115
121
  result = nil
116
122
 
117
123
  strs.flatten.each do |str|
118
- str = "#{str.strip}\n"
124
+ # Check for space prefix. See #1369.
125
+ if str !~ /^\s\S/
126
+ str = "#{str.strip}\n"
127
+ end
119
128
  @history.push str if @history
120
129
 
121
130
  if @pry.process_command(str)
data/lib/pry/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Pry
2
- VERSION = "0.10.4"
2
+ VERSION = "0.11.0"
3
3
  end
@@ -1,4 +1,4 @@
1
- require 'pry/module_candidate'
1
+ require 'pry/wrapped_module/candidate'
2
2
 
3
3
  class Pry
4
4
  class << self
@@ -48,6 +48,7 @@ class Pry
48
48
  # @return [Boolean]
49
49
  def safe_to_evaluate?(str, target)
50
50
  return true if str.strip == "self"
51
+ return false if str =~ /%/
51
52
  kind = target.eval("defined?(#{str})")
52
53
  kind =~ /variable|constant/
53
54
  end
@@ -149,15 +150,14 @@ class Pry
149
150
  wrapped.send(method_name, *args, &block)
150
151
  end
151
152
 
152
- def respond_to?(method_name)
153
- super || wrapped.respond_to?(method_name)
153
+ def respond_to?(method_name, include_all=false)
154
+ super || wrapped.respond_to?(method_name, include_all)
154
155
  end
155
156
 
156
157
  # Retrieve the source location of a module. Return value is in same
157
158
  # format as Method#source_location. If the source location
158
159
  # cannot be found this method returns `nil`.
159
160
  #
160
- # @param [Module] mod The module (or class).
161
161
  # @return [Array<String, Fixnum>, nil] The source location of the
162
162
  # module (or class), or `nil` if no source location found.
163
163
  def source_location
@@ -232,7 +232,7 @@ class Pry
232
232
  # @param [Fixnum] rank
233
233
  # @return [Pry::WrappedModule::Candidate]
234
234
  def candidate(rank)
235
- @memoized_candidates[rank] ||= Candidate.new(self, rank)
235
+ @memoized_candidates[rank] ||= WrappedModule::Candidate.new(self, rank)
236
236
  end
237
237
 
238
238
  # @return [Fixnum] The number of candidate definitions for the
@@ -331,13 +331,13 @@ class Pry
331
331
 
332
332
  return methods unless methods.empty?
333
333
 
334
- safe_send(mod, :constants).map do |const_name|
334
+ safe_send(mod, :constants).flat_map do |const_name|
335
335
  if const = nested_module?(mod, const_name)
336
336
  all_relevant_methods_for(const)
337
337
  else
338
338
  []
339
339
  end
340
- end.flatten
340
+ end
341
341
  end
342
342
 
343
343
  # Return all methods (instance methods and class methods) for a
@@ -1,5 +1,4 @@
1
1
  require 'pry/helpers/documentation_helpers'
2
- require 'forwardable'
3
2
 
4
3
  class Pry
5
4
  class WrappedModule
@@ -10,7 +9,7 @@ class Pry
10
9
  class Candidate
11
10
  include Pry::Helpers::DocumentationHelpers
12
11
  include Pry::CodeObject::Helpers
13
- extend Forwardable
12
+ extend Pry::Forwardable
14
13
 
15
14
  # @return [String] The file where the module definition is located.
16
15
  attr_reader :file
@@ -22,15 +21,12 @@ class Pry
22
21
 
23
22
  # Methods to delegate to associated `Pry::WrappedModule
24
23
  # instance`.
25
- private_delegates = [:lines_for_file, :method_candidates,
26
- :yard_docs?]
27
-
28
- public_delegates = [:wrapped, :module?, :class?, :name, :nonblank_name,
24
+ private_delegates = [:lines_for_file, :method_candidates, :yard_docs?, :name]
25
+ public_delegates = [:wrapped, :module?, :class?, :nonblank_name,
29
26
  :number_of_candidates]
30
27
 
31
- def_delegators :@wrapper, *(private_delegates + public_delegates)
32
- private(*private_delegates)
33
- public(*public_delegates)
28
+ def_delegators :@wrapper, *public_delegates
29
+ def_private_delegators :@wrapper, *private_delegates
34
30
 
35
31
  # @raise [Pry::CommandError] If `rank` is out of bounds.
36
32
  # @param [Pry::WrappedModule] wrapper The associated
@@ -61,16 +57,14 @@ class Pry
61
57
  return nil if file.nil?
62
58
  return @source if @source
63
59
 
64
- @source = strip_leading_whitespace(Pry::Code.from_file(file).expression_at(line, number_of_lines_in_first_chunk))
60
+ @source ||= strip_leading_whitespace(Pry::Code.from_file(file).expression_at(line, number_of_lines_in_first_chunk))
65
61
  end
66
62
 
67
63
  # @raise [Pry::CommandError] If documentation cannot be found.
68
64
  # @return [String] The documentation for the candidate.
69
65
  def doc
70
66
  return nil if file.nil?
71
- return @doc if @doc
72
-
73
- @doc = get_comment_content(Pry::Code.from_file(file).comment_describing(line))
67
+ @doc ||= get_comment_content(Pry::Code.from_file(file).comment_describing(line))
74
68
  end
75
69
 
76
70
  # @return [Array, nil] A `[String, Fixnum]` pair representing the
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.4
4
+ version: 0.11.0
5
5
  platform: java
6
6
  authors:
7
7
  - John Mair (banisterfiend)
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-07-11 00:00:00.000000000 Z
13
+ date: 2017-09-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: coderay
@@ -26,20 +26,6 @@ dependencies:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: 1.1.0
29
- - !ruby/object:Gem::Dependency
30
- name: slop
31
- requirement: !ruby/object:Gem::Requirement
32
- requirements:
33
- - - "~>"
34
- - !ruby/object:Gem::Version
35
- version: '3.4'
36
- type: :runtime
37
- prerelease: false
38
- version_requirements: !ruby/object:Gem::Requirement
39
- requirements:
40
- - - "~>"
41
- - !ruby/object:Gem::Version
42
- version: '3.4'
43
29
  - !ruby/object:Gem::Dependency
44
30
  name: method_source
45
31
  requirement: !ruby/object:Gem::Requirement
@@ -97,6 +83,7 @@ files:
97
83
  - README.md
98
84
  - bin/pry
99
85
  - lib/pry.rb
86
+ - lib/pry/basic_object.rb
100
87
  - lib/pry/cli.rb
101
88
  - lib/pry/code.rb
102
89
  - lib/pry/code/code_file.rb
@@ -134,6 +121,8 @@ files:
134
121
  - lib/pry/commands/gem_install.rb
135
122
  - lib/pry/commands/gem_list.rb
136
123
  - lib/pry/commands/gem_open.rb
124
+ - lib/pry/commands/gem_readme.rb
125
+ - lib/pry/commands/gem_search.rb
137
126
  - lib/pry/commands/gist.rb
138
127
  - lib/pry/commands/help.rb
139
128
  - lib/pry/commands/hist.rb
@@ -183,9 +172,11 @@ files:
183
172
  - lib/pry/config/behavior.rb
184
173
  - lib/pry/config/convenience.rb
185
174
  - lib/pry/config/default.rb
175
+ - lib/pry/config/memoization.rb
186
176
  - lib/pry/core_extensions.rb
187
177
  - lib/pry/editor.rb
188
178
  - lib/pry/exceptions.rb
179
+ - lib/pry/forwardable.rb
189
180
  - lib/pry/helpers.rb
190
181
  - lib/pry/helpers/base_helpers.rb
191
182
  - lib/pry/helpers/command_helpers.rb
@@ -205,7 +196,6 @@ files:
205
196
  - lib/pry/method/disowned.rb
206
197
  - lib/pry/method/patcher.rb
207
198
  - lib/pry/method/weird_method_locator.rb
208
- - lib/pry/module_candidate.rb
209
199
  - lib/pry/object_path.rb
210
200
  - lib/pry/output.rb
211
201
  - lib/pry/pager.rb
@@ -217,10 +207,15 @@ files:
217
207
  - lib/pry/repl.rb
218
208
  - lib/pry/repl_file_loader.rb
219
209
  - lib/pry/rubygem.rb
210
+ - lib/pry/slop.rb
211
+ - lib/pry/slop/LICENSE
212
+ - lib/pry/slop/commands.rb
213
+ - lib/pry/slop/option.rb
220
214
  - lib/pry/terminal.rb
221
215
  - lib/pry/test/helper.rb
222
216
  - lib/pry/version.rb
223
217
  - lib/pry/wrapped_module.rb
218
+ - lib/pry/wrapped_module/candidate.rb
224
219
  homepage: http://pryrepl.org
225
220
  licenses:
226
221
  - MIT
@@ -233,7 +228,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
233
228
  requirements:
234
229
  - - ">="
235
230
  - !ruby/object:Gem::Version
236
- version: '0'
231
+ version: 1.9.3
237
232
  required_rubygems_version: !ruby/object:Gem::Requirement
238
233
  requirements:
239
234
  - - ">="
@@ -241,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
236
  version: '0'
242
237
  requirements: []
243
238
  rubyforge_project:
244
- rubygems_version: 2.5.1
239
+ rubygems_version: 2.6.12
245
240
  signing_key:
246
241
  specification_version: 4
247
242
  summary: An IRB alternative and runtime developer console