pry 0.13.1 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -0
- data/README.md +2 -2
- data/lib/pry.rb +0 -1
- data/lib/pry/cli.rb +7 -27
- data/lib/pry/code.rb +1 -1
- data/lib/pry/commands/show_doc.rb +0 -1
- data/lib/pry/commands/show_source.rb +1 -0
- data/lib/pry/config.rb +0 -4
- data/lib/pry/helpers/documentation_helpers.rb +2 -1
- data/lib/pry/helpers/text.rb +6 -6
- data/lib/pry/pry_class.rb +0 -5
- data/lib/pry/version.rb +1 -1
- metadata +5 -6
- data/lib/pry/plugins.rb +0 -139
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3d394fb61f0a41511177954f810a8aa4ab0c390baa89e538878121806a28c08
|
4
|
+
data.tar.gz: d36e350eb1e8ff448e088dab7233f6c9f28849f6ae94d3eed0b9ad4768ade770
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe3608e5e7046c474a6e8b077dded9bfc091bfdeaa44d178bb69e66bbeaafaca2a3447fac31dd6d5d5bab8ecc10cbb2e2de327f3c4f55393d4024a45f6407b55
|
7
|
+
data.tar.gz: 1596aef2f91334198c2705f79fa6c93e324cd89071a1f6c04c60c471a5c168864c8a3bb991c1d362b5fd5e040782c4a680e7b1eb3cbf4324258c11379d8019f0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,37 @@
|
|
1
1
|
### master
|
2
2
|
|
3
|
+
### [v0.14.1][v0.14.1] (April 12, 2021)
|
4
|
+
|
5
|
+
#### Bug fixes
|
6
|
+
|
7
|
+
* Fixed bad coloring of some RDoc-style docs
|
8
|
+
([#2182](https://github.com/pry/pry/pull/2182))
|
9
|
+
* Fixed broken `--plugins` option. It shows a warning now
|
10
|
+
([#2180](https://github.com/pry/pry/pull/2180))
|
11
|
+
* Fixed bad output on printing non-visible characters with color codes
|
12
|
+
([#2154](https://github.com/pry/pry/pull/2154))
|
13
|
+
* Fixed bad output when colors are disabled and a string with color codes is
|
14
|
+
printed ([#2158](https://github.com/pry/pry/pull/2158))
|
15
|
+
|
16
|
+
### [v0.14.0][v0.14.0] (February 8, 2021)
|
17
|
+
|
18
|
+
#### Features
|
19
|
+
|
20
|
+
* Made `?` an alias to `show-source -d`
|
21
|
+
([#2133](https://github.com/pry/pry/pull/2133))
|
22
|
+
* Added support for Ruby 3.0
|
23
|
+
|
24
|
+
#### Breaking changes
|
25
|
+
|
26
|
+
* Deleted support for plugin autoloading
|
27
|
+
([#2119](https://github.com/pry/pry/pull/2119)). In order to load a Pry plugin
|
28
|
+
you must `require` it from your `pryrc` or add it to your Gemfile.
|
29
|
+
|
30
|
+
```rb
|
31
|
+
# ~/.pryrc
|
32
|
+
require 'pryrc'
|
33
|
+
```
|
34
|
+
|
3
35
|
### [v0.13.1][v0.13.1] (April 12, 2020)
|
4
36
|
|
5
37
|
#### Bug fixes
|
@@ -1074,3 +1106,5 @@ complete CHANGELOG:
|
|
1074
1106
|
[v0.12.2]: https://github.com/pry/pry/releases/tag/v0.12.2
|
1075
1107
|
[v0.13.0]: https://github.com/pry/pry/releases/tag/v0.13.0
|
1076
1108
|
[v0.13.1]: https://github.com/pry/pry/releases/tag/v0.13.1
|
1109
|
+
[v0.14.0]: https://github.com/pry/pry/releases/tag/v0.14.0
|
1110
|
+
[v0.14.1]: https://github.com/pry/pry/releases/tag/v0.14.1
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Pry
|
|
21
21
|
|
22
22
|
**Links:**
|
23
23
|
|
24
|
-
* https://
|
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.
|
85
|
+
gem 'pry', '~> 0.13.1'
|
86
86
|
```
|
87
87
|
|
88
88
|
### Manual
|
data/lib/pry.rb
CHANGED
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,25 +150,21 @@ 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 |
|
170
|
-
|
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 |
|
175
|
-
|
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
|
-
|
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
|
183
|
-
|
184
|
-
|
185
|
-
Pry.locate_plugins.each do |plugin|
|
186
|
-
puts plugin.name.to_s.ljust(18) << plugin.spec.summary
|
187
|
-
end
|
166
|
+
warn "The --plugins option is deprecated and has no effect"
|
167
|
+
warn "Try using `gem list pry-`"
|
188
168
|
Kernel.exit
|
189
169
|
end
|
190
170
|
|
data/lib/pry/code.rb
CHANGED
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,
|
@@ -17,12 +17,13 @@ class Pry
|
|
17
17
|
last_match_ruby = proc do
|
18
18
|
SyntaxHighlighter.highlight(Regexp.last_match(1))
|
19
19
|
end
|
20
|
+
|
20
21
|
comment.gsub(%r{<code>(?:\s*\n)?(.*?)\s*</code>}m, &last_match_ruby)
|
21
22
|
.gsub(%r{<em>(?:\s*\n)?(.*?)\s*</em>}m) { "\e[1m#{Regexp.last_match(1)}\e[0m" }
|
22
23
|
.gsub(%r{<i>(?:\s*\n)?(.*?)\s*</i>}m) { "\e[1m#{Regexp.last_match(1)}\e[0m" }
|
23
24
|
.gsub(%r{<tt>(?:\s*\n)?(.*?)\s*</tt>}m, &last_match_ruby)
|
24
25
|
.gsub(/\B\+(\w+?)\+\B/) { "\e[32m#{Regexp.last_match(1)}\e[0m" }
|
25
|
-
.gsub(/((?:^[ \t]
|
26
|
+
.gsub(/((?:^[ \t]+(?:(?!.+\e\[)).+(?:\n+|\Z))+)/, &last_match_ruby)
|
26
27
|
.gsub(/`(?:\s*\n)?([^\e]*?)\s*`/) { "`#{last_match_ruby.call}`" }
|
27
28
|
end
|
28
29
|
|
data/lib/pry/helpers/text.rb
CHANGED
@@ -21,20 +21,20 @@ class Pry
|
|
21
21
|
|
22
22
|
COLORS.each_pair do |color, value|
|
23
23
|
define_method color do |text|
|
24
|
-
"\033[0;#{30 + value}m#{text}\033[0m"
|
24
|
+
"\001\033[0;#{30 + value}m\002#{text}\001\033[0m\002"
|
25
25
|
end
|
26
26
|
|
27
27
|
define_method "bright_#{color}" do |text|
|
28
|
-
"\033[1;#{30 + value}m#{text}\033[0m"
|
28
|
+
"\001\033[1;#{30 + value}m\002#{text}\001\033[0m\002"
|
29
29
|
end
|
30
30
|
|
31
31
|
COLORS.each_pair do |bg_color, bg_value|
|
32
32
|
define_method "#{color}_on_#{bg_color}" do |text|
|
33
|
-
"\033[0;#{30 + value};#{40 + bg_value}m#{text}\033[0m"
|
33
|
+
"\001\033[0;#{30 + value};#{40 + bg_value}m\002#{text}\001\033[0m\002"
|
34
34
|
end
|
35
35
|
|
36
36
|
define_method "bright_#{color}_on_#{bg_color}" do |text|
|
37
|
-
"\033[1;#{30 + value};#{40 + bg_value}m#{text}\033[0m"
|
37
|
+
"\001\033[1;#{30 + value};#{40 + bg_value}m\002#{text}\001\033[0m\002"
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -44,7 +44,7 @@ class Pry
|
|
44
44
|
# @param [String, #to_s] text
|
45
45
|
# @return [String] _text_ stripped of any color codes.
|
46
46
|
def strip_color(text)
|
47
|
-
text.to_s.gsub(/(\001)
|
47
|
+
text.to_s.gsub(/(\001)?(\e\[(\d[;\d]?)*m)(\002)?/, '')
|
48
48
|
end
|
49
49
|
|
50
50
|
# Returns _text_ as bold text for use on a terminal.
|
@@ -52,7 +52,7 @@ class Pry
|
|
52
52
|
# @param [String, #to_s] text
|
53
53
|
# @return [String] _text_
|
54
54
|
def bold(text)
|
55
|
-
"\e[1m#{text}\e[0m"
|
55
|
+
"\001\e[1m\002#{text}\001\e[0m\002"
|
56
56
|
end
|
57
57
|
|
58
58
|
# Returns `text` in the default foreground colour.
|
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
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.
|
4
|
+
version: 0.14.1
|
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:
|
14
|
+
date: 2021-04-12 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
|