yard 0.2.2 → 0.2.3
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.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- data/LICENSE +1 -1
- data/README.markdown +200 -0
- data/Rakefile +6 -1
- data/benchmarks/format_args.rb +46 -0
- data/benchmarks/parsing.rb +13 -1
- data/benchmarks/rdoc_vs_yardoc.rb +10 -0
- data/benchmarks/ripper_parser.rb +12 -0
- data/docs/CODE_OBJECTS.markdown +121 -0
- data/docs/FAQ.markdown +34 -0
- data/docs/GENERATORS.markdown +211 -0
- data/docs/GETTING_STARTED.markdown +263 -0
- data/docs/GLOSSARY.markdown +13 -0
- data/docs/HANDLERS.markdown +158 -0
- data/docs/OVERVIEW.markdown +64 -0
- data/docs/PARSER.markdown +180 -0
- data/docs/TAGS.markdown +181 -0
- data/docs/WHATSNEW.markdown +96 -0
- data/docs/images/code-objects-class-diagram.png +0 -0
- data/docs/images/handlers-class-diagram.png +0 -0
- data/docs/images/overview-class-diagram.png +0 -0
- data/docs/images/parser-class-diagram.png +0 -0
- data/docs/images/tags-class-diagram.png +0 -0
- data/lib/yard.rb +4 -1
- data/lib/yard/autoload.rb +79 -31
- data/lib/yard/cli/yard_graph.rb +8 -2
- data/lib/yard/cli/yardoc.rb +61 -8
- data/lib/yard/code_objects/base.rb +78 -135
- data/lib/yard/code_objects/class_object.rb +9 -8
- data/lib/yard/code_objects/constant_object.rb +1 -0
- data/lib/yard/code_objects/extended_method_object.rb +9 -0
- data/lib/yard/code_objects/method_object.rb +18 -5
- data/lib/yard/code_objects/module_object.rb +8 -1
- data/lib/yard/code_objects/namespace_object.rb +25 -16
- data/lib/yard/code_objects/proxy.rb +22 -22
- data/lib/yard/core_ext/file.rb +1 -1
- data/lib/yard/core_ext/string.rb +0 -4
- data/lib/yard/core_ext/symbol_hash.rb +3 -2
- data/lib/yard/docstring.rb +180 -0
- data/lib/yard/generators/base.rb +33 -13
- data/lib/yard/generators/class_generator.rb +4 -2
- data/lib/yard/generators/constants_generator.rb +3 -2
- data/lib/yard/generators/full_doc_generator.rb +76 -9
- data/lib/yard/generators/helpers/base_helper.rb +18 -1
- data/lib/yard/generators/helpers/filter_helper.rb +2 -2
- data/lib/yard/generators/helpers/html_helper.rb +94 -39
- data/lib/yard/generators/helpers/html_syntax_highlight_helper.rb +49 -0
- data/lib/yard/generators/helpers/markup_helper.rb +86 -0
- data/lib/yard/generators/helpers/method_helper.rb +23 -7
- data/lib/yard/generators/method_generator.rb +15 -3
- data/lib/yard/generators/method_listing_generator.rb +3 -3
- data/lib/yard/generators/mixins_generator.rb +8 -2
- data/lib/yard/generators/module_generator.rb +3 -2
- data/lib/yard/generators/overloads_generator.rb +20 -0
- data/lib/yard/generators/quick_doc_generator.rb +3 -9
- data/lib/yard/generators/root_generator.rb +32 -0
- data/lib/yard/generators/source_generator.rb +2 -17
- data/lib/yard/generators/tags_generator.rb +34 -6
- data/lib/yard/generators/uml_generator.rb +16 -6
- data/lib/yard/handlers/base.rb +88 -253
- data/lib/yard/handlers/processor.rb +72 -0
- data/lib/yard/handlers/ruby/alias_handler.rb +38 -0
- data/lib/yard/handlers/ruby/attribute_handler.rb +69 -0
- data/lib/yard/handlers/ruby/base.rb +72 -0
- data/lib/yard/handlers/ruby/class_condition_handler.rb +70 -0
- data/lib/yard/handlers/ruby/class_handler.rb +74 -0
- data/lib/yard/handlers/ruby/class_variable_handler.rb +11 -0
- data/lib/yard/handlers/ruby/constant_handler.rb +12 -0
- data/lib/yard/handlers/ruby/exception_handler.rb +22 -0
- data/lib/yard/handlers/ruby/extend_handler.rb +19 -0
- data/lib/yard/handlers/{alias_handler.rb → ruby/legacy/alias_handler.rb} +3 -4
- data/lib/yard/handlers/{attribute_handler.rb → ruby/legacy/attribute_handler.rb} +2 -2
- data/lib/yard/handlers/ruby/legacy/base.rb +198 -0
- data/lib/yard/handlers/{class_handler.rb → ruby/legacy/class_handler.rb} +18 -6
- data/lib/yard/handlers/{class_variable_handler.rb → ruby/legacy/class_variable_handler.rb} +1 -1
- data/lib/yard/handlers/{constant_handler.rb → ruby/legacy/constant_handler.rb} +2 -2
- data/lib/yard/handlers/{exception_handler.rb → ruby/legacy/exception_handler.rb} +3 -3
- data/lib/yard/handlers/ruby/legacy/extend_handler.rb +18 -0
- data/lib/yard/handlers/ruby/legacy/method_handler.rb +31 -0
- data/lib/yard/handlers/ruby/legacy/mixin_handler.rb +28 -0
- data/lib/yard/handlers/{module_handler.rb → ruby/legacy/module_handler.rb} +1 -1
- data/lib/yard/handlers/{visibility_handler.rb → ruby/legacy/visibility_handler.rb} +1 -1
- data/lib/yard/handlers/{yield_handler.rb → ruby/legacy/yield_handler.rb} +4 -4
- data/lib/yard/handlers/ruby/method_condition_handler.rb +7 -0
- data/lib/yard/handlers/ruby/method_handler.rb +48 -0
- data/lib/yard/handlers/ruby/mixin_handler.rb +25 -0
- data/lib/yard/handlers/ruby/module_handler.rb +9 -0
- data/lib/yard/handlers/ruby/visibility_handler.rb +18 -0
- data/lib/yard/handlers/ruby/yield_handler.rb +28 -0
- data/lib/yard/parser/ruby/ast_node.rb +263 -0
- data/lib/yard/parser/{ruby_lex.rb → ruby/legacy/ruby_lex.rb} +258 -259
- data/lib/yard/parser/{statement.rb → ruby/legacy/statement.rb} +8 -4
- data/lib/yard/parser/ruby/legacy/statement_list.rb +262 -0
- data/lib/yard/parser/{token_list.rb → ruby/legacy/token_list.rb} +1 -1
- data/lib/yard/parser/ruby/ruby_parser.rb +307 -0
- data/lib/yard/parser/source_parser.rb +76 -45
- data/lib/yard/rake/yardoc_task.rb +6 -1
- data/lib/yard/registry.rb +45 -19
- data/lib/yard/serializers/file_system_serializer.rb +8 -3
- data/lib/yard/tags/default_factory.rb +70 -10
- data/lib/yard/tags/default_tag.rb +12 -0
- data/lib/yard/tags/library.rb +65 -26
- data/lib/yard/tags/option_tag.rb +12 -0
- data/lib/yard/tags/overload_tag.rb +62 -0
- data/lib/yard/tags/ref_tag.rb +7 -0
- data/lib/yard/tags/ref_tag_list.rb +27 -0
- data/lib/yard/tags/tag.rb +1 -0
- data/lib/yard/tags/tag_format_error.rb +6 -0
- data/spec/cli/yardoc_spec.rb +43 -0
- data/spec/code_objects/base_spec.rb +56 -68
- data/spec/code_objects/class_object_spec.rb +18 -6
- data/spec/code_objects/constants_spec.rb +2 -0
- data/spec/code_objects/method_object_spec.rb +33 -5
- data/spec/code_objects/module_object_spec.rb +66 -8
- data/spec/code_objects/namespace_object_spec.rb +37 -17
- data/spec/code_objects/proxy_spec.rb +13 -2
- data/spec/core_ext/string_spec.rb +14 -2
- data/spec/core_ext/symbol_hash_spec.rb +9 -3
- data/spec/docstring_spec.rb +139 -0
- data/spec/generators/full_doc_generator_spec.rb +29 -0
- data/spec/generators/helpers/html_helper_spec.rb +74 -0
- data/spec/generators/helpers/markup_helper_spec.rb +95 -0
- data/spec/handlers/alias_handler_spec.rb +16 -3
- data/spec/handlers/attribute_handler_spec.rb +1 -1
- data/spec/handlers/base_spec.rb +15 -141
- data/spec/handlers/class_condition_handler_spec.rb +49 -0
- data/spec/handlers/class_handler_spec.rb +44 -3
- data/spec/handlers/class_variable_handler_spec.rb +1 -1
- data/spec/handlers/constant_handler_spec.rb +1 -1
- data/spec/handlers/examples/alias_handler_001.rb.txt +7 -3
- data/spec/handlers/examples/class_condition_handler_001.rb.txt +61 -0
- data/spec/handlers/examples/class_handler_001.rb.txt +33 -0
- data/spec/handlers/examples/exception_handler_001.rb.txt +1 -1
- data/spec/handlers/examples/extend_handler_001.rb.txt +8 -0
- data/spec/handlers/examples/method_condition_handler_001.rb.txt +10 -0
- data/spec/handlers/examples/method_handler_001.rb.txt +16 -4
- data/spec/handlers/examples/mixin_handler_001.rb.txt +10 -2
- data/spec/handlers/examples/module_handler_001.rb.txt +4 -0
- data/spec/handlers/examples/visibility_handler_001.rb.txt +1 -1
- data/spec/handlers/exception_handler_spec.rb +2 -2
- data/spec/handlers/extend_handler_spec.rb +15 -0
- data/spec/handlers/legacy_base_spec.rb +128 -0
- data/spec/handlers/method_condition_handler_spec.rb +14 -0
- data/spec/handlers/method_handler_spec.rb +38 -5
- data/spec/handlers/mixin_handler_spec.rb +15 -7
- data/spec/handlers/module_handler_spec.rb +5 -1
- data/spec/handlers/processor_spec.rb +19 -0
- data/spec/handlers/ruby/base_spec.rb +90 -0
- data/spec/handlers/ruby/legacy/base_spec.rb +53 -0
- data/spec/handlers/spec_helper.rb +22 -16
- data/spec/handlers/visibility_handler_spec.rb +4 -4
- data/spec/handlers/yield_handler_spec.rb +1 -1
- data/spec/parser/ruby/ast_node_spec.rb +15 -0
- data/spec/parser/ruby/legacy/statement_list_spec.rb +145 -0
- data/spec/parser/{token_list_spec.rb → ruby/legacy/token_list_spec.rb} +4 -4
- data/spec/parser/source_parser_spec.rb +0 -15
- data/spec/rake/yardoc_task_spec.rb +48 -0
- data/spec/registry_spec.rb +28 -2
- data/spec/serializers/file_system_serializer_spec.rb +7 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/tags/default_factory_spec.rb +135 -0
- data/spec/tags/default_tag_spec.rb +11 -0
- data/spec/tags/overload_tag_spec.rb +35 -0
- data/spec/tags/ref_tag_list_spec.rb +53 -0
- data/templates/default/attributes/html/header.erb +17 -5
- data/templates/default/attributes/text/header.erb +1 -1
- data/templates/default/fulldoc/html/all_files.erb +19 -0
- data/templates/default/fulldoc/html/all_methods.erb +8 -7
- data/templates/default/fulldoc/html/all_namespaces.erb +4 -1
- data/templates/default/fulldoc/html/app.js +1 -1
- data/templates/default/fulldoc/html/{readme.erb → file.erb} +2 -2
- data/templates/default/fulldoc/html/header.erb +1 -1
- data/templates/default/fulldoc/html/index.erb +4 -3
- data/templates/default/fulldoc/html/style.css +13 -3
- data/templates/default/fulldoc/html/syntax_highlight.css +8 -5
- data/templates/default/method/text/header.erb +1 -0
- data/templates/default/method/text/title.erb +1 -0
- data/templates/default/methodsignature/html/main.erb +10 -8
- data/templates/default/methodsignature/text/main.erb +4 -1
- data/templates/default/methodsummary/html/summary.erb +8 -4
- data/templates/default/methodsummary/text/summary.erb +4 -1
- data/templates/default/mixins/html/header.erb +3 -3
- data/templates/default/overloads/html/header.erb +8 -0
- data/templates/default/overloads/text/header.erb +8 -0
- data/templates/default/root/html/header.erb +4 -0
- data/templates/default/tags/html/example.erb +20 -0
- data/templates/default/tags/html/option.erb +27 -0
- data/templates/default/tags/html/param.erb +21 -0
- data/templates/default/tags/html/tags.erb +4 -1
- data/templates/default/tags/html/todo.erb +8 -0
- data/templates/default/tags/text/example.erb +14 -0
- data/templates/default/tags/text/header.erb +3 -3
- data/templates/default/tags/text/option.erb +5 -0
- data/templates/default/tags/text/param.erb +9 -0
- data/templates/default/uml/dot/dependencies.erb +1 -1
- data/templates/default/uml/dot/info.erb +1 -1
- data/templates/default/uml/dot/superclasses.erb +2 -2
- data/templates/javadoc/methodsummary/html/summary.erb +2 -2
- data/templates/javadoc/mixins/html/header.erb +3 -3
- metadata +108 -139
- data/README +0 -211
- data/lib/yard/handlers/method_handler.rb +0 -27
- data/lib/yard/handlers/mixin_handler.rb +0 -16
- data/lib/yard/parser/statement_list.rb +0 -167
- data/lib/yard/tags/merbdoc_factory.rb +0 -47
@@ -0,0 +1,96 @@
|
|
1
|
+
YARD: What's New in 0.2.3?
|
2
|
+
==========================
|
3
|
+
|
4
|
+
1. **Full Ruby 1.9 support**
|
5
|
+
2. **New parser code and handler API for 1.9**
|
6
|
+
3. **A new `@overload` tag**
|
7
|
+
4. **Better documentation**
|
8
|
+
5. **Template changes and bug fixes**
|
9
|
+
|
10
|
+
Full Ruby 1.9 support
|
11
|
+
---------------------
|
12
|
+
|
13
|
+
YARD's development actually focuses primarily on 1.9 from the get-go, so it is
|
14
|
+
not an afterthought. All features are first implemented for compatibility with
|
15
|
+
1.9, but of course all functionality is also tested in 1.8.x. YARD 0.2.2 was
|
16
|
+
mostly compatible with 1.9, but the new release improves and extends in certain
|
17
|
+
areas where compatibility was lacking. The new release should be fully functional
|
18
|
+
in Ruby 1.9.
|
19
|
+
|
20
|
+
New parser code and handler API for 1.9
|
21
|
+
---------------------------------------
|
22
|
+
|
23
|
+
Using Ruby 1.9 also gives YARD the advantage of using the new `ripper` library
|
24
|
+
which was added to stdlib. The ripper parser is Ruby's official answer to
|
25
|
+
projects like ParseTree and ruby2ruby. Ripper allows access to the AST as it
|
26
|
+
is parsed by the Ruby compiler. This has some large benefits over alternative
|
27
|
+
projects:
|
28
|
+
|
29
|
+
1. It is officially supported and maintained by the Ruby core team.
|
30
|
+
2. The AST is generated directly from the exact same code that drives the
|
31
|
+
compiler, meaning anything that compiles is guaranteed to generate the
|
32
|
+
equivalent AST.
|
33
|
+
3. It needs no hacks, gems or extra libs and works out of the box in 1.9.
|
34
|
+
4. It's *fast*.
|
35
|
+
|
36
|
+
Having the AST means that developers looking to extend YARD have much better
|
37
|
+
access to the parsed code than in previous versions. The only caveat is that
|
38
|
+
this library is not back-compatible to 1.8.x. Because of this, there are
|
39
|
+
subtle changes to the handler extension API that developers use to extend YARD.
|
40
|
+
Namely, there is now a standard API for 1.9 and a "legacy" API that can run in
|
41
|
+
both 1.8.x and 1.9 if needed. A developer can still use the legacy API to write
|
42
|
+
handlers that are compatible for both 1.8.x and 1.9 in one shot, or decide to
|
43
|
+
implement the handler using both APIs. Realize that the benefit of using the new
|
44
|
+
API means 1.9 users will get a 2.5x parsing speed increase over running the legacy
|
45
|
+
handlers (this is *in addition to* the ~1.8x speed increase of using YARV over MRI).
|
46
|
+
|
47
|
+
A new `@overload` tag
|
48
|
+
---------------------
|
49
|
+
|
50
|
+
The new `@overload` tag enables users to document methods that take multiple
|
51
|
+
parameters depending on context. This is basically equivalent to RDoc's call-seq,
|
52
|
+
but with a name that is more akin to the OOP concept of method overloading
|
53
|
+
that is actually being employed. Here's an example:
|
54
|
+
|
55
|
+
# @overload def to_html(html, autolink = true)
|
56
|
+
# This docstring describes the specific overload only.
|
57
|
+
# @param [String] html the HTML
|
58
|
+
# @param [Boolean] autolink whether or not to atuomatically link
|
59
|
+
# URL references
|
60
|
+
# @overload def to_html(html, opts = {})
|
61
|
+
# @param [String] html the HTML
|
62
|
+
# @param [Hash] opts any attributes to add to the root HTML node
|
63
|
+
def to_html(*args)
|
64
|
+
# split args depending on context
|
65
|
+
end
|
66
|
+
|
67
|
+
As you can see each overload takes its own nested tags (including a docstring)
|
68
|
+
as if it were its own method. This allows "virtual" overloading behaviour at
|
69
|
+
the API level to make Ruby look like overload-aware languages without caring
|
70
|
+
about the implementation details required to add the behaviour.
|
71
|
+
|
72
|
+
It is still recommended practice, however, to stay away from overloading when
|
73
|
+
possible and document the types of each method's real parameters. This allows
|
74
|
+
toolkits making use of YARD to get accurate type information for your methods,
|
75
|
+
for instance, allowing IDE autocompletion. There are, of course, situations
|
76
|
+
where overload just makes more sense.
|
77
|
+
|
78
|
+
Better documentation
|
79
|
+
--------------------
|
80
|
+
|
81
|
+
The first few iterations of YARD were very much a proof of concept. Few people
|
82
|
+
were paying attention and it was really just pieced together to see what was
|
83
|
+
feasible. Now that YARD is gaining interest, there are many developers that
|
84
|
+
want to take advantage of its extensibility support to do some really cool stuff.
|
85
|
+
Considerable time was spent for this release documenting, at a high level, what
|
86
|
+
YARD can do and how it can be done. Expect this documentation to be extended and
|
87
|
+
improved in future releases.
|
88
|
+
|
89
|
+
Template changes and bug fixes
|
90
|
+
------------------------------
|
91
|
+
|
92
|
+
Of course no new release would be complete without fixing the old broken code.
|
93
|
+
Some tags existed but were not present in generated documentation. The templates
|
94
|
+
were mostly fixed to add the major omitted tags. In addition to template adjustments,
|
95
|
+
many parsing bugs were ironed out to make YARD much more stable with existing projects
|
96
|
+
(Rails, HAML, Sinatra, Ramaze, etc.).
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/yard.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
module YARD
|
2
|
-
VERSION = "0.2.
|
2
|
+
VERSION = "0.2.3"
|
3
3
|
ROOT = File.dirname(__FILE__)
|
4
4
|
TEMPLATE_ROOT = File.join(File.dirname(__FILE__), '..', 'templates')
|
5
5
|
|
6
6
|
def self.parse(*args) Parser::SourceParser.parse(*args) end
|
7
7
|
end
|
8
8
|
|
9
|
+
# Keep track of Ruby version for compatibility code
|
10
|
+
RUBY19, RUBY18 = *(RUBY_VERSION >= "1.9" ? [true, false] : [false, true])
|
11
|
+
|
9
12
|
$:.unshift(YARD::ROOT)
|
10
13
|
|
11
14
|
files = ['yard/logging', 'yard/autoload']
|
data/lib/yard/autoload.rb
CHANGED
@@ -10,6 +10,7 @@ module YARD
|
|
10
10
|
autoload :ClassObject, 'yard/code_objects/class_object'
|
11
11
|
autoload :ClassVariableObject, 'yard/code_objects/class_variable_object'
|
12
12
|
autoload :ConstantObject, 'yard/code_objects/constant_object'
|
13
|
+
autoload :ExtendedMethodObject, 'yard/code_objects/extended_method_object'
|
13
14
|
autoload :MethodObject, 'yard/code_objects/method_object'
|
14
15
|
autoload :ModuleObject, 'yard/code_objects/module_object'
|
15
16
|
autoload :NamespaceObject, 'yard/code_objects/namespace_object'
|
@@ -22,20 +23,26 @@ module YARD
|
|
22
23
|
autoload :BUILTIN_MODULES, 'yard/code_objects/base'
|
23
24
|
autoload :BUILTIN_EXCEPTIONS, 'yard/code_objects/base'
|
24
25
|
autoload :CONSTANTMATCH, 'yard/code_objects/base'
|
25
|
-
autoload :ISEP, 'yard/code_objects/base'
|
26
26
|
autoload :METHODMATCH, 'yard/code_objects/base'
|
27
27
|
autoload :METHODNAMEMATCH, 'yard/code_objects/base'
|
28
28
|
autoload :NAMESPACEMATCH, 'yard/code_objects/base'
|
29
29
|
autoload :NSEP, 'yard/code_objects/base'
|
30
|
+
autoload :NSEPQ, 'yard/code_objects/base'
|
31
|
+
autoload :ISEP, 'yard/code_objects/base'
|
32
|
+
autoload :ISEPQ, 'yard/code_objects/base'
|
33
|
+
autoload :CSEP, 'yard/code_objects/base'
|
34
|
+
autoload :CSEPQ, 'yard/code_objects/base'
|
30
35
|
end
|
31
36
|
|
32
37
|
module Generators
|
33
38
|
module Helpers
|
34
|
-
autoload :BaseHelper,
|
35
|
-
autoload :FilterHelper,
|
36
|
-
autoload :HtmlHelper,
|
37
|
-
autoload :
|
38
|
-
autoload :
|
39
|
+
autoload :BaseHelper, 'yard/generators/helpers/base_helper'
|
40
|
+
autoload :FilterHelper, 'yard/generators/helpers/filter_helper'
|
41
|
+
autoload :HtmlHelper, 'yard/generators/helpers/html_helper'
|
42
|
+
autoload :HtmlSyntaxHighlightHelper, 'yard/generators/helpers/html_syntax_highlight_helper'
|
43
|
+
autoload :MarkupHelper, 'yard/generators/helpers/markup_helper'
|
44
|
+
autoload :MethodHelper, 'yard/generators/helpers/method_helper'
|
45
|
+
autoload :UMLHelper, 'yard/generators/helpers/uml_helper'
|
39
46
|
end
|
40
47
|
|
41
48
|
autoload :AttributesGenerator, 'yard/generators/attributes_generator'
|
@@ -56,37 +63,74 @@ module YARD
|
|
56
63
|
autoload :MixinsGenerator, 'yard/generators/mixins_generator'
|
57
64
|
autoload :ModuleGenerator, 'yard/generators/module_generator'
|
58
65
|
autoload :QuickDocGenerator, 'yard/generators/quick_doc_generator'
|
66
|
+
autoload :RootGenerator, 'yard/generators/root_generator'
|
59
67
|
autoload :SourceGenerator, 'yard/generators/source_generator'
|
60
68
|
autoload :TagsGenerator, 'yard/generators/tags_generator'
|
61
69
|
autoload :UMLGenerator, 'yard/generators/uml_generator'
|
62
70
|
autoload :VisibilityGroupGenerator, 'yard/generators/visibility_group_generator'
|
71
|
+
autoload :OverloadsGenerator, 'yard/generators/overloads_generator'
|
63
72
|
end
|
64
73
|
|
65
74
|
module Handlers
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
module Ruby
|
76
|
+
module Legacy
|
77
|
+
autoload :Base, 'yard/handlers/ruby/legacy/base'
|
78
|
+
|
79
|
+
autoload :AliasHandler, 'yard/handlers/ruby/legacy/alias_handler'
|
80
|
+
autoload :AttributeHandler, 'yard/handlers/ruby/legacy/attribute_handler'
|
81
|
+
autoload :ClassHandler, 'yard/handlers/ruby/legacy/class_handler'
|
82
|
+
autoload :ClassVariableHandler, 'yard/handlers/ruby/legacy/class_variable_handler'
|
83
|
+
autoload :ConstantHandler, 'yard/handlers/ruby/legacy/constant_handler'
|
84
|
+
autoload :ExceptionHandler, 'yard/handlers/ruby/legacy/exception_handler'
|
85
|
+
autoload :ExtendHandler, 'yard/handlers/ruby/legacy/extend_handler'
|
86
|
+
autoload :MethodHandler, 'yard/handlers/ruby/legacy/method_handler'
|
87
|
+
autoload :MixinHandler, 'yard/handlers/ruby/legacy/mixin_handler'
|
88
|
+
autoload :ModuleHandler, 'yard/handlers/ruby/legacy/module_handler'
|
89
|
+
autoload :VisibilityHandler, 'yard/handlers/ruby/legacy/visibility_handler'
|
90
|
+
autoload :YieldHandler, 'yard/handlers/ruby/legacy/yield_handler'
|
91
|
+
end
|
92
|
+
|
93
|
+
autoload :Base, 'yard/handlers/ruby/base'
|
94
|
+
|
95
|
+
autoload :AliasHandler, 'yard/handlers/ruby/alias_handler'
|
96
|
+
autoload :AttributeHandler, 'yard/handlers/ruby/attribute_handler'
|
97
|
+
autoload :ClassHandler, 'yard/handlers/ruby/class_handler'
|
98
|
+
autoload :ClassConditionHandler, 'yard/handlers/ruby/class_condition_handler'
|
99
|
+
autoload :ClassVariableHandler, 'yard/handlers/ruby/class_variable_handler'
|
100
|
+
autoload :ConstantHandler, 'yard/handlers/ruby/constant_handler'
|
101
|
+
autoload :ExceptionHandler, 'yard/handlers/ruby/exception_handler'
|
102
|
+
autoload :ExtendHandler, 'yard/handlers/ruby/extend_handler'
|
103
|
+
autoload :MethodHandler, 'yard/handlers/ruby/method_handler'
|
104
|
+
autoload :MethodConditionHandler, 'yard/handlers/ruby/method_condition_handler'
|
105
|
+
autoload :MixinHandler, 'yard/handlers/ruby/mixin_handler'
|
106
|
+
autoload :ModuleHandler, 'yard/handlers/ruby/module_handler'
|
107
|
+
autoload :VisibilityHandler, 'yard/handlers/ruby/visibility_handler'
|
108
|
+
autoload :YieldHandler, 'yard/handlers/ruby/yield_handler'
|
109
|
+
end
|
110
|
+
|
111
|
+
autoload :Base, 'yard/handlers/base'
|
112
|
+
autoload :Processor, 'yard/handlers/processor'
|
79
113
|
end
|
80
114
|
|
81
115
|
module Parser
|
82
|
-
module
|
83
|
-
|
116
|
+
module Ruby
|
117
|
+
module Legacy
|
118
|
+
autoload :Statement, 'yard/parser/ruby/legacy/statement'
|
119
|
+
autoload :StatementList, 'yard/parser/ruby/legacy/statement_list'
|
120
|
+
autoload :TokenList, 'yard/parser/ruby/legacy/token_list'
|
121
|
+
|
122
|
+
module RubyToken
|
123
|
+
require 'yard/parser/ruby/legacy/ruby_lex' # Too much to include manually
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
autoload :AstNode, 'yard/parser/ruby/ast_node'
|
128
|
+
autoload :ParserSyntaxError, 'yard/parser/ruby/ruby_parser'
|
129
|
+
autoload :RubyParser, 'yard/parser/ruby/ruby_parser'
|
84
130
|
end
|
85
|
-
|
86
|
-
autoload :SourceParser,
|
87
|
-
autoload :
|
88
|
-
autoload :StatementList, 'yard/parser/statement_list'
|
89
|
-
autoload :TokenList, 'yard/parser/token_list'
|
131
|
+
|
132
|
+
autoload :SourceParser, 'yard/parser/source_parser'
|
133
|
+
autoload :UndocumentableError, 'yard/parser/source_parser'
|
90
134
|
end
|
91
135
|
|
92
136
|
module Rake
|
@@ -102,15 +146,19 @@ module YARD
|
|
102
146
|
|
103
147
|
module Tags
|
104
148
|
autoload :DefaultFactory, 'yard/tags/default_factory'
|
149
|
+
autoload :DefaultTag, 'yard/tags/default_tag'
|
105
150
|
autoload :Library, 'yard/tags/library'
|
151
|
+
autoload :OptionTag, 'yard/tags/option_tag'
|
152
|
+
autoload :OverloadTag, 'yard/tags/overload_tag'
|
153
|
+
autoload :RefTag, 'yard/tags/ref_tag'
|
154
|
+
autoload :RefTagList, 'yard/tags/ref_tag_list'
|
106
155
|
autoload :Tag, 'yard/tags/tag'
|
156
|
+
autoload :TagFormatError, 'yard/tags/tag_format_error'
|
107
157
|
end
|
108
158
|
|
109
|
-
autoload :
|
159
|
+
autoload :Docstring, 'yard/docstring'
|
160
|
+
autoload :Registry, 'yard/registry'
|
110
161
|
end
|
111
162
|
|
112
|
-
# Load handlers immediately
|
113
|
-
YARD::Handlers.constants.each {|c| YARD::Handlers.const_get(c) }
|
114
|
-
|
115
163
|
# P() needs to be loaded right away
|
116
|
-
YARD::CodeObjects::Proxy
|
164
|
+
YARD::CodeObjects::Proxy
|
data/lib/yard/cli/yard_graph.rb
CHANGED
@@ -4,6 +4,7 @@ module YARD
|
|
4
4
|
module CLI
|
5
5
|
class YardGraph
|
6
6
|
attr_reader :options, :visibilities
|
7
|
+
attr_reader :objects
|
7
8
|
|
8
9
|
def self.run(*args) new.run(*args) end
|
9
10
|
|
@@ -17,9 +18,9 @@ module YARD
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def run(*args)
|
20
|
-
optparse(*args)
|
21
21
|
Registry.load
|
22
|
-
|
22
|
+
optparse(*args)
|
23
|
+
Generators::UMLGenerator.new(options).generate(*objects)
|
23
24
|
end
|
24
25
|
|
25
26
|
private
|
@@ -75,6 +76,11 @@ module YARD
|
|
75
76
|
|
76
77
|
begin
|
77
78
|
opts.parse!(args)
|
79
|
+
if args.first
|
80
|
+
@objects = args.map {|o| Registry.at(o) }.compact
|
81
|
+
else
|
82
|
+
@objects = [Registry.root]
|
83
|
+
end
|
78
84
|
rescue => e
|
79
85
|
STDERR.puts e.message
|
80
86
|
STDERR << "\n" << opts
|
data/lib/yard/cli/yardoc.rb
CHANGED
@@ -3,8 +3,11 @@ require 'optparse'
|
|
3
3
|
module YARD
|
4
4
|
module CLI
|
5
5
|
class Yardoc
|
6
|
+
DEFAULT_YARDOPTS_FILE = ".yardopts"
|
7
|
+
|
6
8
|
attr_reader :options, :visibilities
|
7
9
|
attr_accessor :files, :reload, :generate
|
10
|
+
attr_accessor :options_file
|
8
11
|
|
9
12
|
def self.run(*args) new.run(*args) end
|
10
13
|
|
@@ -13,7 +16,6 @@ module YARD
|
|
13
16
|
:format => :html,
|
14
17
|
:template => :default,
|
15
18
|
:serializer => YARD::Serializers::FileSystemSerializer.new,
|
16
|
-
:readme => ['README', 'README.txt'],
|
17
19
|
:verifier => lambda do |gen, obj|
|
18
20
|
return false if gen.respond_to?(:visibility) && !visibilities.include?(gen.visibility)
|
19
21
|
end
|
@@ -22,19 +24,38 @@ module YARD
|
|
22
24
|
@reload = true
|
23
25
|
@generate = true
|
24
26
|
@files = ['lib/**/*.rb']
|
27
|
+
@options_file = DEFAULT_YARDOPTS_FILE
|
25
28
|
end
|
26
29
|
|
27
30
|
def run(*args)
|
31
|
+
args += support_rdoc_document_file!
|
32
|
+
optparse(*yardopts)
|
28
33
|
optparse(*args)
|
29
34
|
Registry.load(files, reload)
|
30
35
|
|
31
36
|
if generate
|
32
|
-
Generators::FullDocGenerator.new(options).generate
|
37
|
+
Generators::FullDocGenerator.new(options).generate(all_objects)
|
33
38
|
end
|
34
39
|
end
|
40
|
+
|
41
|
+
def all_objects
|
42
|
+
Registry.all(:root, :module, :class)
|
43
|
+
end
|
44
|
+
|
45
|
+
def yardopts
|
46
|
+
IO.read(options_file).split(/\s+/)
|
47
|
+
rescue Errno::ENOENT
|
48
|
+
[]
|
49
|
+
end
|
35
50
|
|
36
51
|
private
|
37
52
|
|
53
|
+
def support_rdoc_document_file!
|
54
|
+
IO.read(".document").split(/\s+/)
|
55
|
+
rescue Errno::ENOENT
|
56
|
+
[]
|
57
|
+
end
|
58
|
+
|
38
59
|
def optparse(*args)
|
39
60
|
serialopts = SymbolHash.new
|
40
61
|
|
@@ -43,6 +64,10 @@ module YARD
|
|
43
64
|
|
44
65
|
opts.separator "(if a list of source files is omitted, lib/**/*.rb is used.)"
|
45
66
|
opts.separator ""
|
67
|
+
opts.separator "A base set of options can be specified by adding a .yardopts"
|
68
|
+
opts.separator "file to your base path containing all extra options separated"
|
69
|
+
opts.separator "by whitespace."
|
70
|
+
opts.separator ""
|
46
71
|
opts.separator "General Options:"
|
47
72
|
|
48
73
|
opts.on('-c', '--use-cache [FILE]',
|
@@ -65,6 +90,10 @@ module YARD
|
|
65
90
|
exit
|
66
91
|
end
|
67
92
|
end
|
93
|
+
|
94
|
+
opts.on('--legacy', 'Use old style parser and handlers. Unavailable under Ruby 1.8.x') do
|
95
|
+
YARD::Parser::SourceParser.parser_type = :ruby18
|
96
|
+
end
|
68
97
|
|
69
98
|
opts.separator ""
|
70
99
|
opts.separator "Output options:"
|
@@ -80,13 +109,37 @@ module YARD
|
|
80
109
|
opts.on('--private', "Show or don't show private methods. (default hides private)") do
|
81
110
|
visibilities.push(:private)
|
82
111
|
end
|
83
|
-
|
112
|
+
|
113
|
+
opts.on('--no-highlight', "Don't highlight code in docs as Ruby.") do
|
114
|
+
options[:no_highlight] = true
|
115
|
+
end
|
116
|
+
|
84
117
|
opts.on('-r', '--readme FILE', 'The readme file used as the title page of documentation.') do |readme|
|
118
|
+
raise Errno::ENOENT, readme unless File.file?(readme)
|
85
119
|
options[:readme] = readme
|
86
120
|
end
|
87
121
|
|
88
|
-
opts.on('
|
122
|
+
opts.on('--files FILE1,FILE2,...', 'Any extra comma separated static files to be included (eg. FAQ)') do |files|
|
123
|
+
options[:files] = []
|
124
|
+
files.split(",").each do |file|
|
125
|
+
raise Errno::ENOENT, file unless File.file?(file)
|
126
|
+
options[:files] << file
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
opts.on('-m', '--markup MARKUP',
|
131
|
+
'Markup style used in documentation, like textile, markdown or rdoc. (defaults to rdoc)') do |markup|
|
132
|
+
options[:markup] = markup.to_sym
|
133
|
+
end
|
134
|
+
|
135
|
+
opts.on('-M', '--markup-provider MARKUP_PROVIDER',
|
136
|
+
'Overrides the library used to process markup formatting (specify the gem name)') do |markup_provider|
|
137
|
+
options[:markup_provider] = markup_provider.to_sym
|
138
|
+
end
|
139
|
+
|
140
|
+
opts.on('-o', '--output-dir PATH',
|
89
141
|
'The output directory. (defaults to ./doc)') do |dir|
|
142
|
+
options[:serializer] = nil
|
90
143
|
serialopts[:basepath] = dir
|
91
144
|
end
|
92
145
|
|
@@ -97,7 +150,7 @@ module YARD
|
|
97
150
|
|
98
151
|
opts.on('-p', '--template-path PATH',
|
99
152
|
'The template path to look for templates in. (used with -t).') do |path|
|
100
|
-
YARD::
|
153
|
+
YARD::Generators::Base.register_template_path(path)
|
101
154
|
end
|
102
155
|
|
103
156
|
opts.on('-f', '--format FORMAT',
|
@@ -123,9 +176,9 @@ module YARD
|
|
123
176
|
# Last minute modifications
|
124
177
|
self.files = args unless args.empty?
|
125
178
|
self.reload = false if self.files.empty?
|
126
|
-
visibilities.uniq!
|
127
|
-
options[:serializer]
|
179
|
+
self.visibilities.uniq!
|
180
|
+
options[:serializer] ||= Serializers::FileSystemSerializer.new(serialopts)
|
128
181
|
end
|
129
182
|
end
|
130
183
|
end
|
131
|
-
end
|
184
|
+
end
|