pry 0.13.0 → 0.14.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: b865c24d66f239abbf5016520572f80d1074c66a3032243a3c607c3728689646
4
- data.tar.gz: 1b2c1619fce5542ab11e326c5ac3810237c872b1b6de26b469f61605c9c174af
3
+ metadata.gz: 5b83f87075bc0f4eb1ef5d0b090f3fa1a6d9ca2881eae973926401ac9083d4db
4
+ data.tar.gz: 73ec4ca6ffb8be28cdbc9477dd1ae03157437d218717e77df29d2b9edebc228f
5
5
  SHA512:
6
- metadata.gz: abc950c4f27b952c15cd54d1274006b2aa1e4021e024506455371df3b3439e3f7962966b777e27ae3fd66ed86035baeb836590b10653c3366f29cb71aeee8776
7
- data.tar.gz: 7cc163e3363378ebaa2e28a8c1843b0c1bcbb0d7dd7fadbc5ac314df084ce47218525b807b1db827df9ae32bf794d6e301bf8c8140633b212d9af67dd2b1a7c7
6
+ metadata.gz: c25aa1210bf8711f542b4ac2df1c92f102a7f2860e13d80feaa4559a3172c49a5777a102bbcb76fd022debbfbe4b5b2d00ef30c48c9f1890df6913b57d61c2eb
7
+ data.tar.gz: a7f63286e060ad30d7a0ddbba3d97deb9a0a2f5c585c46419bff53c6661e07e2d1d0da89b2a193710437fe7bc8d05432cea0c16c29c008a196098b0351809166
data/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  ### master
2
2
 
