pry 0.13.1 → 0.14.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
  SHA256:
3
- metadata.gz: 9a8834347bff9e94179a35d225768c377a94b33750c989983f42c6cd90b9f0a5
4
- data.tar.gz: 363c3c38dea1cba4b0b0b0b0b617b36a91a3d0761c349687deeff54711210886
3
+ metadata.gz: 5b83f87075bc0f4eb1ef5d0b090f3fa1a6d9ca2881eae973926401ac9083d4db
4
+ data.tar.gz: 73ec4ca6ffb8be28cdbc9477dd1ae03157437d218717e77df29d2b9edebc228f
5
5
  SHA512:
6
- metadata.gz: deda71757450c541d7e0e9981058244817c1ea8ccf9f8ffec81c1d1919bf8bc45493cd392f8ef44baaac4e70e69c4170dd893e3cb5204770494124b033668507
7
- data.tar.gz: bbdeb8c6e1f41f107d49ffd9c042121011870516c0228662e98b905bd41c5714748aa9dd09763a9d8c88a030daa3a317e8121d2882cc97ff72554c09fcee685e
6
+ metadata.gz: c25aa1210bf8711f542b4ac2df1c92f102a7f2860e13d80feaa4559a3172c49a5777a102bbcb76fd022debbfbe4b5b2d00ef30c48c9f1890df6913b57d61c2eb
7
+ data.tar.gz: a7f63286e060ad30d7a0ddbba3d97deb9a0a2f5c585c46419bff53c6661e07e2d1d0da89b2a193710437fe7bc8d05432cea0c16c29c008a196098b0351809166
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
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
+
3
22
  ### [v0.13.1][v0.13.1] (April 12, 2020)
4
23
 
5
24
  #### Bug fixes
@@ -1074,3 +1093,4 @@ complete CHANGELOG:
1074
1093
  [v0.12.2]: https://github.com/pry/pry/releases/tag/v0.12.2
1075
1094
  [v0.13.0]: https://github.com/pry/pry/releases/tag/v0.13.0
1076
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.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'
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)
@@ -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,
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
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.1'.freeze
4
+ VERSION = '0.14.0'.freeze
5
5
  end
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.1
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-04-12 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