yard 0.7.5 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- data/.yardopts +10 -2
- data/ChangeLog +1263 -38
- data/LEGAL +5 -5
- data/LICENSE +1 -1
- data/README.md +91 -82
- data/Rakefile +6 -6
- data/benchmarks/builtins_vs_eval.rb +1 -1
- data/benchmarks/erb_vs_erubis.rb +4 -4
- data/benchmarks/generation.rb +5 -5
- data/benchmarks/parsing.rb +2 -2
- data/benchmarks/registry_store_types.rb +48 -0
- data/bin/yard +9 -1
- data/bin/yardoc +9 -1
- data/bin/yri +10 -2
- data/docs/CodeObjects.md +10 -10
- data/docs/GettingStarted.md +85 -83
- data/docs/Handlers.md +21 -21
- data/docs/Overview.md +7 -7
- data/docs/Parser.md +30 -30
- data/docs/Tags.md +250 -554
- data/docs/TagsArch.md +123 -0
- data/docs/Templates.md +58 -80
- data/docs/WhatsNew.md +378 -133
- data/docs/templates/default/fulldoc/html/full_list_tag.erb +7 -0
- data/docs/templates/default/fulldoc/html/setup.rb +6 -0
- data/docs/templates/default/layout/html/setup.rb +8 -0
- data/docs/templates/default/layout/html/tag_list.erb +11 -0
- data/docs/templates/default/yard_tags/html/list.erb +18 -0
- data/docs/templates/default/yard_tags/html/setup.rb +27 -0
- data/docs/templates/plugin.rb +65 -0
- data/lib/yard.rb +1 -10
- data/lib/yard/autoload.rb +75 -27
- data/lib/yard/cli/command.rb +5 -2
- data/lib/yard/cli/command_parser.rb +3 -2
- data/lib/yard/cli/diff.rb +1 -1
- data/lib/yard/cli/i18n.rb +69 -0
- data/lib/yard/cli/list.rb +1 -1
- data/lib/yard/cli/server.rb +30 -7
- data/lib/yard/cli/stats.rb +5 -6
- data/lib/yard/cli/yardoc.rb +95 -45
- data/lib/yard/cli/yri.rb +24 -3
- data/lib/yard/code_objects/base.rb +35 -4
- data/lib/yard/code_objects/extra_file_object.rb +1 -1
- data/lib/yard/code_objects/macro_object.rb +56 -99
- data/lib/yard/code_objects/method_object.rb +44 -6
- data/lib/yard/config.rb +18 -8
- data/lib/yard/core_ext/symbol_hash.rb +1 -1
- data/lib/yard/docstring.rb +45 -85
- data/lib/yard/docstring_parser.rb +269 -0
- data/lib/yard/handlers/base.rb +129 -118
- data/lib/yard/handlers/c/alias_handler.rb +15 -0
- data/lib/yard/handlers/c/attribute_handler.rb +13 -0
- data/lib/yard/handlers/c/base.rb +110 -0
- data/lib/yard/handlers/c/class_handler.rb +26 -0
- data/lib/yard/handlers/c/constant_handler.rb +12 -0
- data/lib/yard/handlers/c/handler_methods.rb +165 -0
- data/lib/yard/handlers/c/init_handler.rb +16 -0
- data/lib/yard/handlers/c/method_handler.rb +35 -0
- data/lib/yard/handlers/c/mixin_handler.rb +13 -0
- data/lib/yard/handlers/c/module_handler.rb +16 -0
- data/lib/yard/handlers/c/override_comment_handler.rb +22 -0
- data/lib/yard/handlers/c/path_handler.rb +10 -0
- data/lib/yard/handlers/c/struct_handler.rb +12 -0
- data/lib/yard/handlers/c/symbol_handler.rb +7 -0
- data/lib/yard/handlers/processor.rb +41 -30
- data/lib/yard/handlers/ruby/alias_handler.rb +0 -2
- data/lib/yard/handlers/ruby/attribute_handler.rb +16 -17
- data/lib/yard/handlers/ruby/base.rb +10 -6
- data/lib/yard/handlers/ruby/comment_handler.rb +9 -0
- data/lib/yard/handlers/ruby/dsl_handler.rb +14 -0
- data/lib/yard/handlers/ruby/dsl_handler_methods.rb +71 -0
- data/lib/yard/handlers/ruby/legacy/alias_handler.rb +0 -3
- data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +16 -17
- data/lib/yard/handlers/ruby/legacy/base.rb +28 -6
- data/lib/yard/handlers/ruby/legacy/comment_handler.rb +9 -0
- data/lib/yard/handlers/ruby/legacy/dsl_handler.rb +16 -0
- data/lib/yard/handlers/ruby/legacy/method_handler.rb +0 -2
- data/lib/yard/handlers/ruby/legacy/mixin_handler.rb +1 -1
- data/lib/yard/handlers/ruby/legacy/module_function_handler.rb +18 -0
- data/lib/yard/handlers/ruby/method_handler.rb +10 -15
- data/lib/yard/handlers/ruby/mixin_handler.rb +1 -1
- data/lib/yard/handlers/ruby/module_function_handler.rb +26 -0
- data/lib/yard/handlers/ruby/struct_handler_methods.rb +3 -2
- data/lib/yard/i18n/pot_generator.rb +281 -0
- data/lib/yard/i18n/text.rb +72 -0
- data/lib/yard/logging.rb +3 -7
- data/lib/yard/options.rb +216 -0
- data/lib/yard/parser/c/c_parser.rb +225 -0
- data/lib/yard/parser/c/comment_parser.rb +131 -0
- data/lib/yard/parser/c/statement.rb +63 -0
- data/lib/yard/parser/ruby/ast_node.rb +91 -1
- data/lib/yard/parser/ruby/legacy/ruby_parser.rb +1 -0
- data/lib/yard/parser/ruby/legacy/statement.rb +7 -2
- data/lib/yard/parser/ruby/legacy/statement_list.rb +13 -22
- data/lib/yard/parser/ruby/ruby_parser.rb +87 -26
- data/lib/yard/parser/source_parser.rb +89 -88
- data/lib/yard/rake/yardoc_task.rb +1 -1
- data/lib/yard/registry.rb +21 -10
- data/lib/yard/registry_store.rb +48 -0
- data/lib/yard/serializers/file_system_serializer.rb +18 -20
- data/lib/yard/serializers/yardoc_serializer.rb +1 -0
- data/lib/yard/server/adapter.rb +2 -2
- data/lib/yard/server/commands/base.rb +1 -1
- data/lib/yard/server/commands/display_object_command.rb +13 -6
- data/lib/yard/server/commands/frames_command.rb +4 -21
- data/lib/yard/server/commands/library_command.rb +57 -11
- data/lib/yard/server/commands/list_command.rb +10 -34
- data/lib/yard/server/commands/search_command.rb +8 -2
- data/lib/yard/server/doc_server_helper.rb +34 -0
- data/lib/yard/server/rack_adapter.rb +5 -1
- data/lib/yard/server/router.rb +4 -10
- data/lib/yard/server/static_caching.rb +2 -2
- data/lib/yard/server/templates/default/fulldoc/html/css/custom.css +2 -2
- data/lib/yard/server/templates/default/fulldoc/html/js/live.js +0 -15
- data/lib/yard/server/templates/default/layout/html/breadcrumb.erb +3 -3
- data/lib/yard/server/templates/default/layout/html/script_setup.erb +8 -0
- data/lib/yard/server/templates/doc_server/processing/html/processing.erb +1 -1
- data/lib/yard/server/templates/doc_server/search/html/setup.rb +1 -1
- data/lib/yard/tags/default_factory.rb +31 -4
- data/lib/yard/tags/directives.rb +593 -0
- data/lib/yard/tags/library.rb +437 -35
- data/lib/yard/templates/engine.rb +17 -12
- data/lib/yard/templates/helpers/base_helper.rb +8 -2
- data/lib/yard/templates/helpers/html_helper.rb +57 -14
- data/lib/yard/templates/helpers/markup/rdoc_markup.rb +1 -1
- data/lib/yard/templates/helpers/markup_helper.rb +9 -9
- data/lib/yard/templates/helpers/text_helper.rb +2 -2
- data/lib/yard/templates/template.rb +42 -13
- data/lib/yard/templates/template_options.rb +81 -0
- data/spec/cli/command_parser_spec.rb +4 -4
- data/spec/cli/command_spec.rb +3 -3
- data/spec/cli/config_spec.rb +13 -13
- data/spec/cli/diff_spec.rb +13 -10
- data/spec/cli/gems_spec.rb +12 -12
- data/spec/cli/help_spec.rb +2 -2
- data/spec/cli/i18n_spec.rb +111 -0
- data/spec/cli/server_spec.rb +66 -18
- data/spec/cli/stats_spec.rb +15 -15
- data/spec/cli/yardoc_spec.rb +124 -97
- data/spec/cli/yri_spec.rb +14 -12
- data/spec/code_objects/base_spec.rb +104 -46
- data/spec/code_objects/class_object_spec.rb +33 -33
- data/spec/code_objects/code_object_list_spec.rb +5 -5
- data/spec/code_objects/constants_spec.rb +4 -3
- data/spec/code_objects/extra_file_object_spec.rb +19 -19
- data/spec/code_objects/macro_object_spec.rb +31 -37
- data/spec/code_objects/method_object_spec.rb +46 -23
- data/spec/code_objects/module_object_spec.rb +16 -16
- data/spec/code_objects/namespace_object_spec.rb +6 -6
- data/spec/code_objects/proxy_spec.rb +19 -19
- data/spec/config_spec.rb +33 -24
- data/spec/core_ext/array_spec.rb +1 -1
- data/spec/core_ext/file_spec.rb +8 -8
- data/spec/core_ext/hash_spec.rb +1 -1
- data/spec/core_ext/insertion_spec.rb +3 -3
- data/spec/core_ext/module_spec.rb +1 -1
- data/spec/core_ext/string_spec.rb +6 -6
- data/spec/core_ext/symbol_hash_spec.rb +11 -11
- data/spec/docstring_parser_spec.rb +207 -0
- data/spec/docstring_spec.rb +33 -146
- data/spec/handlers/alias_handler_spec.rb +14 -14
- data/spec/handlers/attribute_handler_spec.rb +20 -20
- data/spec/handlers/base_spec.rb +16 -16
- data/spec/handlers/c/alias_handler_spec.rb +33 -0
- data/spec/handlers/c/attribute_handler_spec.rb +40 -0
- data/spec/handlers/c/class_handler_spec.rb +64 -0
- data/spec/handlers/c/constant_handler_spec.rb +68 -0
- data/spec/handlers/c/init_handler_spec.rb +36 -0
- data/spec/handlers/c/method_handler_spec.rb +228 -0
- data/spec/handlers/c/mixin_handler_spec.rb +27 -0
- data/spec/handlers/c/module_handler_spec.rb +38 -0
- data/spec/handlers/c/override_comment_handler_spec.rb +43 -0
- data/spec/handlers/c/path_handler_spec.rb +35 -0
- data/spec/handlers/c/spec_helper.rb +11 -0
- data/spec/handlers/c/struct_handler_spec.rb +15 -0
- data/spec/handlers/class_condition_handler_spec.rb +10 -10
- data/spec/handlers/class_handler_spec.rb +38 -38
- data/spec/handlers/class_variable_handler_spec.rb +1 -1
- data/spec/handlers/constant_handler_spec.rb +7 -7
- data/spec/handlers/{macro_handler_spec.rb → dsl_handler_spec.rb} +72 -53
- data/spec/handlers/examples/alias_handler_001.rb.txt +5 -5
- data/spec/handlers/examples/class_condition_handler_001.rb.txt +9 -9
- data/spec/handlers/examples/class_handler_001.rb.txt +1 -1
- data/spec/handlers/examples/dsl_handler_001.rb.txt +110 -0
- data/spec/handlers/examples/exception_handler_001.rb.txt +14 -14
- data/spec/handlers/examples/method_condition_handler_001.rb.txt +2 -2
- data/spec/handlers/examples/method_handler_001.rb.txt +16 -16
- data/spec/handlers/examples/mixin_handler_001.rb.txt +8 -4
- data/spec/handlers/examples/private_constant_handler_001.rb.txt +1 -1
- data/spec/handlers/examples/visibility_handler_001.rb.txt +3 -3
- data/spec/handlers/examples/yield_handler_001.rb.txt +13 -14
- data/spec/handlers/exception_handler_spec.rb +9 -9
- data/spec/handlers/extend_handler_spec.rb +2 -2
- data/spec/handlers/legacy_base_spec.rb +34 -34
- data/spec/handlers/method_condition_handler_spec.rb +2 -2
- data/spec/handlers/method_handler_spec.rb +33 -33
- data/spec/handlers/mixin_handler_spec.rb +13 -9
- data/spec/handlers/module_function_handler_spec.rb +82 -0
- data/spec/handlers/module_handler_spec.rb +6 -6
- data/spec/handlers/private_constant_handler_spec.rb +3 -3
- data/spec/handlers/processor_spec.rb +5 -5
- data/spec/handlers/ruby/base_spec.rb +10 -6
- data/spec/handlers/ruby/legacy/base_spec.rb +11 -7
- data/spec/handlers/spec_helper.rb +2 -3
- data/spec/handlers/visibility_handler_spec.rb +6 -6
- data/spec/handlers/yield_handler_spec.rb +8 -8
- data/spec/i18n/pot_generator_spec.rb +244 -0
- data/spec/i18n/text_spec.rb +69 -0
- data/spec/options_spec.rb +160 -0
- data/spec/parser/base_spec.rb +3 -3
- data/spec/parser/c_parser_spec.rb +31 -257
- data/spec/parser/examples/array.c.txt +187 -187
- data/spec/parser/examples/extrafile.c.txt +1 -1
- data/spec/parser/examples/override.c.txt +1 -1
- data/spec/parser/ruby/ast_node_spec.rb +1 -1
- data/spec/parser/ruby/legacy/statement_list_spec.rb +24 -24
- data/spec/parser/ruby/legacy/token_list_spec.rb +7 -7
- data/spec/parser/ruby/ruby_parser_spec.rb +56 -34
- data/spec/parser/source_parser_spec.rb +125 -65
- data/spec/parser/tag_parsing_spec.rb +4 -4
- data/spec/rake/yardoc_task_spec.rb +10 -8
- data/spec/registry_spec.rb +65 -36
- data/spec/registry_store_spec.rb +90 -40
- data/spec/serializers/file_system_serializer_spec.rb +12 -12
- data/spec/serializers/yardoc_serializer_spec.rb +2 -2
- data/spec/server/adapter_spec.rb +3 -3
- data/spec/server/commands/base_spec.rb +8 -8
- data/spec/server/commands/library_command_spec.rb +3 -3
- data/spec/server/commands/static_file_command_spec.rb +7 -7
- data/spec/server/doc_server_helper_spec.rb +1 -1
- data/spec/server/doc_server_serializer_spec.rb +6 -6
- data/spec/server/rack_adapter_spec.rb +3 -3
- data/spec/server/router_spec.rb +19 -19
- data/spec/server/static_caching_spec.rb +4 -4
- data/spec/spec_helper.rb +7 -7
- data/spec/tags/default_factory_spec.rb +24 -16
- data/spec/tags/directives_spec.rb +422 -0
- data/spec/tags/library_spec.rb +15 -4
- data/spec/tags/overload_tag_spec.rb +6 -6
- data/spec/tags/ref_tag_list_spec.rb +8 -8
- data/spec/templates/class_spec.rb +7 -7
- data/spec/templates/constant_spec.rb +7 -7
- data/spec/templates/engine_spec.rb +28 -36
- data/spec/templates/examples/class001.html +108 -108
- data/spec/templates/examples/class002.html +17 -17
- data/spec/templates/examples/constant001.txt +1 -1
- data/spec/templates/examples/method001.html +45 -45
- data/spec/templates/examples/method002.html +25 -25
- data/spec/templates/examples/method003.html +60 -60
- data/spec/templates/examples/method004.html +7 -7
- data/spec/templates/examples/method005.html +28 -28
- data/spec/templates/examples/module001.html +321 -321
- data/spec/templates/examples/module001.txt +1 -1
- data/spec/templates/examples/module002.html +130 -130
- data/spec/templates/examples/module003.html +74 -74
- data/spec/templates/examples/module004.html +388 -0
- data/spec/templates/helpers/base_helper_spec.rb +32 -32
- data/spec/templates/helpers/html_helper_spec.rb +87 -68
- data/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +9 -9
- data/spec/templates/helpers/markup/rdoc_markup_spec.rb +16 -16
- data/spec/templates/helpers/markup_helper_spec.rb +31 -28
- data/spec/templates/helpers/method_helper_spec.rb +7 -7
- data/spec/templates/helpers/shared_signature_examples.rb +9 -7
- data/spec/templates/helpers/text_helper_spec.rb +3 -3
- data/spec/templates/method_spec.rb +13 -13
- data/spec/templates/module_spec.rb +70 -24
- data/spec/templates/onefile_spec.rb +32 -15
- data/spec/templates/section_spec.rb +23 -23
- data/spec/templates/spec_helper.rb +31 -1
- data/spec/templates/tag_spec.rb +5 -5
- data/spec/templates/template_spec.rb +54 -46
- data/spec/verifier_spec.rb +5 -5
- data/templates/default/class/setup.rb +2 -2
- data/templates/default/docstring/html/abstract.erb +1 -1
- data/templates/default/docstring/html/note.erb +1 -1
- data/templates/default/docstring/html/private.erb +1 -1
- data/templates/default/docstring/html/todo.erb +1 -1
- data/templates/default/docstring/setup.rb +2 -2
- data/templates/default/fulldoc/html/css/full_list.css +4 -2
- data/templates/default/fulldoc/html/css/style.css +50 -44
- data/templates/default/fulldoc/html/frames.erb +21 -6
- data/templates/default/fulldoc/html/full_list.erb +5 -3
- data/templates/default/fulldoc/html/{full_list_files.erb → full_list_file.erb} +0 -0
- data/templates/default/fulldoc/html/js/app.js +29 -26
- data/templates/default/fulldoc/html/js/full_list.js +9 -9
- data/templates/default/fulldoc/html/js/jquery.js +4 -16
- data/templates/default/fulldoc/html/setup.rb +42 -38
- data/templates/default/layout/dot/header.erb +1 -1
- data/templates/default/layout/html/breadcrumb.erb +6 -6
- data/templates/default/layout/html/files.erb +1 -1
- data/templates/default/layout/html/footer.erb +1 -1
- data/templates/default/layout/html/headers.erb +3 -6
- data/templates/default/layout/html/index.erb +1 -1
- data/templates/default/layout/html/layout.erb +3 -7
- data/templates/default/layout/html/objects.erb +1 -1
- data/templates/default/layout/html/script_setup.erb +5 -0
- data/templates/default/layout/html/search.erb +4 -1
- data/templates/default/layout/html/setup.rb +8 -8
- data/templates/default/method_details/html/method_signature.erb +10 -3
- data/templates/default/method_details/setup.rb +1 -0
- data/templates/default/module/dot/info.erb +1 -1
- data/templates/default/module/dot/setup.rb +2 -2
- data/templates/default/module/html/attribute_details.erb +1 -1
- data/templates/default/module/html/children.erb +1 -1
- data/templates/default/module/html/defines.erb +1 -1
- data/templates/default/module/html/inherited_methods.erb +5 -4
- data/templates/default/module/html/item_summary.erb +15 -5
- data/templates/default/module/html/method_details_list.erb +2 -2
- data/templates/default/module/setup.rb +25 -12
- data/templates/default/module/text/setup.rb +1 -1
- data/templates/default/onefile/html/layout.erb +1 -1
- data/templates/default/onefile/html/setup.rb +2 -2
- data/templates/default/tags/html/example.erb +4 -2
- data/templates/default/tags/html/option.erb +1 -1
- data/templates/default/tags/html/overload.erb +1 -1
- data/templates/default/tags/html/see.erb +1 -1
- data/templates/default/tags/html/tag.erb +1 -1
- data/templates/default/tags/setup.rb +4 -3
- data/templates/guide/fulldoc/html/css/style.css +8 -8
- data/templates/guide/fulldoc/html/js/app.js +6 -6
- data/templates/guide/fulldoc/html/setup.rb +12 -12
- data/templates/guide/layout/html/layout.erb +11 -11
- data/templates/guide/layout/html/setup.rb +9 -9
- data/templates/guide/method/html/header.erb +2 -2
- data/templates/guide/method/html/setup.rb +1 -1
- metadata +68 -18
- data/bin/yard-graph +0 -4
- data/bin/yard-server +0 -4
- data/docs/Glossary.md +0 -12
- data/lib/yard/handlers/ruby/legacy/macro_handler.rb +0 -39
- data/lib/yard/handlers/ruby/macro_handler.rb +0 -40
- data/lib/yard/handlers/ruby/macro_handler_methods.rb +0 -131
- data/lib/yard/parser/c_parser.rb +0 -497
- data/lib/yard/server/templates/default/layout/html/headers.erb +0 -16
- data/lib/yard/server/templates/doc_server/frames/html/frames.erb +0 -13
- data/lib/yard/server/templates/doc_server/frames/html/setup.rb +0 -3
- data/lib/yard/server/templates/doc_server/full_list/html/full_list.erb +0 -34
- data/lib/yard/server/templates/doc_server/full_list/html/setup.rb +0 -20
- data/spec/handlers/examples/macro_handler_001.rb.txt +0 -83
data/docs/WhatsNew.md
CHANGED
@@ -1,5 +1,250 @@
|
|
1
1
|
# @title What's New?
|
2
2
|
|
3
|
+
# What's New in 0.8.x?
|
4
|
+
|
5
|
+
1. **Directives (new behavioural tag syntax)** (0.8.0)
|
6
|
+
2. **Added `--embed-mixin(s)` to embed mixins into class docs** (0.8.0)
|
7
|
+
3. **Internationalization (I18n) support for translating docs** (0.8.0)
|
8
|
+
4. **New C parser / handlers architecture** (0.8.0)
|
9
|
+
5. **YARD will now warn if `@param` name not in method params** (0.8.0)
|
10
|
+
6. **Added support for `module_function` calls in Ruby code** (0.8.0)
|
11
|
+
7. **Greatly improved tag documentation using custom template** (0.8.0)
|
12
|
+
8. **Tags can now contain '.' for namespacing** (0.8.0)
|
13
|
+
9. **Added "frames" links for non-framed pages for better nav** (0.8.0)
|
14
|
+
10. **Added Gemfile support to YARD server for local gem sets** (0.8.0)
|
15
|
+
11. **Server now displays README on index route like static docs** (0.8.0)
|
16
|
+
12. **Added line numbers to `yard stats --list-undoc --compact`** (0.8.0)
|
17
|
+
13. **Single object db now default (multi-object db unsupported)** (0.8.0)
|
18
|
+
|
19
|
+
## Directives (new behavioural tag syntax) (0.8.0)
|
20
|
+
|
21
|
+
<p class="note">
|
22
|
+
The tags {tag:!macro}, {tag:!method}, {tag:!attribute}, {tag:!group},
|
23
|
+
{tag:!endgroup}, {tag:!scope} and {tag:!visibility} have been changed
|
24
|
+
from meta-data tags to directives. This means they should now be called
|
25
|
+
with the "@!" prefix instead of "@". Note however that for <strong>
|
26
|
+
backward compatibility</strong>, the old "@macro", "@method", etc.,
|
27
|
+
syntax for all of these tags will still work and is supported.
|
28
|
+
</p>
|
29
|
+
|
30
|
+
<p class="note">
|
31
|
+
Some <strong>backwards incompatible</strong> changes were made to {tag:!macro} syntax.
|
32
|
+
Please read this section carefully if you are using this tag.
|
33
|
+
</p>
|
34
|
+
|
35
|
+
YARD 0.8.0 adds a new tag syntax called "directives" using the `@!`
|
36
|
+
prefix. These directive tags can be used to modify parser state while
|
37
|
+
processing objects, or even create new objects on the fly. A plugin
|
38
|
+
API is available similar to tags, and directives should be registered
|
39
|
+
in the {YARD::Tags::Library} class using {YARD::Tags::Library.define_directive}.
|
40
|
+
|
41
|
+
To use a directive, simply call it the same way as any tag. Tag syntax
|
42
|
+
is documented in {file:docs/Tags.md}.
|
43
|
+
|
44
|
+
### Notable features of directives
|
45
|
+
|
46
|
+
#### Directives do not need to be attached to object docstrings
|
47
|
+
|
48
|
+
Unlike meta-data tags which apply to created objects, directives
|
49
|
+
do not need to be attached to an object in order to be used. This
|
50
|
+
means you can have free-standing comments with directives, such as:
|
51
|
+
|
52
|
+
# @macro mymacro
|
53
|
+
# A new macro, not attached to any docstring
|
54
|
+
|
55
|
+
# ...other Ruby code here...
|
56
|
+
|
57
|
+
# Using the macro:
|
58
|
+
# @macro mymacro
|
59
|
+
def mymethod; end
|
60
|
+
|
61
|
+
You can do the same to define methods and attributes, as discussed
|
62
|
+
below.
|
63
|
+
|
64
|
+
#### `@!method` and `@!attribute` directives improved
|
65
|
+
|
66
|
+
The method and attribute directives can now be used to create multiple
|
67
|
+
objects in a single docstring. Previously a `@method` or `@attribute`
|
68
|
+
tag would only create one method per docstring. In 0.8.0, you could
|
69
|
+
attach multiple methods to the same block of Ruby source, such as:
|
70
|
+
|
71
|
+
# @!method foo(a, b, c)
|
72
|
+
# @!method bar(x, y, z)
|
73
|
+
# Docstring for code
|
74
|
+
some_ruby_source
|
75
|
+
|
76
|
+
The above creates #foo and #bar and the source listing for both will
|
77
|
+
be `some_ruby_source` with "Docstring for code" as the docstring.
|
78
|
+
|
79
|
+
The attribute directive can take advantage of this functionality as well.
|
80
|
+
Note that these directives also do not need to be attached to a line of
|
81
|
+
code to be recognized; they can be in free-standing comments if the
|
82
|
+
methods are defined dynamically and not associated with any code.
|
83
|
+
|
84
|
+
#### New `@!parse` directive to parse Ruby code
|
85
|
+
|
86
|
+
A new {tag:!parse} directive was added that allows a developer to have
|
87
|
+
YARD parse code that might not necessarily be parseable in its original
|
88
|
+
form. This is useful when using `instance_eval` and other dynamic
|
89
|
+
meta-programming techniques to define methods or perform functionality.
|
90
|
+
For instance, a common case of the "self.included" callback in module
|
91
|
+
to extend a module on a class might be in the form:
|
92
|
+
|
93
|
+
def self.included(mod)
|
94
|
+
mod.extend(self)
|
95
|
+
end
|
96
|
+
|
97
|
+
Unfortunately, this does not get picked up by YARD, but on the original
|
98
|
+
class, we can add:
|
99
|
+
|
100
|
+
class MyClass
|
101
|
+
# @!parse extend TheDynamicModule
|
102
|
+
include TheDynamicModule
|
103
|
+
end
|
104
|
+
|
105
|
+
YARD will then parse the code `extend TheDynamicModule` as if
|
106
|
+
it were in the source file.
|
107
|
+
|
108
|
+
You can also use this technique to register regular methods as
|
109
|
+
attributes, if you did not define them with `attr_*` methods:
|
110
|
+
|
111
|
+
def foo; @foo end
|
112
|
+
def foo=(v) @foo = v end
|
113
|
+
|
114
|
+
# Register them as methods:
|
115
|
+
# @!parse attr_accessor :foo
|
116
|
+
|
117
|
+
### Backward incompatible changes to `@!macro` directive
|
118
|
+
|
119
|
+
Unfortunately, in order to create the new directives architecture,
|
120
|
+
some previously supported syntax in `@macro` tags are no longer supported.
|
121
|
+
Specifically, macros can no longer expand text on an entire docstring.
|
122
|
+
Instead, macros only expand the data that is indented inside of the tag
|
123
|
+
text.
|
124
|
+
|
125
|
+
This syntax is **no longer supported**:
|
126
|
+
|
127
|
+
# @macro mymacro
|
128
|
+
# Expanding text $1 $2 $3
|
129
|
+
property :a, :b, :c
|
130
|
+
|
131
|
+
In 0.7.0 to 0.7.5, the above would have created a method with the docstring
|
132
|
+
"Expanding text a b c". This will not work in 0.8.0. Instead, you must
|
133
|
+
indent all the macro expansion data so that it is part of the `@macro`
|
134
|
+
tag as follows:
|
135
|
+
|
136
|
+
# @!macro mymacro
|
137
|
+
# Expanding text $1 $2 $3
|
138
|
+
property :a, :b, :c
|
139
|
+
|
140
|
+
Note that we also use the recommended `@!macro` syntax, though `@macro`
|
141
|
+
is still supported.
|
142
|
+
|
143
|
+
## Added `--embed-mixin(s)` to embed mixins into class docs (0.8.0)
|
144
|
+
|
145
|
+
Methods from mixins can now be embedded directly into the documentation
|
146
|
+
output for a class by using `--embed-mixin ModuleName`, or `--embed-mixins`
|
147
|
+
for all mixins. This enables a documentation writer to refactor methods
|
148
|
+
into modules without worrying about them showing up in separate files
|
149
|
+
in generated documentation. When mixin methods are embedded, they
|
150
|
+
show up in both the original module page and the pages of the classes
|
151
|
+
they are mixed into. A note is added to the method signature telling the
|
152
|
+
user where the method comes from.
|
153
|
+
|
154
|
+
The `--embed-mixin` command-line option can also take wildcard values
|
155
|
+
in order to match specific namespaces. For instance, you can embed
|
156
|
+
only mixins inside of a "Foo::Bar" namespace by doing:
|
157
|
+
|
158
|
+
!!!sh
|
159
|
+
$ yard doc --embed-mixin "Foo::Bar::*"
|
160
|
+
|
161
|
+
## Internationalization (I18n) support for translating docs
|
162
|
+
|
163
|
+
YARD now ships with the beginnings of internationalization support
|
164
|
+
for translating documentation into multiple languages. The
|
165
|
+
`yard i18n` command now allows you to generate ".pot" and ultimately
|
166
|
+
".po" files for translation with [gettext](http://www.gnu.org/software/gettext).
|
167
|
+
|
168
|
+
Note that this tool is a small step in the larger transition for
|
169
|
+
proper I18n support in YARD. We still have to add proper gettext
|
170
|
+
support to our templates for proper generation in multiple languages,
|
171
|
+
but this tool allows you to get started in translating your
|
172
|
+
documents. Improved I18n support will come throughout the 0.8.x series.
|
173
|
+
|
174
|
+
## New C parser / handlers architecture (0.8.0)
|
175
|
+
|
176
|
+
The C parser was completely rewritten to take advantage of YARD's
|
177
|
+
parser and handler architecture. This means more YARD will be more robust
|
178
|
+
when parsing failures occur, tags and directives will now work consistently
|
179
|
+
across Ruby and CRuby files ({tag:!group} will now work, for instance),
|
180
|
+
and developers can now write custom handlers that target CRuby source files.
|
181
|
+
|
182
|
+
## YARD will now warn if `@param` name not in method params (0.8.0)
|
183
|
+
|
184
|
+
YARD will now give you a warning if you use a `@param` tag in your
|
185
|
+
source but give an invalid parameter name. This should catch a lot of
|
186
|
+
common documentation errors and help keep your documentation consistent.
|
187
|
+
|
188
|
+
## Added support for `module_function` calls in Ruby code (0.8.0)
|
189
|
+
|
190
|
+
The `module_function` command in Ruby is now supported in Ruby files.
|
191
|
+
It defines two separate methods, one class and one instance method,
|
192
|
+
both having the exact same docstring, and marks the instance method
|
193
|
+
as private.
|
194
|
+
|
195
|
+
## Greatly improved tag documentation using custom template (0.8.0)
|
196
|
+
|
197
|
+
We have completely revamped the {docs/Tags.md} to include documentation
|
198
|
+
for each meta-data tag and directive with at least one useful example
|
199
|
+
for each one. This was done using template customization and extension
|
200
|
+
available within YARD.
|
201
|
+
|
202
|
+
## Tags can now contain '.' for namespacing (0.8.0)
|
203
|
+
|
204
|
+
Prior to 0.8.0, tags could only contain alphanumeric characters and
|
205
|
+
underscore. YARD now allows the '.' character in tag names, and it
|
206
|
+
is now recommended for namespacing project-specific custom tags.
|
207
|
+
YARD has its own set of custom tags that are namespaced in this
|
208
|
+
way (using the "yard.tagname" namespace). The namespace recommendation
|
209
|
+
is to use "projectname.tagname", or "projectname.component.tagname".
|
210
|
+
|
211
|
+
## Added "frames" links for non-framed pages for better nav (0.8.0)
|
212
|
+
|
213
|
+
Frames navigation has always had a "(no frames)" link to get rid
|
214
|
+
of the frameset. YARD 0.8.0 introduces a "(frames)" link on non-framed
|
215
|
+
pages to reverse this, allowing you to navigate between framed and
|
216
|
+
frameless pages seamlessly.
|
217
|
+
|
218
|
+
## Added Gemfile support to YARD server for local gem sets (0.8.0)
|
219
|
+
|
220
|
+
The `yard server` command now supports `--gemfile` to serve gems
|
221
|
+
from a Gemfile.lock, instead of all system-wide gems.
|
222
|
+
|
223
|
+
## Server now displays README on index route like static docs (0.8.0)
|
224
|
+
|
225
|
+
The `yard server` command will now behave like static docs regarding
|
226
|
+
the index action for a project, listing the README file if present
|
227
|
+
before displaying the alphabetic index. Note that the route for
|
228
|
+
the alphabetic index page has now moved to the explicit '/index' action.
|
229
|
+
|
230
|
+
## Added line numbers to `yard stats --list-undoc --compact` (0.8.0)
|
231
|
+
|
232
|
+
Line numbers are now listed in the compact listing of undocumented objects
|
233
|
+
so that they can be more easily located in the files.
|
234
|
+
|
235
|
+
## Single object db now default (multi-object db unsupported) (0.8.0)
|
236
|
+
|
237
|
+
YARD previously would split the .yardoc db into multiple marshal files
|
238
|
+
for load-time performance reasons if it grew past a specific number of
|
239
|
+
objects. This check is now disabled, and YARD will never automatically
|
240
|
+
switch to a multi-object DB. YARD will now always use the single object
|
241
|
+
db unless explicitly set with `--no-single-db`. If YARD is taking a
|
242
|
+
long time to load your .yardoc database, you can try using this
|
243
|
+
option to split your database into multiple files, but note that this
|
244
|
+
can cause problems with certain codebases (specifically, if you
|
245
|
+
have class methods using the same name as a module/class).
|
246
|
+
|
247
|
+
|
3
248
|
# What's New in 0.7.x?
|
4
249
|
|
5
250
|
1. **Macro support and detection of DSL methods** (0.7.0)
|
@@ -33,16 +278,16 @@ or attributes in your class. Consider DataMapper's "property" declaration:
|
|
33
278
|
# @return [String] the title of the post
|
34
279
|
property :title, String
|
35
280
|
end
|
36
|
-
|
281
|
+
|
37
282
|
The above declaration would be created as the `Post#title`. The optional
|
38
283
|
`@attribute` tag tells YARD that the property is an "attribute", and not just
|
39
284
|
a regular method.
|
40
285
|
|
41
286
|
In addition to basic DSL method detection, YARD also supports macros to create
|
42
|
-
docstrings that can be copies to other objects; these macros can also be
|
287
|
+
docstrings that can be copies to other objects; these macros can also be
|
43
288
|
"attached" to class level methods to create implicit documentation for macros.
|
44
289
|
|
45
|
-
Macros and DSL method detection are discussed in much more detail in the
|
290
|
+
Macros and DSL method detection are discussed in much more detail in the
|
46
291
|
{file:docs/GettingStarted.md}, so you should read about them there if you're
|
47
292
|
interested in this feature.
|
48
293
|
|
@@ -53,10 +298,10 @@ template in the same manner that inherited methods do.
|
|
53
298
|
|
54
299
|
## The 'app' directory is now parsed by default (0.7.0)
|
55
300
|
|
56
|
-
YARD tries to follow the "It Just Works" attitude in writing developer tools,
|
301
|
+
YARD tries to follow the "It Just Works" attitude in writing developer tools,
|
57
302
|
and therefore has added `app/**/*.rb` to the default list of globs that it
|
58
303
|
searches for code in. You no longer need to create a `.yardopts` just to
|
59
|
-
list your app directory when documenting your code on rubydoc.info.
|
304
|
+
list your app directory when documenting your code on rubydoc.info.
|
60
305
|
We should have done this a while ago! And don't worry, YARD still checks
|
61
306
|
lib and ext by default, too.
|
62
307
|
|
@@ -65,10 +310,10 @@ lib and ext by default, too.
|
|
65
310
|
Extra files (READMEs, ChangeLogs, LICENSE files, and other guides) now support
|
66
311
|
metadata tags, just like docstrings in code comments. By adding @tag values
|
67
312
|
to the top of a file (no whitespace preceding it) inside of a `# comment` line,
|
68
|
-
YARD will detect and parse these tags and store it for later usage.
|
313
|
+
YARD will detect and parse these tags and store it for later usage.
|
69
314
|
|
70
|
-
Tags can contain arbitrary data as well as arbitrary tag names, however the
|
71
|
-
tag names @title and @markup are reserved to specify the document title and
|
315
|
+
Tags can contain arbitrary data as well as arbitrary tag names, however the
|
316
|
+
tag names @title and @markup are reserved to specify the document title and
|
72
317
|
markup format respectively. The title will be used in the file list menu,
|
73
318
|
index page, as well as any linking of the file via the `{file:Filename}`
|
74
319
|
syntax. An example of a document with metadata would be:
|
@@ -76,11 +321,11 @@ syntax. An example of a document with metadata would be:
|
|
76
321
|
# @title The Best Project Ever!
|
77
322
|
# @markup rdoc
|
78
323
|
# @author Foo Bar (custom tag, does not display in templates)
|
79
|
-
|
324
|
+
|
80
325
|
= This Project Rules
|
81
|
-
|
326
|
+
|
82
327
|
== Contents
|
83
|
-
|
328
|
+
|
84
329
|
...
|
85
330
|
|
86
331
|
Note that previous versions of YARD recommended specifying the markup of an
|
@@ -93,7 +338,7 @@ The `yardoc --list` command is used to list objects that are parsed from
|
|
93
338
|
a codebase. This can be used to grep methods/classes in a codebase from the
|
94
339
|
command line. `yard list` now calls `yardoc --list` as a convenience command.
|
95
340
|
|
96
|
-
Note that the `yardoc --list` command may eventually be replaced by a more
|
341
|
+
Note that the `yardoc --list` command may eventually be replaced by a more
|
97
342
|
feature-filled `yard list` command, so `yard list` should be used instead of
|
98
343
|
`yardoc --list` when possible.
|
99
344
|
|
@@ -117,7 +362,7 @@ Ruby source files and performing syntax highlighting on the code.
|
|
117
362
|
|
118
363
|
## Added `{render:OBJECT}` syntax to embed object docs in extra files (0.7.0)
|
119
364
|
|
120
|
-
You can now use the `{render:Object}` syntax to embed the documentation
|
365
|
+
You can now use the `{render:Object}` syntax to embed the documentation
|
121
366
|
rendering of an entire object (method, class, module) inside of an extra file.
|
122
367
|
This is useful when writing non-API based guides that might require listing
|
123
368
|
a few helper methods or classes. The {file:docs/GettingStarted.md} discussed
|
@@ -140,7 +385,7 @@ above.
|
|
140
385
|
|
141
386
|
## Added state tracking variables to Parser/Handler architecture (0.7.0)
|
142
387
|
|
143
|
-
The parser and handler architecture now contain state variables
|
388
|
+
The parser and handler architecture now contain state variables
|
144
389
|
{YARD::Handlers::Base#extra_state} and {YARD::Handlers::Processor#globals}
|
145
390
|
to share data across handlers and the entire processing phase. `#extra_state`
|
146
391
|
provided a place to store per-file data, while `#globals` gives the developer
|
@@ -220,7 +465,7 @@ markup types:
|
|
220
465
|
* pre: Used to wrap text inside `<pre>` tags
|
221
466
|
* text: No formatting except for hard breaks (`<br>`) on newlines
|
222
467
|
* none: No formatting at all.
|
223
|
-
|
468
|
+
|
224
469
|
In all cases, HTML is escaped from input. If you want no HTML escaping, use the
|
225
470
|
html markup type.
|
226
471
|
|
@@ -255,109 +500,109 @@ for aliases is not supported, however.
|
|
255
500
|
## Local documentation server for RubyGems or projects (`yard server`) (0.6.0)
|
256
501
|
|
257
502
|
The new `yard server` command spawns a documentation server that can serve
|
258
|
-
either documentation for a local project or installed RubyGems. The server
|
259
|
-
will host (by default) on http://localhost:8808.
|
503
|
+
either documentation for a local project or installed RubyGems. The server
|
504
|
+
will host (by default) on http://localhost:8808.
|
260
505
|
|
261
506
|
To serve documentation for the active project (in the current directory):
|
262
507
|
|
263
508
|
$ yard server
|
264
|
-
|
265
|
-
The server can also run in "incremental" mode for local projects. In this
|
266
|
-
situation, any modified sources will immediately be updated at each request,
|
267
|
-
ensuring that the server always serve the code exactly as it is on disk.
|
268
|
-
Documenting your code in this fashion essentially gives you an efficient a
|
269
|
-
live preview without running a separate command everytime you make a change.
|
509
|
+
|
510
|
+
The server can also run in "incremental" mode for local projects. In this
|
511
|
+
situation, any modified sources will immediately be updated at each request,
|
512
|
+
ensuring that the server always serve the code exactly as it is on disk.
|
513
|
+
Documenting your code in this fashion essentially gives you an efficient a
|
514
|
+
live preview without running a separate command everytime you make a change.
|
270
515
|
To serve documentation for the active project in incremental mode:
|
271
516
|
|
272
517
|
$ yard server --reload
|
273
|
-
|
274
|
-
<span class="note">Note that in incremental mode, objects or method groupings
|
275
|
-
cannot be removed. If you have removed objects or modified groupings, you
|
276
|
-
will need to flush the cache by deleting `.yardoc` and (optionally)
|
518
|
+
|
519
|
+
<span class="note">Note that in incremental mode, objects or method groupings
|
520
|
+
cannot be removed. If you have removed objects or modified groupings, you
|
521
|
+
will need to flush the cache by deleting `.yardoc` and (optionally)
|
277
522
|
restarting the server.</span>
|
278
523
|
|
279
|
-
The documentation server can also serve documentation for all installed gems
|
280
|
-
on your system, similar to `gem server`, but using YARD's functionality and
|
524
|
+
The documentation server can also serve documentation for all installed gems
|
525
|
+
on your system, similar to `gem server`, but using YARD's functionality and
|
281
526
|
templates. To serve documentation for installed gems:
|
282
527
|
|
283
528
|
$ yard server --gems
|
284
|
-
|
285
|
-
<span class="note">Documentation for the gem need not be previously generated
|
286
|
-
at install-time. If documentation for the gem has not been generated, YARD
|
287
|
-
will do this for you on-the-fly. It is therefore possible to speed up your
|
529
|
+
|
530
|
+
<span class="note">Documentation for the gem need not be previously generated
|
531
|
+
at install-time. If documentation for the gem has not been generated, YARD
|
532
|
+
will do this for you on-the-fly. It is therefore possible to speed up your
|
288
533
|
gem installs by using `gem install GEMNAME --no-rdoc` without repercussion.
|
289
534
|
You can also add this switch to your `~/.gemrc` file so that you don't need
|
290
|
-
to re-type it each time. See [this link](http://stackoverflow.com/questions/1789376/how-do-i-make-no-ri-no-rdoc-the-default-for-gem-install)
|
535
|
+
to re-type it each time. See [this link](http://stackoverflow.com/questions/1789376/how-do-i-make-no-ri-no-rdoc-the-default-for-gem-install)
|
291
536
|
for exact instructions.</span>
|
292
537
|
|
293
538
|
## Groups support for method listing (0.6.0)
|
294
539
|
|
295
|
-
You can now organize methods in a class/module into logical separated groups.
|
296
|
-
These groups apply lexically and are listed in the order they are defined.
|
540
|
+
You can now organize methods in a class/module into logical separated groups.
|
541
|
+
These groups apply lexically and are listed in the order they are defined.
|
297
542
|
For instance, to define a group:
|
298
543
|
|
299
544
|
# @group Rendering an Object
|
300
|
-
|
545
|
+
|
301
546
|
# Documentation here
|
302
547
|
def foo; end
|
303
|
-
|
548
|
+
|
304
549
|
# Extra documentation...
|
305
550
|
def bar; end
|
306
|
-
|
551
|
+
|
307
552
|
# @group Another Group
|
308
|
-
|
553
|
+
|
309
554
|
def aaa; end
|
310
|
-
|
311
|
-
<span class="note">Note that these `@group` and `@endgroup` declarations are
|
312
|
-
not "tags" and should always be separated with at least 1 line of whitespace
|
555
|
+
|
556
|
+
<span class="note">Note that these `@group` and `@endgroup` declarations are
|
557
|
+
not "tags" and should always be separated with at least 1 line of whitespace
|
313
558
|
from any other documentation or code.</span>
|
314
|
-
|
315
|
-
In the above example, "Rendering an Object" will be listed with "foo" and
|
316
|
-
"bar" above "Another Group", even though "aaa" comes before the two other
|
317
|
-
methods, alphabetically. To end a group, use `@endgroup`. It is not necessary
|
318
|
-
to end a group to start a new one, only if there is an object following the
|
559
|
+
|
560
|
+
In the above example, "Rendering an Object" will be listed with "foo" and
|
561
|
+
"bar" above "Another Group", even though "aaa" comes before the two other
|
562
|
+
methods, alphabetically. To end a group, use `@endgroup`. It is not necessary
|
563
|
+
to end a group to start a new one, only if there is an object following the
|
319
564
|
group that should not belong in any group.
|
320
565
|
|
321
566
|
# @group Group 1
|
322
|
-
|
567
|
+
|
323
568
|
def foo; end
|
324
|
-
|
569
|
+
|
325
570
|
# @endgroup
|
326
|
-
|
571
|
+
|
327
572
|
# This method should not be listed in any group
|
328
573
|
def bar; end
|
329
574
|
|
330
575
|
## Single file template (`--one-file`) support (0.6.0)
|
331
576
|
|
332
|
-
`yardoc` now has the `--one-file` option to generate a single-file template
|
333
|
-
for small scripts and libraries. In this case, any comments at the top of
|
577
|
+
`yardoc` now has the `--one-file` option to generate a single-file template
|
578
|
+
for small scripts and libraries. In this case, any comments at the top of
|
334
579
|
the script file will be recognized as a README.
|
335
580
|
|
336
581
|
## `yard` CLI executable with pluggable commands (0.6.0)
|
337
582
|
|
338
|
-
<span class="note">The `yardoc` and `yri` commands are not deprecated and can
|
339
|
-
continue to be used. They are shortcuts for `yard doc` and `yard ri`
|
583
|
+
<span class="note">The `yardoc` and `yri` commands are not deprecated and can
|
584
|
+
continue to be used. They are shortcuts for `yard doc` and `yard ri`
|
340
585
|
respectively. However, `yard-graph` has been removed.</span>
|
341
586
|
|
342
|
-
YARD now has a `yard` executable which combines all pre-existing and new
|
343
|
-
commands into a single pluggable command that is both easier to remember and
|
587
|
+
YARD now has a `yard` executable which combines all pre-existing and new
|
588
|
+
commands into a single pluggable command that is both easier to remember and
|
344
589
|
access. To get a list of commands, type `yard --help`.
|
345
590
|
|
346
|
-
If you are a plugin developer, you can create your own `yard` command by first
|
347
|
-
subclassing the {YARD::CLI::Command} class and then registering this class
|
591
|
+
If you are a plugin developer, you can create your own `yard` command by first
|
592
|
+
subclassing the {YARD::CLI::Command} class and then registering this class
|
348
593
|
with the {YARD::CLI::CommandParser.commands} list. For instance:
|
349
594
|
|
350
595
|
YARD::CLI::CommandParser.commands[:my_command] = MyCommandClass
|
351
|
-
|
596
|
+
|
352
597
|
The above line will enable the user to execute `yard my_command [options]`.
|
353
598
|
|
354
599
|
## `yard diff` command to object-diff two versions of a project (0.6.0)
|
355
600
|
|
356
|
-
One of the built-in commands that comes with the new `yard` executable is the
|
357
|
-
ability to do object-oriented diffing across multiple versions of the same
|
358
|
-
project, either by 2 versions of a gem, or 2 working copies. Just like
|
359
|
-
regular diffing tells you which lines have been added/removed in a file,
|
360
|
-
object diffing allows you to see what classes/methods/modules have been
|
601
|
+
One of the built-in commands that comes with the new `yard` executable is the
|
602
|
+
ability to do object-oriented diffing across multiple versions of the same
|
603
|
+
project, either by 2 versions of a gem, or 2 working copies. Just like
|
604
|
+
regular diffing tells you which lines have been added/removed in a file,
|
605
|
+
object diffing allows you to see what classes/methods/modules have been
|
361
606
|
added/removed between versions of a codebase.
|
362
607
|
|
363
608
|
For an overview of how to use `yard diff`, see [YARD Object Oriented Diffing](http://gnuu.org/2010/06/26/yard-object-oriented-diffing/).
|
@@ -372,30 +617,30 @@ YARD now outputs the following statistics when `yard stats` is run:
|
|
372
617
|
Constants: 53 ( 20 undocumented)
|
373
618
|
Methods: 602 ( 70 undocumented)
|
374
619
|
85.16% documented
|
375
|
-
|
376
|
-
Note that these statistics are based on what you have set to show in your
|
377
|
-
documentation. If you use `@private` tags and/or do not display
|
378
|
-
private/protected methods in your documentation, these will not show up as
|
620
|
+
|
621
|
+
Note that these statistics are based on what you have set to show in your
|
622
|
+
documentation. If you use `@private` tags and/or do not display
|
623
|
+
private/protected methods in your documentation, these will not show up as
|
379
624
|
undocumented. Therefore this metric is contextual.
|
380
625
|
|
381
|
-
You can also specifically list all undocumented objects (and their file
|
626
|
+
You can also specifically list all undocumented objects (and their file
|
382
627
|
locations) with the `--list-undoc` option.
|
383
628
|
|
384
629
|
## Added `--asset` option to `yardoc` (0.6.0)
|
385
630
|
|
386
|
-
The `yardoc` command can now take the `--asset` option to copy over
|
387
|
-
files/directories (recursively) to the output path after generating
|
388
|
-
documentation. The format of the argument is "from:to" where from is the
|
389
|
-
source path and to is the destination. For instance, YARD uses the following
|
390
|
-
syntax in the `.yardopts` file to copy over image assets from the
|
631
|
+
The `yardoc` command can now take the `--asset` option to copy over
|
632
|
+
files/directories (recursively) to the output path after generating
|
633
|
+
documentation. The format of the argument is "from:to" where from is the
|
634
|
+
source path and to is the destination. For instance, YARD uses the following
|
635
|
+
syntax in the `.yardopts` file to copy over image assets from the
|
391
636
|
'docs/images' directory into the 'images' directory after generating HTML:
|
392
637
|
|
393
638
|
--asset docs/images:images
|
394
639
|
|
395
640
|
## New template API (0.6.0)
|
396
641
|
|
397
|
-
The new template API allows for easier insertion of sections within an
|
398
|
-
inherited template. You should no longer need to insert by index, an
|
642
|
+
The new template API allows for easier insertion of sections within an
|
643
|
+
inherited template. You should no longer need to insert by index, an
|
399
644
|
error-prone process that could break when a template is updated. Instead of:
|
400
645
|
|
401
646
|
sections.last.place(:my_section).before(:another_section)
|
@@ -403,56 +648,56 @@ error-prone process that could break when a template is updated. Instead of:
|
|
403
648
|
use:
|
404
649
|
|
405
650
|
sections.place(:my_section).before_any(:another_section)
|
406
|
-
|
651
|
+
|
407
652
|
You can see more in the {file:docs/Templates.md#Inserting_and_Traversing_Sections}
|
408
653
|
document.
|
409
654
|
|
410
655
|
## HTML template now adds inline Table of Contents for extra files pages (0.6.0)
|
411
656
|
|
412
|
-
A table of contents is now generated dynamically using JavaScript for extra
|
657
|
+
A table of contents is now generated dynamically using JavaScript for extra
|
413
658
|
file pages (such as README's, or this document). It is generated based off the
|
414
|
-
headers (h1,h2,... tags) used in the document, and can be floated to the
|
659
|
+
headers (h1,h2,... tags) used in the document, and can be floated to the
|
415
660
|
right or listed inline on the page.
|
416
661
|
|
417
662
|
## Ad-hoc tag registration via `yardoc` CLI (`--tag`, etc.) (0.6.0)
|
418
663
|
|
419
|
-
Simple meta-data tags can now be added at the command-line and registered to
|
420
|
-
display in templates in a number of pre-defined ways. For instance, to create
|
664
|
+
Simple meta-data tags can now be added at the command-line and registered to
|
665
|
+
display in templates in a number of pre-defined ways. For instance, to create
|
421
666
|
a freeform text tag, use the following:
|
422
667
|
|
423
668
|
--tag my_tag_name:"My Tag Title"
|
424
|
-
|
425
|
-
You can also create a "typed" tag (similar to `@return`), a typed named tag
|
426
|
-
(similar to `@param`) as well as various combinations. The full list of
|
669
|
+
|
670
|
+
You can also create a "typed" tag (similar to `@return`), a typed named tag
|
671
|
+
(similar to `@param`) as well as various combinations. The full list of
|
427
672
|
options are listed in `yardoc --help` under the "Tag Options" section.
|
428
|
-
|
429
|
-
If you wish to create a tag to store data but do not wish to show this data
|
673
|
+
|
674
|
+
If you wish to create a tag to store data but do not wish to show this data
|
430
675
|
in the templates, use the `--hide-tag` option to hide it from generated output:
|
431
676
|
|
432
677
|
--hide-tag my_tag_name
|
433
678
|
|
434
679
|
## Added `--transitive-tags` to register transitive tags (0.6.0)
|
435
680
|
|
436
|
-
Transitive tags are tags that apply to all descendants of a namespace (class
|
437
|
-
or module) when documented on that namespace. For instance, the `@since` tag
|
438
|
-
is a transitive tag. Applying `@since` to a class will automatically apply
|
439
|
-
`@since` to all methods in the class. Creating a `@since` tag directly on a
|
681
|
+
Transitive tags are tags that apply to all descendants of a namespace (class
|
682
|
+
or module) when documented on that namespace. For instance, the `@since` tag
|
683
|
+
is a transitive tag. Applying `@since` to a class will automatically apply
|
684
|
+
`@since` to all methods in the class. Creating a `@since` tag directly on a
|
440
685
|
method will override the inherited value.
|
441
686
|
|
442
687
|
You can specify transitive tags on the command-line by using this option. Note
|
443
688
|
that the tags must already exist (built-in or created with the `--tag` option)
|
444
|
-
to be specified as transitive. If you wish to do this programmatically, see
|
689
|
+
to be specified as transitive. If you wish to do this programmatically, see
|
445
690
|
the {YARD::Tags::Library.transitive_tags} attribute.
|
446
691
|
|
447
692
|
## `yardoc` now displays RDoc-like statistics (`--no-stats` to hide) (0.6.0)
|
448
693
|
|
449
|
-
As seen in the `yard stats` feature overview, `yardoc` displays RDoc-like
|
450
|
-
statistics when it is run. The output is equivalent to typing `yard stats`.
|
694
|
+
As seen in the `yard stats` feature overview, `yardoc` displays RDoc-like
|
695
|
+
statistics when it is run. The output is equivalent to typing `yard stats`.
|
451
696
|
To hide this output when yardoc is run, use `--no-stats`.
|
452
697
|
|
453
698
|
## `yri` now works on constants (0.6.0)
|
454
699
|
|
455
|
-
Templates have now been added for text view of constants, which displays any
|
700
|
+
Templates have now been added for text view of constants, which displays any
|
456
701
|
documentation and the constant value.
|
457
702
|
|
458
703
|
## Plugins are no longer auto-loaded (added `--plugin` switch) (0.6.2)
|
@@ -461,14 +706,14 @@ This is a backwards-incompatible change that disables plugins from automatically
|
|
461
706
|
loading when YARD starts up. From now on, you should manually declare which
|
462
707
|
plugins your project is using by adding `--plugin PLUGINNAME` to a `.yardopts`
|
463
708
|
file in the root of your project. You can also re-enable autoloaded plugins
|
464
|
-
by setting `load_plugins` to true in your configuration file (`yard config load_plugins true`,
|
465
|
-
see next item). You can also set `autoload_plugins` to a list of plugins
|
709
|
+
by setting `load_plugins` to true in your configuration file (`yard config load_plugins true`,
|
710
|
+
see next item). You can also set `autoload_plugins` to a list of plugins
|
466
711
|
to be automatically loaded on start.
|
467
712
|
|
468
713
|
If you are a YARD plugin author, please make sure to inform your users of these
|
469
714
|
changes.
|
470
715
|
|
471
|
-
Note that `--plugin` switches passed on the commandline (not via `.yardopts`)
|
716
|
+
Note that `--plugin` switches passed on the commandline (not via `.yardopts`)
|
472
717
|
are parsed before commands are loaded, and therefore can add in new CLI commands.
|
473
718
|
|
474
719
|
## Added `YARD::Config` API and `~/.yard/config` configuration file (0.6.2)
|
@@ -486,11 +731,11 @@ and looks like:
|
|
486
731
|
:safe_mode: false
|
487
732
|
|
488
733
|
You can also set configuration options via the command-line (see next item).
|
489
|
-
|
734
|
+
|
490
735
|
## Added `yard config` command to view/edit configuration (0.6.2)
|
491
736
|
|
492
737
|
A new `yard config` command was created to view or edit the configuration
|
493
|
-
file via the commandline.
|
738
|
+
file via the commandline.
|
494
739
|
|
495
740
|
* To view the current configuration use `yard config --list`.
|
496
741
|
* To view a specific item use `yard config ITEMNAME`
|
@@ -551,8 +796,8 @@ as an installable gem for yri support (see #3).
|
|
551
796
|
Incremental parsing and output generation with `yardoc -c` (0.5.0, 0.5.3)
|
552
797
|
-------------------------------------------------------------------------
|
553
798
|
|
554
|
-
<p class="note">Note: in 0.5.3 and above you must use <tt>--incremental</tt>
|
555
|
-
to incrementally generate HTML, otherwise only parsing will be done
|
799
|
+
<p class="note">Note: in 0.5.3 and above you must use <tt>--incremental</tt>
|
800
|
+
to incrementally generate HTML, otherwise only parsing will be done
|
556
801
|
incrementally but HTML will be generated with all objects. <tt>--incremental</tt>
|
557
802
|
implies <tt>-c</tt>, so no need to specify them both.</p>
|
558
803
|
|
@@ -576,7 +821,7 @@ by yard. Therefore, to use this command you must first parse all gems with
|
|
576
821
|
YARD. To parse all gems, use the following command:
|
577
822
|
|
578
823
|
$ sudo yardoc --build-gems
|
579
|
-
|
824
|
+
|
580
825
|
The above command builds a .yardoc file for all installed gems in the
|
581
826
|
respective gem directory. If you do not have write access to the gem path,
|
582
827
|
YARD will write the yardoc file to `~/.yard/gem_index/NAME-VERSION.yardoc`.
|
@@ -586,7 +831,7 @@ Note: you can also use `--re-build-gems` to force re-parsing of all gems.
|
|
586
831
|
You can now do lookups with yri:
|
587
832
|
|
588
833
|
$ yri JSON
|
589
|
-
|
834
|
+
|
590
835
|
All lookups are cached to `~/.yard/yri_cache` for quicker lookups the second
|
591
836
|
time onward.
|
592
837
|
|
@@ -598,7 +843,7 @@ method that has not declared a @return tag. To customize the default
|
|
598
843
|
return type, you can specify:
|
599
844
|
|
600
845
|
$ yardoc --default-return 'MyDefaultType'
|
601
|
-
|
846
|
+
|
602
847
|
You can also use the empty string to list no return type.
|
603
848
|
|
604
849
|
In addition, you can use --hide-void-return to ignore any method that
|
@@ -607,7 +852,7 @@ defines itself as a void type by: `@return [void]`
|
|
607
852
|
Multiple syntax highlighting language support (0.5.0)
|
608
853
|
-----------------------------------------------------
|
609
854
|
|
610
|
-
YARD now supports the ability to specify a language type for code blocks in
|
855
|
+
YARD now supports the ability to specify a language type for code blocks in
|
611
856
|
docstrings. Although no actual highlighting support is added for any language
|
612
857
|
but Ruby, you can add your own support by writing your own helper method:
|
613
858
|
|
@@ -615,7 +860,7 @@ but Ruby, you can add your own support by writing your own helper method:
|
|
615
860
|
def html_syntax_highlight_LANGNAME(source)
|
616
861
|
# return highlighted HTML
|
617
862
|
end
|
618
|
-
|
863
|
+
|
619
864
|
To use this language in code blocks, prefix the block with `!!!LANGNAME`:
|
620
865
|
|
621
866
|
!!!plain
|
@@ -640,9 +885,9 @@ Support for yard-doc-* gem packages as hosted .yardoc dbs (0.5.1)
|
|
640
885
|
|
641
886
|
You can now install special YARD plugin gems titled yard-doc-NAME to get
|
642
887
|
packaged a .yardoc database. This will enable yri lookups or building docs
|
643
|
-
for the gem without the code.
|
888
|
+
for the gem without the code.
|
644
889
|
|
645
|
-
One main use for this is the `yard-doc-core` package, which enabled yri
|
890
|
+
One main use for this is the `yard-doc-core` package, which enabled yri
|
646
891
|
support for Ruby core classes (stdlib coming soon as `yard-doc-stdlib`).
|
647
892
|
To install it, simply:
|
648
893
|
|
@@ -658,7 +903,7 @@ for a specific version of Ruby, use the `--version` switch on gem:
|
|
658
903
|
Support for extra search paths in `yri` (0.5.1)
|
659
904
|
-----------------------------------------------
|
660
905
|
|
661
|
-
You can now add custom paths to non-gem .yardoc files
|
906
|
+
You can now add custom paths to non-gem .yardoc files
|
662
907
|
by adding them as newline separated paths in `~/.yard/yri_search_paths`.
|
663
908
|
|
664
909
|
Generating HTML docs now adds frames view (0.5.3)
|
@@ -671,7 +916,7 @@ still find frames beneficial.
|
|
671
916
|
Tree view for class list (0.5.3)
|
672
917
|
--------------------------------
|
673
918
|
|
674
|
-
The class list now displays as an expandable tree view to better organized an
|
919
|
+
The class list now displays as an expandable tree view to better organized an
|
675
920
|
otherwise cluttered namespace. If you properly namespace your less important
|
676
921
|
classes (like Rails timezone classes), they will not take up space in the
|
677
922
|
class list unless the user looks for them.
|
@@ -684,8 +929,8 @@ top of the file with a shebang-like line:
|
|
684
929
|
|
685
930
|
#!textile
|
686
931
|
contents here
|
687
|
-
|
688
|
-
The above file contents will be rendered with a textile markup engine
|
932
|
+
|
933
|
+
The above file contents will be rendered with a textile markup engine
|
689
934
|
(eg. RedCloth).
|
690
935
|
|
691
936
|
Keyboard shortcuts for default HTML template (0.5.4)
|
@@ -702,7 +947,7 @@ You can now register parsers for custom source languages by calling the
|
|
702
947
|
following method:
|
703
948
|
|
704
949
|
SourceParser.register_parser_type(:java, MyJavaParser, 'java')
|
705
|
-
|
950
|
+
|
706
951
|
The parser class MyJavaParser should be a subclass of {YARD::Parser::Base},
|
707
952
|
and the last argument is a set of extensions (string, array or regexp). You
|
708
953
|
can read more about registering parsers at the {YARD::Parser::SourceParser}
|
@@ -723,13 +968,13 @@ New templating engine and templates
|
|
723
968
|
-----------------------------------
|
724
969
|
|
725
970
|
The templates were redesigned, most notably removing the ugly frameset, adding
|
726
|
-
search to the class/method lists, simplifying the layout and making things
|
971
|
+
search to the class/method lists, simplifying the layout and making things
|
727
972
|
generally prettier. You should also notice that more tags are now visible in
|
728
973
|
the templates such as @todo, the new @abstract and @note tags and some others
|
729
974
|
that existed but were previously omitted from the generated documentation.
|
730
975
|
|
731
|
-
There is also a new templating engine (based on the tadpole templating library)
|
732
|
-
to allow for much more user customization. You can read about it in
|
976
|
+
There is also a new templating engine (based on the tadpole templating library)
|
977
|
+
to allow for much more user customization. You can read about it in
|
733
978
|
{file:docs/Templates.md}.
|
734
979
|
|
735
980
|
yardoc `--query` argument
|
@@ -742,7 +987,7 @@ adding "@api public" to each of your public API methods/classes and using
|
|
742
987
|
the following argument:
|
743
988
|
|
744
989
|
--query '@api.text == "public"'
|
745
|
-
|
990
|
+
|
746
991
|
More information on queries is in the {file:README.md}.
|
747
992
|
|
748
993
|
Greatly expanded API documentation
|
@@ -758,7 +1003,7 @@ New plugin support
|
|
758
1003
|
------------------
|
759
1004
|
|
760
1005
|
YARD now supports loading of plugins via RubyGems. Any gem named `yard-*` or
|
761
|
-
`yard_*` will now be loaded when YARD starts up. Note that the '-' separator
|
1006
|
+
`yard_*` will now be loaded when YARD starts up. Note that the '-' separator
|
762
1007
|
is the recommended naming scheme.
|
763
1008
|
|
764
1009
|
To ignore plugins, add the gem names to `~/.yard/ignored_plugins` on separate
|
@@ -777,14 +1022,14 @@ use this tag sparingly, as it is not meant to be an equivalent to RDoc's
|
|
777
1022
|
This tag exists so that you can create a query (`--query !@private`) to
|
778
1023
|
ignore all of these private objects in your documentation. You can also
|
779
1024
|
use the new `--no-private` switch, which is a shortcut to the afformentioned
|
780
|
-
query. You can read more about the new tags in the {file:docs/GettingStarted.md}
|
1025
|
+
query. You can read more about the new tags in the {file:docs/GettingStarted.md}
|
781
1026
|
guide.
|
782
1027
|
|
783
1028
|
Default rake task is now `rake yard`
|
784
1029
|
------------------------------------
|
785
1030
|
|
786
1031
|
Not a big change, but anyone using the default "rake yardoc" task should
|
787
|
-
update their scripts:
|
1032
|
+
update their scripts:
|
788
1033
|
|
789
1034
|
[http://github.com/lsegal/yard/commit/ad38a68dd73898b06bd5d0a1912b7d815878fae0](http://github.com/lsegal/yard/commit/ad38a68dd73898b06bd5d0a1912b7d815878fae0)
|
790
1035
|
|
@@ -801,21 +1046,21 @@ What's New in 0.2.3.x?
|
|
801
1046
|
Full Ruby 1.9 support
|
802
1047
|
---------------------
|
803
1048
|
|
804
|
-
YARD's development actually focuses primarily on 1.9 from the get-go, so it is
|
805
|
-
not an afterthought. All features are first implemented for compatibility with
|
1049
|
+
YARD's development actually focuses primarily on 1.9 from the get-go, so it is
|
1050
|
+
not an afterthought. All features are first implemented for compatibility with
|
806
1051
|
1.9, but of course all functionality is also tested in 1.8.x. YARD 0.2.2 was
|
807
1052
|
mostly compatible with 1.9, but the new release improves and extends in certain
|
808
1053
|
areas where compatibility was lacking. The new release should be fully functional
|
809
1054
|
in Ruby 1.9.
|
810
|
-
|
1055
|
+
|
811
1056
|
New parser code and handler API for 1.9
|
812
1057
|
---------------------------------------
|
813
1058
|
|
814
|
-
Using Ruby 1.9 also gives YARD the advantage of using the new `ripper` library
|
815
|
-
which was added to stdlib. The ripper parser is Ruby's official answer to
|
816
|
-
projects like ParseTree and ruby2ruby. Ripper allows access to the AST as it
|
817
|
-
is parsed by the Ruby compiler. This has some large benefits over alternative
|
818
|
-
projects:
|
1059
|
+
Using Ruby 1.9 also gives YARD the advantage of using the new `ripper` library
|
1060
|
+
which was added to stdlib. The ripper parser is Ruby's official answer to
|
1061
|
+
projects like ParseTree and ruby2ruby. Ripper allows access to the AST as it
|
1062
|
+
is parsed by the Ruby compiler. This has some large benefits over alternative
|
1063
|
+
projects:
|
819
1064
|
|
820
1065
|
1. It is officially supported and maintained by the Ruby core team.
|
821
1066
|
2. The AST is generated directly from the exact same code that drives the
|
@@ -823,7 +1068,7 @@ projects:
|
|
823
1068
|
equivalent AST.
|
824
1069
|
3. It needs no hacks, gems or extra libs and works out of the box in 1.9.
|
825
1070
|
4. It's *fast*.
|
826
|
-
|
1071
|
+
|
827
1072
|
Having the AST means that developers looking to extend YARD have much better
|
828
1073
|
access to the parsed code than in previous versions. The only caveat is that
|
829
1074
|
this library is not back-compatible to 1.8.x. Because of this, there are
|
@@ -834,11 +1079,11 @@ handlers that are compatible for both 1.8.x and 1.9 in one shot, or decide to
|
|
834
1079
|
implement the handler using both APIs. Realize that the benefit of using the new
|
835
1080
|
API means 1.9 users will get a 2.5x parsing speed increase over running the legacy
|
836
1081
|
handlers (this is *in addition to* the ~1.8x speed increase of using YARV over MRI).
|
837
|
-
|
1082
|
+
|
838
1083
|
A new `@overload` tag
|
839
1084
|
---------------------
|
840
1085
|
|
841
|
-
The new `@overload` tag enables users to document methods that take multiple
|
1086
|
+
The new `@overload` tag enables users to document methods that take multiple
|
842
1087
|
parameters depending on context. This is basically equivalent to RDoc's call-seq,
|
843
1088
|
but with a name that is more akin to the OOP concept of method overloading
|
844
1089
|
that is actually being employed. Here's an example:
|
@@ -854,7 +1099,7 @@ that is actually being employed. Here's an example:
|
|
854
1099
|
def to_html(*args)
|
855
1100
|
# split args depending on context
|
856
1101
|
end
|
857
|
-
|
1102
|
+
|
858
1103
|
As you can see each overload takes its own nested tags (including a docstring)
|
859
1104
|
as if it were its own method. This allows "virtual" overloading behaviour at
|
860
1105
|
the API level to make Ruby look like overload-aware languages without caring
|