pry-doc 0.13.4 → 1.2.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 +5 -5
- data/.circleci/config.yml +119 -0
- data/.gitignore +2 -0
- data/CHANGELOG.md +28 -0
- data/README.md +7 -3
- data/Rakefile +16 -1
- data/lib/pry-doc/docs/26/checksums +501 -0
- data/lib/pry-doc/docs/26/complete +0 -0
- data/lib/pry-doc/docs/26/object_types +0 -0
- data/lib/pry-doc/docs/26/objects/root.dat +0 -0
- data/lib/pry-doc/docs/26/proxy_types +0 -0
- data/lib/pry-doc/docs/27/checksums +506 -0
- data/lib/pry-doc/docs/27/complete +0 -0
- data/lib/pry-doc/docs/27/object_types +0 -0
- data/lib/pry-doc/docs/27/objects/root.dat +0 -0
- data/lib/pry-doc/docs/27/proxy_types +0 -0
- data/lib/pry-doc/docs/30/checksums +557 -0
- data/lib/pry-doc/docs/30/complete +0 -0
- data/lib/pry-doc/docs/30/object_types +0 -0
- data/lib/pry-doc/docs/30/objects/root.dat +0 -0
- data/lib/pry-doc/docs/30/proxy_types +0 -0
- data/lib/pry-doc/pry_ext/method_info.rb +42 -2
- data/lib/pry-doc/pry_ext/show_source_with_c_internals/c_file.rb +10 -2
- data/lib/pry-doc/pry_ext/show_source_with_c_internals/ruby_source_installer.rb +18 -2
- data/lib/pry-doc/pry_ext/show_source_with_c_internals.rb +3 -3
- data/lib/pry-doc/version.rb +1 -1
- data/pry-doc.gemspec +1 -1
- data/spec/pry-doc_spec.rb +2 -2
- metadata +24 -10
- data/.travis.yml +0 -26
File without changes
|
Binary file
|
Binary file
|
Binary file
|
@@ -2,6 +2,40 @@ require_relative "show_source_with_c_internals"
|
|
2
2
|
|
3
3
|
class Pry
|
4
4
|
module MethodInfo
|
5
|
+
# @return [Regexp] a pattern that matches `method_instance.inspect`
|
6
|
+
METHOD_INSPECT_PATTERN =
|
7
|
+
# Ruby 2.7 changed how #inspect for methods looks like. It attaches param
|
8
|
+
# list and source location now. We use 2 Regexps: one is for 2.7+ and the
|
9
|
+
# other one is for older Rubies. This way we can modify both of them
|
10
|
+
# without the risk of breaking.
|
11
|
+
#
|
12
|
+
# See: https://bugs.ruby-lang.org/issues/14145
|
13
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0")
|
14
|
+
%r{\A
|
15
|
+
\#<
|
16
|
+
(?:Unbound)?Method:\s
|
17
|
+
(.+) # Method owner such as "BigDecimal"
|
18
|
+
([\#\.].+?) # Method signature such as ".finite?" or "#finite?"
|
19
|
+
\(.*\) # Param list
|
20
|
+
(?:
|
21
|
+
\s/.+\.rb:\d+ # Source location
|
22
|
+
)?
|
23
|
+
.* # Sometimes there's gibberish like "<main>:0", we ignore that
|
24
|
+
>
|
25
|
+
\z}x
|
26
|
+
else
|
27
|
+
%r{\A
|
28
|
+
\#<
|
29
|
+
(?:Unbound)?Method:\s
|
30
|
+
(.+) # Method owner such as "BigDecimal"
|
31
|
+
([\#\.].+?) # Method signature such as ".finite?" or "#finite?"
|
32
|
+
(?:
|
33
|
+
\(.*\) # Param list
|
34
|
+
)?
|
35
|
+
>
|
36
|
+
\z}x
|
37
|
+
end
|
38
|
+
|
5
39
|
class << self
|
6
40
|
##
|
7
41
|
# Retrieve the YARD object that contains the method data.
|
@@ -52,7 +86,7 @@ class Pry
|
|
52
86
|
# to figure out a better way to distinguish between class methods and
|
53
87
|
# instance methods.
|
54
88
|
def receiver_notation_for(meth)
|
55
|
-
match = meth.inspect.match(
|
89
|
+
match = meth.inspect.match(METHOD_INSPECT_PATTERN)
|
56
90
|
owner = meth.owner.to_s.sub(/#<.+?:(.+?)>/, '\1')
|
57
91
|
name = match[2]
|
58
92
|
name.sub!('#', '.') if match[1] =~ /\A#<Class:/
|
@@ -115,7 +149,7 @@ class Pry
|
|
115
149
|
host_source_location, _ = WrappedModule.new(host).source_location
|
116
150
|
break if host_source_location != nil
|
117
151
|
return unless host.name
|
118
|
-
host = eval(host
|
152
|
+
host = eval(namespace_name(host))
|
119
153
|
end while host
|
120
154
|
|
121
155
|
# We want to exclude all source_locations that aren't gems (i.e
|
@@ -186,6 +220,12 @@ class Pry
|
|
186
220
|
YARD.parse(file)
|
187
221
|
end
|
188
222
|
end
|
223
|
+
|
224
|
+
private
|
225
|
+
|
226
|
+
def namespace_name(host)
|
227
|
+
host.name.split("::")[0..-2].join("::")
|
228
|
+
end
|
189
229
|
end
|
190
230
|
end
|
191
231
|
end
|
@@ -17,7 +17,7 @@ module Pry::CInternals
|
|
17
17
|
attr_accessor :file_name
|
18
18
|
attr_reader :ruby_source_folder
|
19
19
|
|
20
|
-
def initialize(file_name
|
20
|
+
def initialize(file_name: nil, content: nil, ruby_source_folder: nil)
|
21
21
|
@ruby_source_folder = ruby_source_folder
|
22
22
|
@content = content
|
23
23
|
@file_name = file_name
|
@@ -44,7 +44,7 @@ module Pry::CInternals
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def full_path_for(file_name)
|
47
|
-
if
|
47
|
+
if windows?
|
48
48
|
# windows etags already has the path expanded, wtf
|
49
49
|
file_name
|
50
50
|
else
|
@@ -52,6 +52,14 @@ module Pry::CInternals
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
def windows?
|
56
|
+
if Gem::Version.new(Pry::VERSION) < Gem::Version.new("0.12.0")
|
57
|
+
Pry::Platform.windows?
|
58
|
+
else
|
59
|
+
Pry::Helpers::Platform.windows?
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
55
63
|
def symbol_type_for(symbol)
|
56
64
|
if symbol =~ /#\s*define/
|
57
65
|
:macro
|
@@ -25,18 +25,34 @@ module Pry::CInternals
|
|
25
25
|
private
|
26
26
|
|
27
27
|
def set_platform_specific_commands
|
28
|
-
if
|
28
|
+
if windows?
|
29
29
|
self.curl_cmd = "curl -k --fail -L -O https://github.com/ruby/ruby/archive/v#{ruby_version}.zip " +
|
30
30
|
"& 7z -y x v#{ruby_version}.zip"
|
31
31
|
self.etag_binary = File.join(PryDoc.root, "libexec/windows/etags")
|
32
32
|
self.etag_cmd = %{dir /b /s *.c *.h *.y | "#{etag_binary}" - --no-members}
|
33
33
|
else
|
34
34
|
self.curl_cmd = "curl --fail -L https://github.com/ruby/ruby/archive/v#{ruby_version}.tar.gz | tar xzvf - 2> /dev/null"
|
35
|
-
self.etag_binary =
|
35
|
+
self.etag_binary = linux? ? File.join(PryDoc.root, "libexec/linux/etags-#{arch}") : "etags"
|
36
36
|
self.etag_cmd = "find . -type f -name '*.[chy]' | #{etag_binary} - --no-members"
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
def windows?
|
41
|
+
if Gem::Version.new(Pry::VERSION) < Gem::Version.new("0.12.0")
|
42
|
+
Pry::Platform.windows?
|
43
|
+
else
|
44
|
+
Pry::Helpers::Platform.windows?
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def linux?
|
49
|
+
if Gem::Version.new(Pry::VERSION) < Gem::Version.new("0.12.0")
|
50
|
+
Pry::Platform.linux?
|
51
|
+
else
|
52
|
+
Pry::Helpers::Platform.linux?
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
40
56
|
def ask_for_install
|
41
57
|
print "Identifier not found - do you want to install CRuby sources to attempt to resolve the identifier there?" +
|
42
58
|
"\nThis allows the lookup of C internals Y/N "
|
@@ -17,21 +17,21 @@ module Pry::CInternals
|
|
17
17
|
end
|
18
18
|
if result
|
19
19
|
set_file_and_dir_locals(file)
|
20
|
-
|
20
|
+
pry_instance.pager.page result
|
21
21
|
else
|
22
22
|
raise Pry::CommandError, no_definition_message
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
def process
|
27
|
-
if opts.present?(:c) && !
|
27
|
+
if opts.present?(:c) && !pry_instance.config.skip_cruby_source
|
28
28
|
show_c_source
|
29
29
|
return
|
30
30
|
else
|
31
31
|
super
|
32
32
|
end
|
33
33
|
rescue Pry::CommandError
|
34
|
-
raise if
|
34
|
+
raise if pry_instance.config.skip_cruby_source
|
35
35
|
show_c_source
|
36
36
|
end
|
37
37
|
|
data/lib/pry-doc/version.rb
CHANGED
data/pry-doc.gemspec
CHANGED
@@ -24,7 +24,7 @@ DESCR
|
|
24
24
|
|
25
25
|
s.add_dependency 'yard', "~> 0.9.11"
|
26
26
|
s.add_dependency 'pry', "~> 0.11"
|
27
|
-
s.add_development_dependency 'latest_ruby', '~>
|
27
|
+
s.add_development_dependency 'latest_ruby', '~> 3.0'
|
28
28
|
s.add_development_dependency 'rspec', '~> 3.5'
|
29
29
|
s.add_development_dependency 'rake', "~> 10.0"
|
30
30
|
end
|
data/spec/pry-doc_spec.rb
CHANGED
@@ -239,14 +239,14 @@ EOF
|
|
239
239
|
|
240
240
|
it 'should look up core (C) class method (by Method object)' do
|
241
241
|
obj = Module.module_eval do
|
242
|
-
Pry::MethodInfo.info_for(Dir.method(:
|
242
|
+
Pry::MethodInfo.info_for(Dir.method(:mkdir))
|
243
243
|
end
|
244
244
|
expect(obj.source).not_to be_nil
|
245
245
|
end
|
246
246
|
|
247
247
|
it 'should look up core (C) class method (by UnboundMethod object)' do
|
248
248
|
obj = Module.module_eval do
|
249
|
-
Pry::MethodInfo.info_for(class << Dir; instance_method(:
|
249
|
+
Pry::MethodInfo.info_for(class << Dir; instance_method(:mkdir); end)
|
250
250
|
end
|
251
251
|
expect(obj.source).not_to be_nil
|
252
252
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-doc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mair (banisterfiend)
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,8 +92,8 @@ executables: []
|
|
92
92
|
extensions: []
|
93
93
|
extra_rdoc_files: []
|
94
94
|
files:
|
95
|
+
- ".circleci/config.yml"
|
95
96
|
- ".gitignore"
|
96
|
-
- ".travis.yml"
|
97
97
|
- ".yardopts"
|
98
98
|
- CHANGELOG.md
|
99
99
|
- Gemfile
|
@@ -127,6 +127,21 @@ files:
|
|
127
127
|
- lib/pry-doc/docs/25/object_types
|
128
128
|
- lib/pry-doc/docs/25/objects/root.dat
|
129
129
|
- lib/pry-doc/docs/25/proxy_types
|
130
|
+
- lib/pry-doc/docs/26/checksums
|
131
|
+
- lib/pry-doc/docs/26/complete
|
132
|
+
- lib/pry-doc/docs/26/object_types
|
133
|
+
- lib/pry-doc/docs/26/objects/root.dat
|
134
|
+
- lib/pry-doc/docs/26/proxy_types
|
135
|
+
- lib/pry-doc/docs/27/checksums
|
136
|
+
- lib/pry-doc/docs/27/complete
|
137
|
+
- lib/pry-doc/docs/27/object_types
|
138
|
+
- lib/pry-doc/docs/27/objects/root.dat
|
139
|
+
- lib/pry-doc/docs/27/proxy_types
|
140
|
+
- lib/pry-doc/docs/30/checksums
|
141
|
+
- lib/pry-doc/docs/30/complete
|
142
|
+
- lib/pry-doc/docs/30/object_types
|
143
|
+
- lib/pry-doc/docs/30/objects/root.dat
|
144
|
+
- lib/pry-doc/docs/30/proxy_types
|
130
145
|
- lib/pry-doc/pry_ext/method_info.rb
|
131
146
|
- lib/pry-doc/pry_ext/show_source_with_c_internals.rb
|
132
147
|
- lib/pry-doc/pry_ext/show_source_with_c_internals/c_file.rb
|
@@ -152,7 +167,7 @@ homepage: https://github.com/pry/pry-doc
|
|
152
167
|
licenses:
|
153
168
|
- MIT
|
154
169
|
metadata: {}
|
155
|
-
post_install_message:
|
170
|
+
post_install_message:
|
156
171
|
rdoc_options: []
|
157
172
|
require_paths:
|
158
173
|
- lib
|
@@ -167,9 +182,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
182
|
- !ruby/object:Gem::Version
|
168
183
|
version: '0'
|
169
184
|
requirements: []
|
170
|
-
|
171
|
-
|
172
|
-
signing_key:
|
185
|
+
rubygems_version: 3.2.15
|
186
|
+
signing_key:
|
173
187
|
specification_version: 4
|
174
188
|
summary: Provides YARD and extended documentation support for Pry
|
175
189
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
before_install:
|
2
|
-
- gem update --system
|
3
|
-
- gem update bundler
|
4
|
-
|
5
|
-
rvm:
|
6
|
-
- 2.0.0
|
7
|
-
- 2.1.10
|
8
|
-
- 2.2.9
|
9
|
-
- 2.3.6
|
10
|
-
- 2.4.3
|
11
|
-
- 2.5.0
|
12
|
-
|
13
|
-
script:
|
14
|
-
- bundle exec rake spec
|
15
|
-
|
16
|
-
sudo: false
|
17
|
-
|
18
|
-
cache: bundler
|
19
|
-
|
20
|
-
matrix:
|
21
|
-
allow_failures:
|
22
|
-
- rvm: ruby-head
|
23
|
-
|
24
|
-
branches:
|
25
|
-
only:
|
26
|
-
- master
|