orthoses-yard 0.1.0 → 0.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 +4 -4
- data/Gemfile.lock +9 -7
- data/examples/yard/Gemfile +1 -1
- data/examples/yard/Gemfile.lock +11 -14
- data/examples/yard/Rakefile +4 -4
- data/examples/yard/generate.rb +41 -31
- data/examples/yard/rbs_collection.lock.yaml +22 -6
- data/examples/yard/templates/EXTERNAL_TODO.rbs +30 -0
- data/examples/yard/templates/_scripts/test.erb +20 -0
- data/examples/yard/templates/_test/Steepfile.erb +17 -0
- data/examples/yard/templates/_test/yard.rb +6 -0
- data/examples/yard/templates/manifest.yaml.erb +4 -0
- data/lib/orthoses/yard/version.rb +1 -1
- data/lib/orthoses/yard/yard2rbs.rb +25 -7
- data/lib/orthoses/yard.rb +7 -7
- data/orthoses-yard.gemspec +1 -1
- data/sig/orthoses/yard.rbs +1 -1
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4360149f5950080699830fd17881758b818f6b02df358056975744cb3f883e47
|
4
|
+
data.tar.gz: 877833515ad18d0e39f04a7526a055eacbc5bd92d6b3404363a747f67cb38edb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a20fe50f64fd4b0bef16fe325b80a539a6fe3424cbaab57a42e6f20a290c3497d519f629a5509ee181493d05019f10fa1dda10f85bdb7c44ef4fced8c0283d84
|
7
|
+
data.tar.gz: 87ea6a5128e5a37635e6f294f8fb1c96491bcd672cfce54f4682982727943f69e037fa683283800cc3fd62d8198671969817d040f34cce5210450f0a20499fc1
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
orthoses-yard (0.
|
5
|
-
orthoses
|
4
|
+
orthoses-yard (0.2.0)
|
5
|
+
orthoses (~> 1.3.0)
|
6
6
|
yard
|
7
7
|
|
8
8
|
GEM
|
@@ -22,14 +22,14 @@ GEM
|
|
22
22
|
i18n (1.12.0)
|
23
23
|
concurrent-ruby (~> 1.0)
|
24
24
|
io-console (0.5.11)
|
25
|
-
irb (1.4.
|
25
|
+
irb (1.4.2)
|
26
26
|
reline (>= 0.3.0)
|
27
27
|
language_server-protocol (3.17.0.1)
|
28
28
|
listen (3.7.1)
|
29
29
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
30
30
|
rb-inotify (~> 0.9, >= 0.9.10)
|
31
31
|
minitest (5.16.3)
|
32
|
-
orthoses (1.
|
32
|
+
orthoses (1.3.0)
|
33
33
|
rbs (~> 2.0)
|
34
34
|
parallel (1.22.1)
|
35
35
|
parser (3.1.2.1)
|
@@ -39,18 +39,20 @@ GEM
|
|
39
39
|
rb-fsevent (0.11.2)
|
40
40
|
rb-inotify (0.10.1)
|
41
41
|
ffi (~> 1.0)
|
42
|
-
rbs (2.
|
42
|
+
rbs (2.7.0)
|
43
43
|
reline (0.3.1)
|
44
44
|
io-console (~> 0.5)
|
45
45
|
rgot (1.1.0)
|
46
|
-
|
46
|
+
securerandom (0.2.0)
|
47
|
+
steep (1.2.0)
|
47
48
|
activesupport (>= 5.1)
|
48
49
|
language_server-protocol (>= 3.15, < 4.0)
|
49
50
|
listen (~> 3.0)
|
50
51
|
parallel (>= 1.0.0)
|
51
52
|
parser (>= 3.1)
|
52
53
|
rainbow (>= 2.2.2, < 4.0)
|
53
|
-
rbs (>= 2.
|
54
|
+
rbs (>= 2.7.0)
|
55
|
+
securerandom (>= 0.1)
|
54
56
|
terminal-table (>= 2, < 4)
|
55
57
|
terminal-table (3.0.2)
|
56
58
|
unicode-display_width (>= 1.1.1, < 3)
|
data/examples/yard/Gemfile
CHANGED
data/examples/yard/Gemfile.lock
CHANGED
@@ -2,15 +2,9 @@ PATH
|
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
4
|
orthoses-yard (0.1.0)
|
5
|
-
orthoses
|
5
|
+
orthoses (~> 1.2.0)
|
6
6
|
yard
|
7
7
|
|
8
|
-
PATH
|
9
|
-
remote: src
|
10
|
-
specs:
|
11
|
-
yard (0.9.28)
|
12
|
-
webrick (~> 1.7.0)
|
13
|
-
|
14
8
|
GEM
|
15
9
|
remote: https://rubygems.org/
|
16
10
|
specs:
|
@@ -22,9 +16,9 @@ GEM
|
|
22
16
|
reline (>= 0.3.1)
|
23
17
|
highline (2.0.3)
|
24
18
|
io-console (0.5.11)
|
25
|
-
irb (1.4.
|
19
|
+
irb (1.4.2)
|
26
20
|
reline (>= 0.3.0)
|
27
|
-
orthoses (1.
|
21
|
+
orthoses (1.2.0)
|
28
22
|
rbs (~> 2.0)
|
29
23
|
parlour (5.0.0)
|
30
24
|
commander (~> 4.5)
|
@@ -36,16 +30,19 @@ GEM
|
|
36
30
|
rack (3.0.0)
|
37
31
|
rainbow (3.1.1)
|
38
32
|
rake (13.0.6)
|
39
|
-
rbs (2.
|
33
|
+
rbs (2.7.0)
|
40
34
|
reline (0.3.1)
|
41
35
|
io-console (~> 0.5)
|
42
|
-
sorbet-runtime (0.5.
|
43
|
-
sord (
|
36
|
+
sorbet-runtime (0.5.10482)
|
37
|
+
sord (5.0.0)
|
44
38
|
commander (~> 4.5)
|
45
39
|
parlour (~> 5.0)
|
40
|
+
rbs (~> 2.0)
|
46
41
|
sorbet-runtime
|
47
42
|
yard
|
48
43
|
webrick (1.7.0)
|
44
|
+
yard (0.9.28)
|
45
|
+
webrick (~> 1.7.0)
|
49
46
|
|
50
47
|
PLATFORMS
|
51
48
|
arm64-darwin-21
|
@@ -56,7 +53,7 @@ DEPENDENCIES
|
|
56
53
|
rack
|
57
54
|
rake
|
58
55
|
sord
|
59
|
-
yard
|
56
|
+
yard
|
60
57
|
|
61
58
|
BUNDLED WITH
|
62
|
-
2.
|
59
|
+
2.3.16
|
data/examples/yard/Rakefile
CHANGED
data/examples/yard/generate.rb
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
require 'orthoses-yard'
|
2
2
|
require 'fileutils'
|
3
3
|
require 'pathname'
|
4
|
+
require 'erb'
|
4
5
|
|
5
|
-
|
6
|
+
output_dir = 'out'
|
7
|
+
FileUtils.rm_rf(output_dir)
|
6
8
|
Orthoses.logger.level = :warn
|
9
|
+
|
10
|
+
gem_path = Gem::Specification.find_by_name("yard").load_paths.first
|
11
|
+
notice = "# !!! GENERATED FILE !!!\n# Please see generators/yard-generator/README.md\n"
|
12
|
+
|
7
13
|
Orthoses::Builder.new do
|
8
14
|
use Orthoses::CreateFileByName,
|
9
|
-
base_dir:
|
15
|
+
base_dir: output_dir,
|
16
|
+
header: notice
|
10
17
|
use Orthoses::Filter do |name, content|
|
11
18
|
name.start_with?('YARD') ||
|
12
19
|
name.start_with?('Ripper') ||
|
@@ -25,11 +32,14 @@ Orthoses::Builder.new do
|
|
25
32
|
store['YARD::Handlers::Ruby'].header = 'module YARD::Handlers::Ruby'
|
26
33
|
# TODO: support generics
|
27
34
|
store['YARD::Tags::Library'] << 'def self.labels: () -> SymbolHash'
|
35
|
+
|
36
|
+
# FIXME: YARD's issue?
|
37
|
+
store['YARD::CLI::YardocOptions'].delete("# @return [Numeric] An index value for rendering sequentially related templates\nattr_accessor index: Numeric")
|
28
38
|
end
|
29
39
|
use Orthoses::YARD,
|
30
|
-
|
31
|
-
|
32
|
-
|
40
|
+
parse: [
|
41
|
+
"#{gem_path}/yard.rb",
|
42
|
+
"#{gem_path}/yard/**/*.rb",
|
33
43
|
]
|
34
44
|
use Orthoses::Autoload
|
35
45
|
run -> {
|
@@ -37,35 +47,35 @@ Orthoses::Builder.new do
|
|
37
47
|
YARD::Tags::Library.define_tag("YARD Tag Signature", 'yard.signature'.to_sym, nil)
|
38
48
|
YARD::Tags::Library.define_tag("YARD Tag", 'yard.tag'.to_sym, :with_types_and_name)
|
39
49
|
YARD::Tags::Library.define_tag("YARD Directive", 'yard.directive'.to_sym, :with_types_and_name)
|
40
|
-
# YARD::Tags::Library.visible_tags -= ['yard.tag'].map(&:to_sym)
|
41
50
|
}
|
42
51
|
end.call
|
43
52
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
module Rake
|
53
|
-
class TaskLib
|
54
|
-
end
|
55
|
-
end
|
53
|
+
stdlib_dependencies = %w[
|
54
|
+
set
|
55
|
+
optparse
|
56
|
+
logger
|
57
|
+
monitor
|
58
|
+
]
|
56
59
|
|
60
|
+
def erb(template_filename, **vars)
|
61
|
+
"templates/#{template_filename}.erb"
|
62
|
+
.then { File.expand_path(_1) }
|
63
|
+
.then { File.read(_1) }
|
64
|
+
.then { ERB.new(_1, trim_mode: '<>').result_with_hash(vars) }
|
65
|
+
end
|
57
66
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
module Markup
|
67
|
-
class ToHtml
|
68
|
-
end
|
69
|
-
end
|
67
|
+
out = Pathname(output_dir)
|
68
|
+
out.join("EXTERNAL_TODO.rbs").write(erb("EXTERNAL_TODO.rbs", notice: notice))
|
69
|
+
out.join("manifest.yaml").write(erb("manifest.yaml", notice: notice, stdlib_dependencies: stdlib_dependencies))
|
70
|
+
out.join('_scripts').tap do |scripts|
|
71
|
+
scripts.mkpath
|
72
|
+
scripts.join("test").tap do |test|
|
73
|
+
test.write(erb("_scripts/test", notice: notice, stdlib_dependencies: stdlib_dependencies))
|
74
|
+
test.chmod(0o755)
|
70
75
|
end
|
71
|
-
|
76
|
+
end
|
77
|
+
out.join('_test').tap do |test|
|
78
|
+
test.mkpath
|
79
|
+
test.join("yard.rb").write(erb("_test/yard.rb", notice: notice))
|
80
|
+
test.join('Steepfile').write(erb("_test/Steepfile", notice: notice, stdlib_dependencies: stdlib_dependencies))
|
81
|
+
end
|
@@ -7,15 +7,23 @@ sources:
|
|
7
7
|
path: ".gem_rbs_collection"
|
8
8
|
gems:
|
9
9
|
- name: rbs
|
10
|
-
version: 2.
|
10
|
+
version: 2.7.0
|
11
11
|
source:
|
12
12
|
type: rubygems
|
13
|
+
- name: ast
|
14
|
+
version: '2.4'
|
15
|
+
source:
|
16
|
+
type: git
|
17
|
+
name: ruby/gem_rbs_collection
|
18
|
+
revision: 6b07483f37484e2b7df168598b95b0c79be2924f
|
19
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
20
|
+
repo_dir: gems
|
13
21
|
- name: io-console
|
14
22
|
version: '0'
|
15
23
|
source:
|
16
24
|
type: stdlib
|
17
25
|
- name: orthoses
|
18
|
-
version: 1.
|
26
|
+
version: 1.2.0
|
19
27
|
source:
|
20
28
|
type: rubygems
|
21
29
|
- name: orthoses-yard
|
@@ -23,11 +31,19 @@ gems:
|
|
23
31
|
source:
|
24
32
|
type: rubygems
|
25
33
|
- name: rack
|
26
|
-
version: 2.2
|
34
|
+
version: '2.2'
|
35
|
+
source:
|
36
|
+
type: git
|
37
|
+
name: ruby/gem_rbs_collection
|
38
|
+
revision: 6b07483f37484e2b7df168598b95b0c79be2924f
|
39
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
40
|
+
repo_dir: gems
|
41
|
+
- name: rainbow
|
42
|
+
version: '3.0'
|
27
43
|
source:
|
28
44
|
type: git
|
29
45
|
name: ruby/gem_rbs_collection
|
30
|
-
revision:
|
46
|
+
revision: 6b07483f37484e2b7df168598b95b0c79be2924f
|
31
47
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
32
48
|
repo_dir: gems
|
33
49
|
- name: logger
|
@@ -50,11 +66,11 @@ gems:
|
|
50
66
|
version: '0'
|
51
67
|
source:
|
52
68
|
type: stdlib
|
53
|
-
- name:
|
69
|
+
- name: tsort
|
54
70
|
version: '0'
|
55
71
|
source:
|
56
72
|
type: stdlib
|
57
|
-
- name:
|
73
|
+
- name: rdoc
|
58
74
|
version: '0'
|
59
75
|
source:
|
60
76
|
type: stdlib
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# It is a temporary definition of a type definition
|
2
|
+
# for which the library RBS does not currently exist.
|
3
|
+
# Once the library RBS is defined and included in rbs_collection.lock.yaml,
|
4
|
+
# the duplicate type definitions in this file should be removed.
|
5
|
+
|
6
|
+
class OpenStruct
|
7
|
+
end
|
8
|
+
|
9
|
+
class Ripper
|
10
|
+
end
|
11
|
+
|
12
|
+
module Rake
|
13
|
+
class TaskLib
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
module WEBrick
|
19
|
+
module HTTPServlet
|
20
|
+
class AbstractServlet
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module RDoc
|
26
|
+
module Markup
|
27
|
+
class ToHtml
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# Exit command with non-zero status code, Output logs of every command executed, Treat unset variables as an error when substituting.
|
4
|
+
set -eou pipefail
|
5
|
+
# Internal Field Separator - Linux shell variable
|
6
|
+
IFS=$'
|
7
|
+
'
|
8
|
+
# Print shell input lines
|
9
|
+
set -v
|
10
|
+
|
11
|
+
# Set RBS_DIR variable to change directory to execute type checks using `steep check`
|
12
|
+
RBS_DIR=$(cd $(dirname $0)/..; pwd)
|
13
|
+
# Set REPO_DIR variable to validate RBS files added to the corresponding folder
|
14
|
+
REPO_DIR=$(cd $(dirname $0)/../../..; pwd)
|
15
|
+
# Validate RBS files, using the bundler environment present
|
16
|
+
bundle exec rbs --repo $REPO_DIR -r yard:0.9 <%= stdlib_dependencies.map { "-r #{_1}" }.join(' ') %> -r rack:2.2.2 validate --silent
|
17
|
+
|
18
|
+
cd ${RBS_DIR}/_test
|
19
|
+
# Run type checks
|
20
|
+
bundle exec steep check
|
@@ -0,0 +1,17 @@
|
|
1
|
+
D = Steep::Diagnostic
|
2
|
+
|
3
|
+
target :test do
|
4
|
+
check "."
|
5
|
+
signature '.'
|
6
|
+
|
7
|
+
repo_path "../../../"
|
8
|
+
|
9
|
+
<% stdlib_dependencies.each do |stdlib| %>
|
10
|
+
library "<%= stdlib %>"
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
library "yard:0.9"
|
14
|
+
library "rack:2.2.2"
|
15
|
+
|
16
|
+
configure_code_diagnostics(D::Ruby.all_error)
|
17
|
+
end
|
@@ -35,7 +35,7 @@ module Orthoses
|
|
35
35
|
# @return [void]
|
36
36
|
def run
|
37
37
|
Orthoses.logger.info("YARD will generate about #{yardoc.inspect}")
|
38
|
-
block.call(yardoc.path, yardoc.docstring, nil)
|
38
|
+
block.call(yardoc.path, yardoc.docstring.all, nil)
|
39
39
|
yardoc.children.each do |child|
|
40
40
|
case child.type
|
41
41
|
when :module, :class
|
@@ -45,6 +45,7 @@ module Orthoses
|
|
45
45
|
generate_for_attributes
|
46
46
|
generate_for_methods
|
47
47
|
generate_for_constants
|
48
|
+
generate_for_classvariable
|
48
49
|
end
|
49
50
|
|
50
51
|
# @return [void]
|
@@ -55,15 +56,15 @@ module Orthoses
|
|
55
56
|
if class_attributes[:read] && class_attributes[:write]
|
56
57
|
visibility = class_attributes[:read].visibility == :private ? 'private ' : ''
|
57
58
|
type = tag_types_to_rbs_type(class_attributes[:read].tags('return').flat_map(&:types))
|
58
|
-
block.call(yardoc.path, class_attributes[:read].docstring, "#{visibility}attr_accessor #{prefix}#{name}: #{type}")
|
59
|
+
block.call(yardoc.path, class_attributes[:read].docstring.all, "#{visibility}attr_accessor #{prefix}#{name}: #{type}")
|
59
60
|
elsif class_attributes[:read]
|
60
61
|
visibility = class_attributes[:read].visibility == :private ? 'private ' : ''
|
61
62
|
type = tag_types_to_rbs_type(class_attributes[:read].tags('return').flat_map(&:types))
|
62
|
-
block.call(yardoc.path, class_attributes[:read].docstring, "#{visibility}attr_reader #{prefix}#{name}: #{type}")
|
63
|
+
block.call(yardoc.path, class_attributes[:read].docstring.all, "#{visibility}attr_reader #{prefix}#{name}: #{type}")
|
63
64
|
elsif class_attributes[:write]
|
64
65
|
visibility = class_attributes[:write].visibility == :private ? 'private ' : ''
|
65
66
|
type = tag_types_to_rbs_type(class_attributes[:write].tags('return').flat_map(&:types))
|
66
|
-
block.call(yardoc.path, class_attributes[:write].docstring, "#{visibility}attr_writer #{prefix}#{name}: #{type}")
|
67
|
+
block.call(yardoc.path, class_attributes[:write].docstring.all, "#{visibility}attr_writer #{prefix}#{name}: #{type}")
|
67
68
|
else
|
68
69
|
raise "bug"
|
69
70
|
end
|
@@ -73,6 +74,8 @@ module Orthoses
|
|
73
74
|
|
74
75
|
# @return [void]
|
75
76
|
def generate_for_methods
|
77
|
+
return if yardoc.to_s.empty?
|
78
|
+
|
76
79
|
yardoc.meths(inherited: false).each do |meth|
|
77
80
|
# skip attribute methods because of generate_for_attributes
|
78
81
|
next if meth.attr_info
|
@@ -82,7 +85,6 @@ module Orthoses
|
|
82
85
|
|
83
86
|
namespace = meth.namespace
|
84
87
|
method_name = meth.name
|
85
|
-
next if namespace.to_s.empty?
|
86
88
|
|
87
89
|
begin
|
88
90
|
mod = Object.const_get(namespace.to_s)
|
@@ -101,6 +103,12 @@ module Orthoses
|
|
101
103
|
next
|
102
104
|
end
|
103
105
|
|
106
|
+
if meth.is_alias?
|
107
|
+
orig_key = yardoc.aliases[meth]
|
108
|
+
block.call(yardoc.to_s, "", "alias #{prefix}#{meth.name} #{prefix}#{orig_key}")
|
109
|
+
next
|
110
|
+
end
|
111
|
+
|
104
112
|
required_positionals = []
|
105
113
|
optional_positionals = []
|
106
114
|
rest_positionals = nil
|
@@ -194,7 +202,7 @@ module Orthoses
|
|
194
202
|
)
|
195
203
|
|
196
204
|
visibility = meth.visibility == :private ? 'private ' : ''
|
197
|
-
block.call(yardoc.to_s, meth.docstring, "#{visibility}def #{prefix}#{method_name}: #{method_type}")
|
205
|
+
block.call(yardoc.to_s, meth.docstring.all, "#{visibility}def #{prefix}#{method_name}: #{method_type}")
|
198
206
|
end
|
199
207
|
end
|
200
208
|
|
@@ -203,7 +211,16 @@ module Orthoses
|
|
203
211
|
yardoc.constants(inherited: false).each do |const|
|
204
212
|
return_tags = const.tags('return')
|
205
213
|
return_type = return_tags.empty? ? untyped : tag_types_to_rbs_type(return_tags.flat_map(&:types))
|
206
|
-
block.call(const.namespace.to_s, const.docstring, "#{const.name}: #{return_type}")
|
214
|
+
block.call(const.namespace.to_s, const.docstring.all, "#{const.name}: #{return_type}")
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
# @return [void]
|
219
|
+
def generate_for_classvariable
|
220
|
+
yardoc.cvars.each do |cvar|
|
221
|
+
return_tags = cvar.tags('return')
|
222
|
+
return_type = return_tags.empty? ? untyped : tag_types_to_rbs_type(return_tags.flat_map(&:types))
|
223
|
+
block.call(cvar.namespace.to_s, cvar.docstring.all, "#{cvar.name}: #{return_type}")
|
207
224
|
end
|
208
225
|
end
|
209
226
|
|
@@ -215,6 +232,7 @@ module Orthoses
|
|
215
232
|
begin
|
216
233
|
types_explainers = ::YARD::Tags::TypesExplainer::Parser.parse(tag_types.uniq.join(", "))
|
217
234
|
rescue SyntaxError
|
235
|
+
Orthoses.logger.warn("#{tag_types} in #{yardoc.inspect} cannot parse as tags. use untyped instead")
|
218
236
|
return untyped
|
219
237
|
end
|
220
238
|
|
data/lib/orthoses/yard.rb
CHANGED
@@ -4,28 +4,28 @@ require_relative "yard/version"
|
|
4
4
|
require_relative "yard/yard2rbs"
|
5
5
|
|
6
6
|
module Orthoses
|
7
|
-
# use Orthoses::YARD,
|
7
|
+
# use Orthoses::YARD, parse: "lib/**/*.rb"
|
8
8
|
class YARD
|
9
|
-
def initialize(loader,
|
9
|
+
def initialize(loader, parse:)
|
10
10
|
@loader = loader
|
11
|
-
@
|
11
|
+
@parse = Array(parse)
|
12
12
|
end
|
13
13
|
|
14
14
|
def call
|
15
15
|
@loader.call.tap do |store|
|
16
16
|
require 'yard'
|
17
17
|
|
18
|
-
::YARD.parse(@
|
18
|
+
::YARD.parse(@parse)
|
19
19
|
::YARD::Registry.root.children.each do |yardoc|
|
20
20
|
case yardoc.type
|
21
21
|
when :class, :module
|
22
22
|
YARD2RBS.run(yardoc: yardoc) do |namespace, docstring, rbs|
|
23
|
+
comment = docstring.each_line.map { |line| "# #{line}" }.join
|
23
24
|
if rbs.nil?
|
24
|
-
store[namespace]
|
25
|
+
store[namespace].comment = comment
|
25
26
|
else
|
26
27
|
Orthoses.logger.debug("#{namespace} << #{rbs}")
|
27
|
-
|
28
|
-
store[namespace] << "#{all}#{rbs}"
|
28
|
+
store[namespace] << "#{comment}\n#{rbs}"
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
data/orthoses-yard.gemspec
CHANGED
data/sig/orthoses/yard.rbs
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orthoses-yard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: orthoses
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.3.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: yard
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,6 +56,11 @@ files:
|
|
56
56
|
- examples/yard/generate.rb
|
57
57
|
- examples/yard/rbs_collection.lock.yaml
|
58
58
|
- examples/yard/rbs_collection.yaml
|
59
|
+
- examples/yard/templates/EXTERNAL_TODO.rbs
|
60
|
+
- examples/yard/templates/_scripts/test.erb
|
61
|
+
- examples/yard/templates/_test/Steepfile.erb
|
62
|
+
- examples/yard/templates/_test/yard.rb
|
63
|
+
- examples/yard/templates/manifest.yaml.erb
|
59
64
|
- lib/orthoses-yard.rb
|
60
65
|
- lib/orthoses/yard.rb
|
61
66
|
- lib/orthoses/yard/version.rb
|