3
+ ### [v0.14.0][v0.14.0] (February 8, 2021)
4
+
5
+ #### Features
6
+
7
+ * Made `?` an alias to `show-source -d`
8
+ ([#2133](https://github.com/pry/pry/pull/2133))
9
+ * Added support for Ruby 3.0
10
+
11
+ #### Breaking changes
12
+
13
+ * Deleted support for plugin autoloading
14
+ ([#2119](https://github.com/pry/pry/pull/2119)). In order to load a Pry plugin
15
+ you must `require` it from your `pryrc` or add it to your Gemfile.
16
+
17
+ ```rb
18
+ # ~/.pryrc
19
+ require 'pryrc'
20
+ ```
21
+
22
+ ### [v0.13.1][v0.13.1] (April 12, 2020)
23
+
24
+ #### Bug fixes
25
+
26
+ * Fixed bug where on invalid input only the last syntax error is displayed
27
+ (instead of all of them) ([#2117](https://github.com/pry/pry/pull/2117))
28
+ * Fixed `Pry::Config` raising `NoMethodError` on undefined option instead of
29
+ returning `nil` (usually invoked via `Pry.config.foo_option` calls)
30
+ ([#2126](https://github.com/pry/pry/pull/2126))
31
+ * Fixed `help` command not displaying regexp aliases properly
32
+ ([#2120](https://github.com/pry/pry/pull/2120))
33
+ * Fixed `pry-backtrace` not working ([#2122](https://github.com/pry/pry/pull/2122))
34
+
3
35
  ### [v0.13.0][v0.13.0] (March 21, 2020)
4
36
 
5
37
  #### Features
@@ -1060,3 +1092,5 @@ complete CHANGELOG:
1060
1092
  [v0.12.1]: https://github.com/pry/pry/releases/tag/v0.12.1
1061
1093
  [v0.12.2]: https://github.com/pry/pry/releases/tag/v0.12.2
1062
1094
  [v0.13.0]: https://github.com/pry/pry/releases/tag/v0.13.0
1095
+ [v0.13.1]: https://github.com/pry/pry/releases/tag/v0.13.1
1096
+ [v0.14.0]: https://github.com/pry/pry/releases/tag/v0.14.0
data/README.md CHANGED
@@ -21,7 +21,7 @@ Pry
21
21
 
22
22
  **Links:**
23
23
 
24
- * https://pryrepl.org/
24
+ * https://pry.github.com/
25
25
  * [YARD API documentation](https://www.rubydoc.info/gems/pry)
26
26
  * [Wiki](https://github.com/pry/pry/wiki)
27
27
 
@@ -82,7 +82,7 @@ Installation
82
82
  ### Bundler
83
83
 
84
84
  ```ruby
85
- gem 'pry', '~> 0.12.2'
85
+ gem 'pry', '~> 0.13.1'
86
86
  ```
87
87
 
88
88
  ### Manual
data/lib/pry/cli.rb CHANGED
@@ -35,13 +35,6 @@ class Pry
35
35
  self
36
36
  end
37
37
 
38
- # Bring in options defined in plugins
39
- def add_plugin_options
40
- Pry.plugins.values.each(&:load_cli_options)
41
-
42
- self
43
- end
44
-
45
38
  # Add a block responsible for processing parsed options.
46
39
  def add_option_processor(&block)
47
40
  self.option_processors ||= []
@@ -124,15 +117,6 @@ class Pry
124
117
  end
125
118
  end
126
119
 
127
- # Bring in options defined by plugins
128
- Pry::Slop.new do
129
- on "no-plugins" do
130
- Pry.config.should_load_plugins = false
131
- end
132
- end.parse(ARGV.dup)
133
-
134
- Pry::CLI.add_plugin_options if Pry.config.should_load_plugins
135
-
136
120
  # The default Pry command line options (before plugin options are included)
137
121
  Pry::CLI.add_options do
138
122
  banner(
@@ -166,17 +150,16 @@ Pry::CLI.add_options do
166
150
  Pry.config.should_load_local_rc = false
167
151
  end
168
152
 
169
- on :s, "select-plugin=", "Only load specified plugin (and no others)." do |plugin_name|
170
- Pry.config.should_load_plugins = false
171
- Pry.plugins[plugin_name].activate!
153
+ on :s, "select-plugin=", "Only load specified plugin (and no others)." do |_plugin_name|
154
+ warn "The --select-plugin option is deprecated and has no effect"
172
155
  end
173
156
 
174
- on :d, "disable-plugin=", "Disable a specific plugin." do |plugin_name|
175
- Pry.plugins[plugin_name].disable!
157
+ on :d, "disable-plugin=", "Disable a specific plugin." do |_plugin_name|
158
+ warn "The --disable-plugin option is deprecated and has no effect"
176
159
  end
177
160
 
178
161
  on "no-plugins", "Suppress loading of plugins." do
179
- Pry.config.should_load_plugins = false
162
+ warn "The --no-plugins option is deprecated and has no effect"
180
163
  end
181
164
 
182
165
  on "plugins", "List installed plugins." do
data/lib/pry/code.rb CHANGED
@@ -339,7 +339,7 @@ class Pry
339
339
  super
340
340
  end
341
341
  end
342
- undef =~
342
+ undef =~ if method_defined?(:=~)
343
343
 
344
344
  # Check whether String responds to missing methods.
345
345
  def respond_to_missing?(method_name, include_private = false)
@@ -193,7 +193,7 @@ class Pry
193
193
 
194
194
  options = original_options.merge!(
195
195
  desc: "Alias for `#{action}`",
196
- listing: match
196
+ listing: match.is_a?(String) ? match : match.inspect
197
197
  ).merge!(options)
198
198
 
199
199
  # ensure default description is used if desc is nil
@@ -6,7 +6,7 @@ class Pry
6
6
  match(/^\s*!\s*$/)
7
7
  group 'Editing'
8
8
  description 'Clear the input buffer.'
9
- command_options use_prefix: false
9
+ command_options use_prefix: false, listing: '!'
10
10
 
11
11
  banner <<-'BANNER'
12
12
  Clear the input buffer. Useful if the parsing process goes wrong and you get
@@ -20,9 +20,7 @@ class Pry
20
20
  BANNER
21
21
 
22
22
  def process
23
- text = bold('Backtrace:')
24
- text << "\n--\n"
25
- text << pry_instance.backtrace.join("\n")
23
+ text = "#{bold('Backtrace:')}\n--\n#{pry_instance.backtrace.join("\n")}"
26
24
  pry_instance.pager.page(text)
27
25
  end
28
26
  end
@@ -89,6 +89,5 @@ class Pry
89
89
  end
90
90
 
91
91
  Pry::Commands.add_command(Pry::Command::ShowDoc)
92
- Pry::Commands.alias_command '?', 'show-doc'
93
92
  end
94
93
  end
@@ -113,5 +113,6 @@ class Pry
113
113
  Pry::Commands.add_command(Pry::Command::ShowSource)
114
114
  Pry::Commands.alias_command 'show-method', 'show-source'
115
115
  Pry::Commands.alias_command '$', 'show-source'
116
+ Pry::Commands.alias_command '?', 'show-source -d'
116
117
  end
117
118
  end
data/lib/pry/config.rb CHANGED
@@ -73,9 +73,6 @@ class Pry
73
73
  # @return [Boolean] whether the local ./.pryrc should be loaded
74
74
  attribute :should_load_local_rc
75
75
 
76
- # @return [Boolean]
77
- attribute :should_load_plugins
78
-
79
76
  # @return [Boolean] whether to load files specified with the -r flag
80
77
  attribute :should_load_requires
81
78
 
@@ -196,7 +193,6 @@ class Pry
196
193
  output_prefix: '=> ',
197
194
  requires: [],
198
195
  should_load_requires: true,
199
- should_load_plugins: true,
200
196
  windows_console_warning: true,
201
197
  control_d_handler: Pry::ControlDHandler.method(:default),
202
198
  memory_size: 100,
@@ -239,17 +235,17 @@ class Pry
239
235
  @custom_attrs[attr.to_s].call
240
236
  end
241
237
 
242
- def method_missing(method_name, *args, &block)
238
+ # rubocop:disable Style/MethodMissingSuper
239
+ def method_missing(method_name, *args, &_block)
243
240
  name = method_name.to_s
244
241
 
245
242
  if name.end_with?('=')
246
243
  self[name[0..-2]] = args.first
247
244
  elsif @custom_attrs.key?(name)
248
245
  self[name]
249
- else
250
- super
251
246
  end
252
247
  end
248
+ # rubocop:enable Style/MethodMissingSuper
253
249
 
254
250
  def respond_to_missing?(method_name, include_all = false)
255
251
  @custom_attrs.key?(method_name.to_s.tr('=', '')) || super
data/lib/pry/pry_class.rb CHANGED
@@ -24,8 +24,6 @@ class Pry
24
24
  attr_accessor :last_internal_error
25
25
  attr_accessor :config
26
26
 
27
- def_delegators :@plugin_manager, :plugins, :load_plugins, :locate_plugins
28
-
29
27
  def_delegators(
30
28
  :@config, :input, :input=, :output, :output=, :commands,
31
29
  :commands=, :print, :print=, :exception_handler, :exception_handler=,
@@ -142,7 +140,6 @@ you can add "Pry.config.windows_console_warning = false" to your pryrc.
142
140
  return if @session_finalized
143
141
 
144
142
  @session_finalized = true
145
- load_plugins if Pry.config.should_load_plugins
146
143
  load_requires if Pry.config.should_load_requires
147
144
  load_history if Pry.config.history_load
148
145
  load_traps if Pry.config.should_trap_interrupts
@@ -333,9 +330,7 @@ Readline version #{Readline::VERSION} detected - will not auto_resize! correctly
333
330
 
334
331
  # Basic initialization.
335
332
  def self.init
336
- @plugin_manager ||= PluginManager.new
337
333
  reset_defaults
338
- locate_plugins
339
334
  end
340
335
 
341
336
  # Return a `Binding` object for `target` or return `target` if it is
@@ -627,7 +627,7 @@ class Pry
627
627
  begin
628
628
  complete_expr = Pry::Code.complete_expression?(@eval_string)
629
629
  rescue SyntaxError => e
630
- output.puts "SyntaxError: #{e.message.sub(/.*syntax error, */m, '')}"
630
+ output.puts e.message.gsub(/^.*syntax error, */, "SyntaxError: ")
631
631
  reset_eval_string
632
632
  end
633
633
 
data/lib/pry/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Pry
4
- VERSION = '0.13.0'.freeze
4
+ VERSION = '0.14.0'.freeze
5
5
  end
data/lib/pry.rb CHANGED
@@ -13,7 +13,6 @@ require 'pry/helpers'
13
13
 
14
14
  require 'pry/basic_object'
15
15
  require 'pry/prompt'
16
- require 'pry/plugins'
17
16
  require 'pry/code_object'
18
17
  require 'pry/exceptions'
19
18
  require 'pry/hooks'
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mair (banisterfiend)
8
8
  - Conrad Irwin
9
9
  - Ryan Fitzgerald
10
10
  - Kyrylo Silin
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-03-21 00:00:00.000000000 Z
14
+ date: 2021-02-08 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: coderay
@@ -171,7 +171,6 @@ files:
171
171
  - lib/pry/object_path.rb
172
172
  - lib/pry/output.rb
173
173
  - lib/pry/pager.rb
174
- - lib/pry/plugins.rb
175
174
  - lib/pry/prompt.rb
176
175
  - lib/pry/pry_class.rb
177
176
  - lib/pry/pry_instance.rb
@@ -201,7 +200,7 @@ metadata:
201
200
  changelog_uri: https://github.com/pry/pry/blob/master/CHANGELOG.md
202
201
  source_code_uri: https://github.com/pry/pry
203
202
  bug_tracker_uri: https://github.com/pry/pry/issues
204
- post_install_message:
203
+ post_install_message:
205
204
  rdoc_options: []
206
205
  require_paths:
207
206
  - lib
@@ -217,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
216
  version: '0'
218
217
  requirements: []
219
218
  rubygems_version: 3.1.2
220
- signing_key:
219
+ signing_key:
221
220
  specification_version: 4
222
221
  summary: A runtime developer console and IRB alternative with powerful introspection
223
222
  capabilities.
data/lib/pry/plugins.rb DELETED
@@ -1,139 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'ostruct'
4
-
5
- class Pry
6
- class PluginManager
7
- PRY_PLUGIN_PREFIX = /^pry-/.freeze
8
-
9
- # Placeholder when no associated gem found, displays warning
10
- class NoPlugin
11
- def initialize(name)
12
- @name = name
13
- end
14
-
15
- def method_missing(*)
16
- warn "Warning: The plugin '#{@name}' was not found! (no gem found)"
17
- super
18
- end
19
-
20
- def respond_to_missing?(*)
21
- false
22
- end
23
- end
24
-
25
- class Plugin
26
- attr_accessor :name, :gem_name, :enabled, :spec, :active
27
-
28
- def initialize(name, gem_name, spec, enabled)
29
- @name = name
30
- @gem_name = gem_name
31
- @enabled = enabled
32
- @spec = spec
33
- end
34
-
35
- # Disable a plugin. (prevents plugin from being loaded, cannot
36
- # disable an already activated plugin)
37
- def disable!
38
- self.enabled = false
39
- end
40
-
41
- # Enable a plugin. (does not load it immediately but puts on
42
- # 'white list' to be loaded)
43
- def enable!
44
- self.enabled = true
45
- end
46
-
47
- # Load the Command line options defined by this plugin (if they exist)
48
- def load_cli_options
49
- cli_options_file = File.join(spec.full_gem_path, "lib/#{spec.name}/cli.rb")
50
- return unless File.exist?(cli_options_file)
51
-
52
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.4.4")
53
- cli_options_file = File.realpath(cli_options_file)
54
- end
55
- require cli_options_file
56
- end
57
-
58
- # Activate the plugin (require the gem - enables/loads the
59
- # plugin immediately at point of call, even if plugin is
60
- # disabled)
61
- # Does not reload plugin if it's already active.
62
- def activate!
63
- # Create the configuration object for the plugin.
64
- Pry.config.send("#{gem_name.tr('-', '_')}=", OpenStruct.new)
65
-
66
- begin
67
- require gem_name unless active?
68
- rescue LoadError => e
69
- warn "Found plugin #{gem_name}, but could not require '#{gem_name}'"
70
- warn e
71
- rescue StandardError => e
72
- warn "require '#{gem_name}' # Failed, saying: #{e}"
73
- end
74
-
75
- self.active = true
76
- self.enabled = true
77
- end
78
-
79
- alias active? active
80
- alias enabled? enabled
81
-
82
- def supported?
83
- pry_version = Gem::Version.new(VERSION)
84
- spec.dependencies.each do |dependency|
85
- if dependency.name == "pry"
86
- return dependency.requirement.satisfied_by?(pry_version)
87
- end
88
- end
89
- true
90
- end
91
- end
92
-
93
- def initialize
94
- @plugins = []
95
- end
96
-
97
- # Find all installed Pry plugins and store them in an internal array.
98
- def locate_plugins
99
- gem_list.each do |gem|
100
- next if gem.name !~ PRY_PLUGIN_PREFIX
101
-
102
- plugin_name = gem.name.split('-', 2).last
103
- plugin = Plugin.new(plugin_name, gem.name, gem, false)
104
- @plugins << plugin.tap(&:enable!) if plugin.supported? && !plugin_located?(plugin)
105
- end
106
- @plugins
107
- end
108
-
109
- # @return [Hash] A hash with all plugin names (minus the 'pry-') as
110
- # keys and Plugin objects as values.
111
- def plugins
112
- h = Hash.new { |_, key| NoPlugin.new(key) }
113
- @plugins.each do |plugin|
114
- h[plugin.name] = plugin
115
- end
116
- h
117
- end
118
-
119
- # Require all enabled plugins, disabled plugins are skipped.
120
- def load_plugins
121
- @plugins.each do |plugin|
122
- plugin.activate! if plugin.enabled?
123
- end
124
- end
125
-
126
- private
127
-
128
- def plugin_located?(plugin)
129
- @plugins.any? { |existing| existing.gem_name == plugin.gem_name }
130
- end
131
-
132
- def gem_list
133
- Gem.refresh
134
- return Gem::Specification if Gem::Specification.respond_to?(:each)
135
-
136
- Gem.source_index.find_name('')
137
- end
138
- end
139
- end