yard 0.9.39 → 0.9.40
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/CHANGELOG.md +16 -1
- data/README.md +18 -21
- data/docs/GettingStarted.md +41 -15
- data/docs/Tags.md +5 -5
- data/docs/WhatsNew.md +59 -7
- data/docs/templates/default/yard_tags/html/setup.rb +1 -1
- data/lib/yard/autoload.rb +17 -0
- data/lib/yard/cli/diff.rb +7 -2
- data/lib/yard/code_objects/proxy.rb +1 -1
- data/lib/yard/handlers/processor.rb +1 -0
- data/lib/yard/handlers/rbs/attribute_handler.rb +43 -0
- data/lib/yard/handlers/rbs/base.rb +38 -0
- data/lib/yard/handlers/rbs/constant_handler.rb +18 -0
- data/lib/yard/handlers/rbs/method_handler.rb +327 -0
- data/lib/yard/handlers/rbs/mixin_handler.rb +20 -0
- data/lib/yard/handlers/rbs/namespace_handler.rb +26 -0
- data/lib/yard/handlers/ruby/attribute_handler.rb +7 -4
- data/lib/yard/handlers/ruby/constant_handler.rb +1 -0
- data/lib/yard/i18n/locale.rb +1 -1
- data/lib/yard/i18n/pot_generator.rb +1 -1
- data/lib/yard/parser/rbs/rbs_parser.rb +325 -0
- data/lib/yard/parser/rbs/statement.rb +75 -0
- data/lib/yard/parser/ruby/ruby_parser.rb +51 -1
- data/lib/yard/parser/source_parser.rb +3 -2
- data/lib/yard/registry_resolver.rb +7 -0
- data/lib/yard/server/library_version.rb +1 -1
- data/lib/yard/server/templates/default/fulldoc/html/js/autocomplete.js +208 -12
- data/lib/yard/server/templates/default/layout/html/breadcrumb.erb +1 -17
- data/lib/yard/server/templates/default/method_details/html/permalink.erb +4 -2
- data/lib/yard/server/templates/doc_server/library_list/html/headers.erb +3 -3
- data/lib/yard/server/templates/doc_server/library_list/html/library_list.erb +2 -3
- data/lib/yard/server/templates/doc_server/processing/html/processing.erb +22 -16
- data/lib/yard/tags/directives.rb +7 -0
- data/lib/yard/tags/library.rb +3 -3
- data/lib/yard/tags/types_explainer.rb +2 -1
- data/lib/yard/templates/helpers/base_helper.rb +1 -1
- data/lib/yard/templates/helpers/html_helper.rb +15 -4
- data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +6 -1
- data/lib/yard/templates/helpers/markup/hybrid_markdown.rb +2125 -0
- data/lib/yard/templates/helpers/markup_helper.rb +4 -2
- data/lib/yard/version.rb +1 -1
- data/po/ja.po +82 -82
- data/templates/default/fulldoc/html/full_list.erb +4 -4
- data/templates/default/fulldoc/html/js/app.js +503 -319
- data/templates/default/fulldoc/html/js/full_list.js +310 -213
- data/templates/default/layout/html/headers.erb +1 -1
- data/templates/default/method/html/header.erb +3 -3
- data/templates/default/module/html/defines.erb +3 -3
- data/templates/default/module/html/inherited_methods.erb +1 -0
- data/templates/default/module/html/method_summary.erb +8 -0
- data/templates/default/module/setup.rb +20 -0
- data/templates/default/onefile/html/layout.erb +3 -4
- data/templates/guide/fulldoc/html/js/app.js +57 -26
- data/templates/guide/layout/html/layout.erb +9 -11
- metadata +13 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f30a7254915dfc58291d8bdbf05f6e65bbb392d9c359bb0df535c5d290dbf2f8
|
|
4
|
+
data.tar.gz: bd261832603492535a89218415f59c84c3e5c732dd8a0cc25f5a294a0b2c98a5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 132b2b6ea721780a3f36001216fa16aade784e2936d89684249f92c3ddd2180f2820e24c339551ce33405779c627b82bb085978b6f3a785b1450f17204b00d88
|
|
7
|
+
data.tar.gz: e4410e47b0b7871241611b3328fa2e5219ba5632c4648e3d4f3d5ac66bf54986ac046bae935bc68911d905210159cc1dc70ca6aba0870056aef9ba36f70dbae3
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# main
|
|
2
2
|
|
|
3
|
+
# [0.9.40] - April 12th, 2026
|
|
4
|
+
|
|
5
|
+
[0.9.40]: https://github.com/lsegal/yard/compare/v0.9.39...v0.9.40
|
|
6
|
+
|
|
7
|
+
- Add support for Ruby .rbs files (docstrings included) (#1673)
|
|
8
|
+
- Add built-in hybrid RDoc/Markdown renderer (`HybridMarkdown`) requiring no external gems (#1674)
|
|
9
|
+
- Add support for `#-` as a comment-block separator. See Getting Started Guide.
|
|
10
|
+
- Add support for `commonmarker` version `>= 1.0`.
|
|
11
|
+
- Remove usage of jQuery in default templates. jQuery library is still packaged in templates for backward compatibility (#1675)
|
|
12
|
+
- Fix false self-referential mixin when bare name matches ancestor namespace (#1672)
|
|
13
|
+
- Fix bracket/brace map corruption from Ruby 3.0+ pattern matching deconstruction (#1671)
|
|
14
|
+
- Fix `@!scope class` on attributes (#1582, #1655, #1666)
|
|
15
|
+
- Fix `@!parse` directives not including source for block (#1665)
|
|
16
|
+
- Fix inherited methods not appearing in groups (#1656)
|
|
17
|
+
|
|
3
18
|
# [0.9.39] - April 8th, 2026
|
|
4
19
|
|
|
5
20
|
[0.9.39]: https://github.com/lsegal/yard/compare/v0.9.38...v0.9.39
|
|
@@ -858,7 +873,7 @@ contributions to this version.
|
|
|
858
873
|
|
|
859
874
|
[0.4.0]: https://github.com/lsegal/yard/compare/v0.2.3.5...v0.4.0
|
|
860
875
|
|
|
861
|
-
- Added new templating engine based on [tadpole](
|
|
876
|
+
- Added new templating engine based on [tadpole](https://github.com/lsegal/tadpole)
|
|
862
877
|
- Added YARD queries (`--query` CLI argument to yardoc)
|
|
863
878
|
- Greatly expanded YARD documentation
|
|
864
879
|
- Added plugin support
|
data/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# YARD: Yay! A Ruby Documentation Tool
|
|
2
2
|
|
|
3
|
-
[](
|
|
4
|
-
[](
|
|
5
|
-
[](
|
|
3
|
+
[](https://yardoc.org)
|
|
4
|
+
[](https://github.com/lsegal/yard)
|
|
5
|
+
[](https://rubydoc.org/gems/yard/frames)
|
|
6
6
|
|
|
7
|
-
[](
|
|
7
|
+
[](https://github.com/lsegal/yard/releases)
|
|
8
8
|
[](https://github.com/lsegal/yard/actions/workflows/ci.yml)
|
|
9
9
|
[](https://coveralls.io/github/lsegal/yard)
|
|
10
10
|
[](#license)
|
|
@@ -19,10 +19,10 @@ summary of some of YARD's notable features.
|
|
|
19
19
|
|
|
20
20
|
## Feature List
|
|
21
21
|
|
|
22
|
-
**1. RDoc/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
**1. Builtin RDoc/Markdown Hybrid Support**: YARD ships with a builtin markup
|
|
23
|
+
renderer that supports both RDoc and Markdown formatting out of the box—no
|
|
24
|
+
external gem required. You can freely mix RDoc-style and Markdown-style
|
|
25
|
+
documentation without installing any additional libraries.
|
|
26
26
|
|
|
27
27
|
**2. Yardoc Meta-tag Formatting Like Python, Java, Objective-C and other
|
|
28
28
|
languages**: YARD uses a '@tag' style definition syntax for meta tags alongside
|
|
@@ -114,20 +114,17 @@ $ gem install yard
|
|
|
114
114
|
Alternatively, if you've checked the source out directly, you can call
|
|
115
115
|
`rake install` from the root project directory.
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
install lacks RDoc, which is occasionally used by YARD to convert markup to
|
|
119
|
-
HTML. If running `which rdoc` turns up empty, install RDoc by issuing:
|
|
117
|
+
### Markup rendering
|
|
120
118
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
### Markdown parser
|
|
119
|
+
YARD includes a builtin renderer that handles both RDoc and Markdown markup
|
|
120
|
+
types without any external dependencies. To switch the default markup type,
|
|
121
|
+
pass `-m markdown` (or `-m rdoc`) to `yard doc`, or add it to your `.yardopts`
|
|
122
|
+
file.
|
|
126
123
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
124
|
+
For optional extra rendering features (e.g. GitHub-Flavoured Markdown fenced
|
|
125
|
+
code blocks, tables, or specific Markdown extensions), you can install an
|
|
126
|
+
additional provider gem such as `redcarpet`, `commonmarker`, or `kramdown` and
|
|
127
|
+
select it explicitly with `-M PROVIDER` (e.g. `yard doc -m markdown -M redcarpet`).
|
|
131
128
|
|
|
132
129
|
## Usage
|
|
133
130
|
|
|
@@ -307,7 +304,7 @@ the first request of a newly parsed gem.
|
|
|
307
304
|
### 5. `yard graph` Graphviz Generator
|
|
308
305
|
|
|
309
306
|
You can use `yard graph` to generate dot graphs of your code. This, of course,
|
|
310
|
-
requires [Graphviz](
|
|
307
|
+
requires [Graphviz](https://www.graphviz.org) and the `dot` binary. By default
|
|
311
308
|
this will generate a graph of the classes and modules in the best UML2 notation
|
|
312
309
|
that Graphviz can support, but without any methods listed. With the `--full`
|
|
313
310
|
option, methods and attributes will be listed. There is also a `--dependencies`
|
data/docs/GettingStarted.md
CHANGED
|
@@ -61,15 +61,41 @@ Using tags we can add semantic metadata to our code without worrying about
|
|
|
61
61
|
presentation. YARD will handle presentation for us when we decide to generate
|
|
62
62
|
documentation later.
|
|
63
63
|
|
|
64
|
+
### Disconnecting Comment Blocks
|
|
65
|
+
|
|
66
|
+
YARD attaches a comment block to the next relevant object by default. That is
|
|
67
|
+
usually what you want, but file headers are a common exception. If you keep a
|
|
68
|
+
copyright notice, license note or general file-level description at the top of
|
|
69
|
+
the file, it can accidentally become the docstring for the first class or
|
|
70
|
+
module unless you explicitly break the block.
|
|
71
|
+
|
|
72
|
+
To disconnect the block, end the header with an attached `#-` line:
|
|
73
|
+
|
|
74
|
+
# Copyright (c) Example Corp
|
|
75
|
+
# Shared support code for the client layer.
|
|
76
|
+
#-
|
|
77
|
+
|
|
78
|
+
class Client
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
In this example, the header comment is not attached to `Client`.
|
|
82
|
+
|
|
83
|
+
This only works with `#-`. If you write `# -` with a space before the hyphen,
|
|
84
|
+
YARD treats it as a normal comment line and it remains part of the docstring.
|
|
85
|
+
|
|
64
86
|
## Which Markup Format?
|
|
65
87
|
|
|
66
|
-
YARD does not impose a specific markup.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
88
|
+
YARD does not impose a specific markup format. YARD ships with a builtin
|
|
89
|
+
renderer that supports both RDoc and Markdown out of the box—no external gem
|
|
90
|
+
required. You can use either format (or switch between them) without installing
|
|
91
|
+
anything extra. YARD also supports textile, asciidoc, and other formats via
|
|
92
|
+
optional gems.
|
|
93
|
+
|
|
94
|
+
To select a markup format, use the command-line switch `-m FORMAT` or add
|
|
95
|
+
`--markup FORMAT` to your `.yardopts` file. This guide is written in Markdown.
|
|
96
|
+
YARD adds a few important syntaxes that are processed regardless of which
|
|
97
|
+
markup format you choose, such as tag support and inter-document linking.
|
|
98
|
+
These syntaxes are discussed below.
|
|
73
99
|
|
|
74
100
|
## Adding Tags to Documentation
|
|
75
101
|
|
|
@@ -182,7 +208,7 @@ Symbols:
|
|
|
182
208
|
We mentioned that these type fields are "mostly" free-form. In truth, they
|
|
183
209
|
are defined "by convention". To view samples of common type specifications
|
|
184
210
|
and recommended conventions for writing type specifications, see
|
|
185
|
-
[
|
|
211
|
+
[https://yardoc.org/types.html](https://yardoc.org/types.html). Note that these
|
|
186
212
|
conventions may change every now and then, although we are working on a more
|
|
187
213
|
"formal" type specification proposal.
|
|
188
214
|
|
|
@@ -200,7 +226,7 @@ YARD will automatically wire up the correct method types and information
|
|
|
200
226
|
by simply defining documentation in the `@return` tag. For example,
|
|
201
227
|
the following declaration will show the correct information for the
|
|
202
228
|
`waveform` attribute, both for the getter's return type and the
|
|
203
|
-
setter's value parameter type:
|
|
229
|
+
setter's value parameter type:
|
|
204
230
|
|
|
205
231
|
# @return [Numeric] the amplitude of the waveform
|
|
206
232
|
attr_accessor :amplitude
|
|
@@ -248,7 +274,7 @@ The most common is the `attr_accessor` method, which of course has built-in
|
|
|
248
274
|
support in YARD. However, frameworks and libraries often expose custom
|
|
249
275
|
methods that perform similar metaprogramming tasks, and it is often useful
|
|
250
276
|
to document their functionality in your application. Consider the `property`
|
|
251
|
-
method in a project like [DataMapper](
|
|
277
|
+
method in a project like [DataMapper](https://datamapper.org), which creates
|
|
252
278
|
a typed attribute for a database model. The code might look like:
|
|
253
279
|
|
|
254
280
|
class Post
|
|
@@ -386,11 +412,11 @@ If you want to use a Hash, prefix the first { with "!":
|
|
|
386
412
|
|
|
387
413
|
# !{ :some_key => 'value' }
|
|
388
414
|
|
|
389
|
-
### Linking URLs `{
|
|
415
|
+
### Linking URLs `{https://...}`
|
|
390
416
|
|
|
391
417
|
URLs are also linked using this `{...}` syntax:
|
|
392
418
|
|
|
393
|
-
{
|
|
419
|
+
{https://example.com Optional Title}
|
|
394
420
|
{mailto:email@example.com}
|
|
395
421
|
|
|
396
422
|
### Linking Files `{file:...}`
|
|
@@ -672,8 +698,8 @@ not exist, so you may need to create it.
|
|
|
672
698
|
You may find some useful YARD plugins on [RubyGems][RubyGemsQuery] or with
|
|
673
699
|
a [Google advanced query][GoogleAdvancedQuery].
|
|
674
700
|
|
|
675
|
-
[graphviz]:
|
|
676
|
-
[yard-rspec]:
|
|
677
|
-
[rspec]:
|
|
701
|
+
[graphviz]:https://www.graphviz.org
|
|
702
|
+
[yard-rspec]:https://github.com/lsegal/yard-spec-plugin
|
|
703
|
+
[rspec]:https://rspec.info
|
|
678
704
|
[GoogleAdvancedQuery]:https://www.google.com/search?q=site%3Arubygems.org+intitle%3A%22yard-%22+OR+intitle%3A%22yard_%22
|
|
679
705
|
[RubyGemsQuery]:https://rubygems.org/search?utf8=%E2%9C%93&query=name%3A+yard
|
data/docs/Tags.md
CHANGED
|
@@ -141,7 +141,7 @@ a set of conventions for how to list types is described below.
|
|
|
141
141
|
|
|
142
142
|
<p class="note">
|
|
143
143
|
A list of examples of common type listings and what they translate into is
|
|
144
|
-
available at <a href="
|
|
144
|
+
available at <a href="https://yardoc.org/types">https://yardoc.org/types</a>.
|
|
145
145
|
</p>
|
|
146
146
|
|
|
147
147
|
Typically, a type list contains a list of classes or modules that are associated
|
|
@@ -213,9 +213,10 @@ having exactly those 3 elements) would be listed as: `Array(String, Fixnum, Hash
|
|
|
213
213
|
Some literals are accepted by virtue of being Ruby literals, but also by YARD
|
|
214
214
|
conventions. Here is a non-exhaustive list of certain accepted literal values:
|
|
215
215
|
|
|
216
|
-
* `true`, `false`, `nil` — used when a method returns
|
|
217
|
-
values. Note that if your method returns both
|
|
218
|
-
the `Boolean` conventional type
|
|
216
|
+
* `true`, `false`, `nil`, `:foo` — used when a method returns
|
|
217
|
+
these explicit literal values. Note that if your method returns both
|
|
218
|
+
`true` or `false`, you should use the `Boolean` conventional type
|
|
219
|
+
instead.
|
|
219
220
|
* `self` — has the same meaning as Ruby's "self" keyword in the context of
|
|
220
221
|
parameters or return types. Recommended mostly for {tag:return} tags that are
|
|
221
222
|
chainable.
|
|
@@ -280,4 +281,3 @@ Note that you might not need a tag title if you are hiding it. The title
|
|
|
280
281
|
part can be omitted.
|
|
281
282
|
|
|
282
283
|
{yard:include_tags}
|
|
283
|
-
|
data/docs/WhatsNew.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# @title What's New?
|
|
2
2
|
|
|
3
|
+
# What's New in 0.9.x?
|
|
4
|
+
|
|
5
|
+
## Support for Ruby Signature Files (.rbs) (0.9.40)
|
|
6
|
+
|
|
7
|
+
YARD now supports parsing Ruby signature files (.rbs) with full docstring support. This means you can write your documentation in `.rbs` files and have it show up in generated documentation, and use `.rbs` files alongside `.rb` sources to supplement type and API information.
|
|
8
|
+
|
|
9
|
+
## New built-in Markdown renderer (0.9.40)
|
|
10
|
+
|
|
11
|
+
YARD now ships with a built-in Markdown renderer (`YARD::Templates::Helpers::Markup::HybridMarkdown`)
|
|
12
|
+
that requires **no external gems**. It supports a practical subset of GitHub Flavored Markdown (GFM)
|
|
13
|
+
as well as common RDoc markup forms, including:
|
|
14
|
+
|
|
15
|
+
- Headings (`#`, `=`)
|
|
16
|
+
- Fenced code blocks (`` ``` `` and `~~~`) as well as RDoc formatted `+text+` blocks.
|
|
17
|
+
- Tables, blockquotes, and thematic breaks
|
|
18
|
+
- Ordered and unordered lists (including RDoc-style)
|
|
19
|
+
- Inline emphasis, code, links, and images
|
|
20
|
+
- HTML passthrough blocks
|
|
21
|
+
|
|
22
|
+
This renderer is the **default** for both the `rdoc` and `markdown` markup types—no gem
|
|
23
|
+
installation required. If an optional provider gem (e.g. `redcarpet`, `kramdown`,
|
|
24
|
+
`commonmarker`) is installed and selected, YARD will use it instead for extra features such
|
|
25
|
+
as custom extensions or stricter spec compliance.
|
|
26
|
+
|
|
27
|
+
## `#-` comment block separators (0.9.40)
|
|
28
|
+
|
|
29
|
+
YARD now recognizes a trailing `#-` line as a separator between comment
|
|
30
|
+
blocks. This is useful when you want to keep a file header comment at the top
|
|
31
|
+
of a Ruby file without having that header attach itself to the first class,
|
|
32
|
+
module or method in the file.
|
|
33
|
+
|
|
34
|
+
For example:
|
|
35
|
+
|
|
36
|
+
# Copyright (c) Example Corp
|
|
37
|
+
# This file defines support code shared by the client.
|
|
38
|
+
#-
|
|
39
|
+
|
|
40
|
+
class Client
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
In the example above, the file header stays disconnected from `Client`.
|
|
44
|
+
Note that `# -` does **not** act as a separator; only an attached `#-`
|
|
45
|
+
line has this behavior.
|
|
46
|
+
|
|
47
|
+
## Ruby 4.x support (0.9.39)
|
|
48
|
+
|
|
49
|
+
Added support for Ruby 4.x along with new syntaxes.
|
|
50
|
+
|
|
51
|
+
## Other changes
|
|
52
|
+
|
|
53
|
+
See the [CHANGELOG](CHANGELOG.md) for a full list of changes in 0.9.x.
|
|
54
|
+
|
|
3
55
|
# What's New in 0.8.x?
|
|
4
56
|
|
|
5
57
|
1. **Directives (new behavioural tag syntax)** (0.8.0)
|
|
@@ -171,7 +223,7 @@ only mixins inside of a "Foo::Bar" namespace by doing:
|
|
|
171
223
|
YARD now ships with the beginnings of internationalization support
|
|
172
224
|
for translating documentation into multiple languages. The
|
|
173
225
|
`yard i18n` command now allows you to generate ".pot" and ultimately
|
|
174
|
-
".po" files for translation with [gettext](
|
|
226
|
+
".po" files for translation with [gettext](https://www.gnu.org/software/gettext).
|
|
175
227
|
|
|
176
228
|
Note that this tool is a small step in the larger transition for
|
|
177
229
|
proper I18n support in YARD. We still have to add proper gettext
|
|
@@ -283,7 +335,7 @@ above example would be:
|
|
|
283
335
|
But note that `--query` does not work when YARD is in "safe mode"
|
|
284
336
|
due to security concerns, whereas `--api` works in either mode.
|
|
285
337
|
This enables `--api` to function on remote documentation sites like
|
|
286
|
-
[rubydoc.info](
|
|
338
|
+
[rubydoc.info](https://rubydoc.info).
|
|
287
339
|
|
|
288
340
|
## Added `--non-transitive-tag` to disable transitive tag (0.8.3)
|
|
289
341
|
|
|
@@ -307,7 +359,7 @@ with `yard server -B PORT` or `yard server --bind PORT`.
|
|
|
307
359
|
|
|
308
360
|
Support for the AsciiDoc markup type is now introduced using the `asciidoc`
|
|
309
361
|
markup type (`yard doc -m asciidoc`). Requires the
|
|
310
|
-
[asciidoctor](
|
|
362
|
+
[asciidoctor](https://rubygems.org/gems/asciidoctor) RubyGem library to be
|
|
311
363
|
installed before running YARD.
|
|
312
364
|
|
|
313
365
|
## Added `yard markups` command to list available markup types (0.8.6)
|
|
@@ -645,7 +697,7 @@ templates. To serve documentation for installed gems:
|
|
|
645
697
|
will do this for you on-the-fly. It is therefore possible to speed up your
|
|
646
698
|
gem installs by using `gem install GEMNAME --no-rdoc` without repercussion.
|
|
647
699
|
You can also add this switch to your `~/.gemrc` file so that you don't need
|
|
648
|
-
to re-type it each time. See [this link](
|
|
700
|
+
to re-type it each time. See [this link](https://stackoverflow.com/questions/1789376/how-do-i-make-no-ri-no-rdoc-the-default-for-gem-install)
|
|
649
701
|
for exact instructions.</span>
|
|
650
702
|
|
|
651
703
|
## Groups support for method listing (0.6.0)
|
|
@@ -718,7 +770,7 @@ regular diffing tells you which lines have been added/removed in a file,
|
|
|
718
770
|
object diffing allows you to see what classes/methods/modules have been
|
|
719
771
|
added/removed between versions of a codebase.
|
|
720
772
|
|
|
721
|
-
For an overview of how to use `yard diff`, see [YARD Object Oriented Diffing](
|
|
773
|
+
For an overview of how to use `yard diff`, see [YARD Object Oriented Diffing](https://gnuu.org/2010/06/26/yard-object-oriented-diffing/).
|
|
722
774
|
|
|
723
775
|
## `yard stats` to display statistics and undocumented objects (0.6.0)
|
|
724
776
|
|
|
@@ -902,7 +954,7 @@ Support for documenting native Ruby C code (0.5.0)
|
|
|
902
954
|
|
|
903
955
|
It is now possible to document native Ruby extensions with YARD with a new
|
|
904
956
|
C parser mostly borrowed from RDoc. This enables the ability to document
|
|
905
|
-
Ruby's core and stdlibs which will be hosted on
|
|
957
|
+
Ruby's core and stdlibs which will be hosted on https://yardoc.org/docs. In
|
|
906
958
|
addition, the .yardoc dump for the Ruby-core classes will become available
|
|
907
959
|
as an installable gem for yri support (see #3).
|
|
908
960
|
|
|
@@ -1144,7 +1196,7 @@ Default rake task is now `rake yard`
|
|
|
1144
1196
|
Not a big change, but anyone using the default "rake yardoc" task should
|
|
1145
1197
|
update their scripts:
|
|
1146
1198
|
|
|
1147
|
-
[
|
|
1199
|
+
[https://github.com/lsegal/yard/commit/ad38a68dd73898b06bd5d0a1912b7d815878fae0](https://github.com/lsegal/yard/commit/ad38a68dd73898b06bd5d0a1912b7d815878fae0)
|
|
1148
1200
|
|
|
1149
1201
|
|
|
1150
1202
|
What's New in 0.2.3.x?
|
data/lib/yard/autoload.rb
CHANGED
|
@@ -69,6 +69,16 @@ module YARD
|
|
|
69
69
|
autoload :MethodHandler, __p('handlers/common/method_handler')
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
+
# RBS type signature handlers
|
|
73
|
+
module RBS
|
|
74
|
+
autoload :Base, __p('handlers/rbs/base')
|
|
75
|
+
autoload :AttributeHandler, __p('handlers/rbs/attribute_handler')
|
|
76
|
+
autoload :ConstantHandler, __p('handlers/rbs/constant_handler')
|
|
77
|
+
autoload :MethodHandler, __p('handlers/rbs/method_handler')
|
|
78
|
+
autoload :MixinHandler, __p('handlers/rbs/mixin_handler')
|
|
79
|
+
autoload :NamespaceHandler, __p('handlers/rbs/namespace_handler')
|
|
80
|
+
end
|
|
81
|
+
|
|
72
82
|
# CRuby Handlers
|
|
73
83
|
# @since 0.8.0
|
|
74
84
|
module C
|
|
@@ -183,6 +193,12 @@ module YARD
|
|
|
183
193
|
autoload :TokenResolver, __p('parser/ruby/token_resolver')
|
|
184
194
|
end
|
|
185
195
|
|
|
196
|
+
# RBS type signature parser
|
|
197
|
+
module RBS
|
|
198
|
+
autoload :RbsParser, __p('parser/rbs/rbs_parser')
|
|
199
|
+
autoload :Statement, __p('parser/rbs/statement')
|
|
200
|
+
end
|
|
201
|
+
|
|
186
202
|
autoload :Base, __p('parser/base')
|
|
187
203
|
autoload :ParserSyntaxError, __p('parser/source_parser')
|
|
188
204
|
autoload :SourceParser, __p('parser/source_parser')
|
|
@@ -271,6 +287,7 @@ module YARD
|
|
|
271
287
|
module Templates
|
|
272
288
|
module Helpers # Namespace for template helpers
|
|
273
289
|
module Markup # Namespace for markup providers
|
|
290
|
+
autoload :HybridMarkdown, __p('templates/helpers/markup/hybrid_markdown')
|
|
274
291
|
autoload :RDocMarkup, __p('templates/helpers/markup/rdoc_markup')
|
|
275
292
|
autoload :RDocMarkdown, __p('templates/helpers/markup/rdoc_markdown')
|
|
276
293
|
end
|
data/lib/yard/cli/diff.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
require 'tmpdir'
|
|
3
3
|
require 'fileutils'
|
|
4
4
|
require 'open-uri'
|
|
5
|
+
require 'open3'
|
|
5
6
|
|
|
6
7
|
module YARD
|
|
7
8
|
module CLI
|
|
@@ -108,7 +109,11 @@ module YARD
|
|
|
108
109
|
FileUtils.mkdir_p(tmpdir)
|
|
109
110
|
FileUtils.cp_r('.', tmpdir)
|
|
110
111
|
Dir.chdir(tmpdir)
|
|
111
|
-
|
|
112
|
+
out, status = Open3.capture2e('git', 'reset', '--hard', commit)
|
|
113
|
+
log.info("git says: " + out.chomp)
|
|
114
|
+
unless status.success?
|
|
115
|
+
raise "git reset --hard #{commit.inspect} failed with exit status #{status.exitstatus}: #{out}"
|
|
116
|
+
end
|
|
112
117
|
generate_yardoc(tmpdir)
|
|
113
118
|
ensure
|
|
114
119
|
Dir.chdir(@old_path)
|
|
@@ -158,7 +163,7 @@ module YARD
|
|
|
158
163
|
end
|
|
159
164
|
|
|
160
165
|
# Remote gemfile from rubygems.org
|
|
161
|
-
url = "
|
|
166
|
+
url = "https://rubygems.org/downloads/#{gemfile}"
|
|
162
167
|
log.info "Searching for remote gem file #{url}"
|
|
163
168
|
begin
|
|
164
169
|
# Note: In Ruby 2.4.x, URI.open is a private method. After
|
|
@@ -201,7 +201,7 @@ module YARD
|
|
|
201
201
|
|
|
202
202
|
private
|
|
203
203
|
|
|
204
|
-
# @note this method fixes a bug in 1.9.2:
|
|
204
|
+
# @note this method fixes a bug in 1.9.2: https://gist.github.com/437136
|
|
205
205
|
def to_ary; nil end
|
|
206
206
|
|
|
207
207
|
# Attempts to find the object that this unresolved object
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Handles RBS attr_reader, attr_writer, and attr_accessor declarations.
|
|
3
|
+
#
|
|
4
|
+
# Registers one or two {YARD::CodeObjects::MethodObject} instances (reader
|
|
5
|
+
# and/or writer) with @return / @param tags derived from the RBS type.
|
|
6
|
+
class YARD::Handlers::RBS::AttributeHandler < YARD::Handlers::RBS::Base
|
|
7
|
+
handles :attr_reader, :attr_writer, :attr_accessor
|
|
8
|
+
|
|
9
|
+
process do
|
|
10
|
+
attr_name = statement.name
|
|
11
|
+
rbs_type = statement.attr_rbs_type
|
|
12
|
+
yard_types = rbs_type ? YARD::Handlers::RBS::MethodHandler.rbs_type_to_yard_types(rbs_type) : nil
|
|
13
|
+
mscope = statement.visibility == :class ? :class : :instance
|
|
14
|
+
|
|
15
|
+
case statement.type
|
|
16
|
+
when :attr_reader
|
|
17
|
+
register_reader(attr_name, yard_types, mscope)
|
|
18
|
+
when :attr_writer
|
|
19
|
+
register_writer(attr_name, yard_types, mscope)
|
|
20
|
+
when :attr_accessor
|
|
21
|
+
register_reader(attr_name, yard_types, mscope)
|
|
22
|
+
register_writer(attr_name, yard_types, mscope)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def register_reader(name, types, scope)
|
|
29
|
+
obj = register MethodObject.new(namespace, name, scope)
|
|
30
|
+
if types && !obj.has_tag?(:return)
|
|
31
|
+
obj.add_tag YARD::Tags::Tag.new(:return, '', types)
|
|
32
|
+
end
|
|
33
|
+
obj
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def register_writer(name, types, scope)
|
|
37
|
+
obj = register MethodObject.new(namespace, "#{name}=", scope)
|
|
38
|
+
if types && !obj.has_tag?(:param)
|
|
39
|
+
obj.add_tag YARD::Tags::Tag.new(:param, '', types, "value")
|
|
40
|
+
end
|
|
41
|
+
obj
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module YARD
|
|
3
|
+
module Handlers
|
|
4
|
+
# Handlers for RBS (Ruby type signature) files.
|
|
5
|
+
module RBS
|
|
6
|
+
# Base class for all RBS handlers.
|
|
7
|
+
# Handlers match on the {Parser::RBS::Statement#type} symbol of the
|
|
8
|
+
# current statement and process it to create or annotate code objects.
|
|
9
|
+
class Base < Handlers::Base
|
|
10
|
+
# @return [Boolean] whether this handler matches the given statement
|
|
11
|
+
def self.handles?(statement, _processor)
|
|
12
|
+
handlers.any? do |matcher|
|
|
13
|
+
case matcher
|
|
14
|
+
when Symbol
|
|
15
|
+
statement.type == matcher
|
|
16
|
+
when String
|
|
17
|
+
statement.type.to_s == matcher
|
|
18
|
+
when Regexp
|
|
19
|
+
(statement.source || '') =~ matcher
|
|
20
|
+
else
|
|
21
|
+
false
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Recurse into the body of a namespace statement.
|
|
27
|
+
# @param opts [Hash] state overrides
|
|
28
|
+
# @see #push_state
|
|
29
|
+
def parse_block(opts = {})
|
|
30
|
+
return if statement.block.nil? || statement.block.empty?
|
|
31
|
+
push_state(opts) do
|
|
32
|
+
parser.process(statement.block)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Handles RBS constant declarations: `Name: Type`
|
|
3
|
+
class YARD::Handlers::RBS::ConstantHandler < YARD::Handlers::RBS::Base
|
|
4
|
+
handles :constant
|
|
5
|
+
|
|
6
|
+
process do
|
|
7
|
+
obj = register ConstantObject.new(namespace, statement.name)
|
|
8
|
+
if statement.attr_rbs_type && !obj.has_tag?(:return)
|
|
9
|
+
obj.add_tag YARD::Tags::Tag.new(:return, '', rbs_types(statement.attr_rbs_type))
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def rbs_types(type_str)
|
|
16
|
+
YARD::Handlers::RBS::MethodHandler.rbs_type_to_yard_types(type_str)
|
|
17
|
+
end
|
|
18
|
+
end
|