yard 0.2.3.5 → 0.4.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 +12 -10
- data/ChangeLog +5686 -0
- data/{README.markdown → README.md} +65 -11
- data/Rakefile +25 -13
- data/benchmarks/concat_vs_join.rb +12 -0
- data/benchmarks/erb_vs_erubis.rb +14 -14
- data/benchmarks/marshal_vs_dbm.rb +1 -1
- data/benchmarks/pathname_vs_string.rb +50 -0
- data/benchmarks/template_erb.rb +22 -0
- data/benchmarks/template_format.rb +6 -0
- data/benchmarks/template_profile.rb +17 -0
- data/bin/yri +16 -7
- data/docs/{CODE_OBJECTS.markdown → CodeObjects.md} +0 -0
- data/docs/{GETTING_STARTED.markdown → GettingStarted.md} +49 -11
- data/docs/{GLOSSARY.markdown → Glossary.md} +0 -0
- data/docs/{HANDLERS.markdown → Handlers.md} +5 -5
- data/docs/{OVERVIEW.markdown → Overview.md} +9 -13
- data/docs/{PARSER.markdown → Parser.md} +1 -1
- data/docs/{TAGS.markdown → Tags.md} +1 -1
- data/docs/Templates.md +286 -0
- data/docs/{WHATSNEW.markdown → WhatsNew.md} +82 -2
- data/lib/rubygems_plugin.rb +17 -20
- data/lib/yard.rb +47 -1
- data/lib/yard/autoload.rb +38 -47
- data/lib/yard/cli/yard_graph.rb +36 -13
- data/lib/yard/cli/yardoc.rb +74 -12
- data/lib/yard/code_objects/base.rb +182 -14
- data/lib/yard/code_objects/class_object.rb +39 -2
- data/lib/yard/code_objects/class_variable_object.rb +4 -0
- data/lib/yard/code_objects/constant_object.rb +8 -0
- data/lib/yard/code_objects/extended_method_object.rb +14 -0
- data/lib/yard/code_objects/method_object.rb +60 -2
- data/lib/yard/code_objects/module_object.rb +6 -0
- data/lib/yard/code_objects/namespace_object.rb +99 -2
- data/lib/yard/code_objects/proxy.rb +53 -6
- data/lib/yard/code_objects/root_object.rb +2 -0
- data/lib/yard/core_ext/array.rb +61 -0
- data/lib/yard/core_ext/file.rb +21 -4
- data/lib/yard/core_ext/module.rb +11 -1
- data/lib/yard/core_ext/string.rb +13 -2
- data/lib/yard/core_ext/symbol_hash.rb +51 -3
- data/lib/yard/docstring.rb +68 -19
- data/lib/yard/globals.rb +5 -2
- data/lib/yard/handlers/base.rb +13 -3
- data/lib/yard/handlers/processor.rb +64 -2
- data/lib/yard/handlers/ruby/class_handler.rb +1 -1
- data/lib/yard/handlers/ruby/class_variable_handler.rb +5 -1
- data/lib/yard/handlers/ruby/constant_handler.rb +38 -4
- data/lib/yard/handlers/ruby/exception_handler.rb +1 -0
- data/lib/yard/handlers/ruby/legacy/base.rb +2 -2
- data/lib/yard/handlers/ruby/legacy/class_variable_handler.rb +6 -3
- data/lib/yard/handlers/ruby/legacy/constant_handler.rb +21 -2
- data/lib/yard/handlers/ruby/legacy/method_handler.rb +10 -0
- data/lib/yard/handlers/ruby/legacy/yield_handler.rb +2 -1
- data/lib/yard/handlers/ruby/method_handler.rb +10 -0
- data/lib/yard/handlers/ruby/yield_handler.rb +2 -1
- data/lib/yard/logging.rb +17 -0
- data/lib/yard/parser/ruby/ast_node.rb +101 -0
- data/lib/yard/parser/ruby/legacy/ruby_lex.rb +2 -2
- data/lib/yard/parser/ruby/legacy/statement_list.rb +10 -9
- data/lib/yard/parser/ruby/ruby_parser.rb +32 -3
- data/lib/yard/parser/source_parser.rb +82 -5
- data/lib/yard/rake/yardoc_task.rb +38 -3
- data/lib/yard/registry.rb +112 -2
- data/lib/yard/serializers/base.rb +48 -1
- data/lib/yard/serializers/file_system_serializer.rb +23 -2
- data/lib/yard/serializers/process_serializer.rb +10 -0
- data/lib/yard/serializers/stdout_serializer.rb +11 -0
- data/lib/yard/tags/library.rb +4 -1
- data/lib/yard/tags/overload_tag.rb +3 -12
- data/lib/yard/templates/engine.rb +162 -0
- data/lib/yard/{generators → templates}/helpers/base_helper.rb +14 -13
- data/lib/yard/{generators → templates}/helpers/filter_helper.rb +1 -1
- data/lib/yard/templates/helpers/html_helper.rb +287 -0
- data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +29 -0
- data/lib/yard/templates/helpers/html_syntax_highlight_helper18.rb +27 -0
- data/lib/yard/{generators → templates}/helpers/markup_helper.rb +15 -11
- data/lib/yard/{generators → templates}/helpers/method_helper.rb +8 -1
- data/lib/yard/templates/helpers/module_helper.rb +15 -0
- data/lib/yard/templates/helpers/text_helper.rb +60 -0
- data/lib/yard/templates/helpers/uml_helper.rb +33 -0
- data/lib/yard/templates/template.rb +355 -0
- data/lib/yard/verifier.rb +110 -0
- data/spec/cli/yardoc_spec.rb +23 -1
- data/spec/code_objects/base_spec.rb +8 -0
- data/spec/code_objects/class_object_spec.rb +166 -156
- data/spec/code_objects/method_object_spec.rb +2 -2
- data/spec/code_objects/module_object_spec.rb +112 -110
- data/spec/code_objects/proxy_spec.rb +9 -0
- data/spec/core_ext/array_spec.rb +33 -0
- data/spec/core_ext/file_spec.rb +40 -12
- data/spec/core_ext/module_spec.rb +15 -0
- data/spec/core_ext/string_spec.rb +10 -2
- data/spec/docstring_spec.rb +157 -135
- data/spec/handlers/class_handler_spec.rb +3 -0
- data/spec/handlers/class_variable_handler_spec.rb +3 -1
- data/spec/handlers/constant_handler_spec.rb +38 -0
- data/spec/handlers/examples/class_handler_001.rb.txt +14 -1
- data/spec/handlers/examples/class_variable_handler_001.rb.txt +1 -0
- data/spec/handlers/examples/constant_handler_001.rb.txt +10 -1
- data/spec/handlers/examples/exception_handler_001.rb.txt +5 -0
- data/spec/handlers/examples/method_handler_001.rb.txt +15 -0
- data/spec/handlers/examples/mixin_handler_001.rb.txt +13 -0
- data/spec/handlers/exception_handler_spec.rb +4 -0
- data/spec/handlers/method_handler_spec.rb +22 -0
- data/spec/handlers/mixin_handler_spec.rb +5 -3
- data/spec/handlers/yield_handler_spec.rb +1 -1
- data/spec/parser/ruby/ast_node_spec.rb +16 -0
- data/spec/parser/ruby/legacy/statement_list_spec.rb +36 -0
- data/spec/parser/ruby/ruby_parser_spec.rb +80 -0
- data/spec/parser/source_parser_spec.rb +48 -2
- data/spec/rake/yardoc_task_spec.rb +62 -25
- data/spec/serializers/file_system_serializer_spec.rb +1 -1
- data/spec/templates/class_spec.rb +34 -0
- data/spec/templates/engine_spec.rb +121 -0
- data/spec/templates/examples/class001.html +271 -0
- data/spec/templates/examples/class001.txt +31 -0
- data/spec/templates/examples/method001.html +96 -0
- data/spec/templates/examples/method001.txt +28 -0
- data/spec/templates/examples/method002.html +81 -0
- data/spec/templates/examples/method002.txt +20 -0
- data/spec/templates/examples/method003.html +137 -0
- data/spec/templates/examples/method003.txt +45 -0
- data/spec/templates/examples/module001.dot +31 -0
- data/spec/templates/examples/module001.html +294 -0
- data/spec/templates/examples/module001.txt +33 -0
- data/spec/templates/examples/tag001.txt +82 -0
- data/spec/templates/helpers/base_helper_spec.rb +129 -0
- data/spec/{generators → templates}/helpers/html_helper_spec.rb +73 -16
- data/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +39 -0
- data/spec/{generators → templates}/helpers/markup_helper_spec.rb +6 -7
- data/spec/templates/method_spec.rb +75 -0
- data/spec/templates/module_spec.rb +50 -0
- data/spec/templates/spec_helper.rb +33 -0
- data/spec/templates/tag_spec.rb +39 -0
- data/spec/templates/template_spec.rb +398 -0
- data/spec/verifier_spec.rb +51 -0
- data/spec/yard_spec.rb +46 -0
- data/templates/default/class/dot/setup.rb +6 -0
- data/templates/default/class/dot/superklass.erb +3 -0
- data/templates/default/class/html/constructor_details.erb +8 -0
- data/templates/default/class/html/setup.rb +1 -0
- data/templates/default/class/html/subclasses.erb +4 -0
- data/templates/default/class/setup.rb +29 -0
- data/templates/default/class/text/setup.rb +11 -0
- data/templates/default/class/text/subclasses.erb +5 -0
- data/templates/default/docstring/html/abstract.erb +4 -0
- data/templates/default/docstring/html/deprecated.erb +1 -0
- data/templates/default/docstring/html/index.erb +5 -0
- data/templates/default/docstring/html/note.erb +6 -0
- data/templates/default/docstring/html/text.erb +1 -0
- data/templates/default/docstring/html/todo.erb +6 -0
- data/templates/default/docstring/setup.rb +39 -0
- data/templates/default/docstring/text/abstract.erb +2 -0
- data/templates/default/docstring/text/deprecated.erb +2 -0
- data/templates/default/docstring/text/index.erb +2 -0
- data/templates/default/docstring/text/note.erb +4 -0
- data/templates/default/docstring/text/text.erb +1 -0
- data/templates/default/docstring/text/todo.erb +4 -0
- data/templates/default/fulldoc/html/css/common.css +1 -0
- data/templates/default/fulldoc/html/css/full_list.css +23 -0
- data/templates/default/fulldoc/html/css/style.css +261 -0
- data/templates/default/fulldoc/html/full_list.erb +36 -0
- data/templates/default/fulldoc/html/js/app.js +91 -0
- data/templates/default/fulldoc/html/js/full_list.js +39 -0
- data/templates/default/fulldoc/html/js/jquery.js +19 -0
- data/templates/default/fulldoc/html/setup.rb +86 -0
- data/templates/default/{uml → layout}/dot/header.erb +2 -2
- data/templates/default/layout/dot/setup.rb +14 -0
- data/templates/default/layout/html/breadcrumb.erb +11 -0
- data/templates/default/layout/html/footer.erb +5 -0
- data/templates/default/layout/html/headers.erb +13 -0
- data/templates/default/layout/html/index.erb +49 -0
- data/templates/default/layout/html/layout.erb +20 -0
- data/templates/default/layout/html/search.erb +5 -0
- data/templates/default/layout/html/setup.rb +58 -0
- data/templates/default/method/html/header.erb +14 -3
- data/templates/default/method/setup.rb +3 -0
- data/templates/default/method/text/header.erb +1 -1
- data/templates/default/method_details/html/header.erb +3 -0
- data/templates/default/method_details/html/method_signature.erb +17 -0
- data/templates/default/method_details/html/source.erb +10 -0
- data/templates/default/method_details/setup.rb +8 -0
- data/templates/default/method_details/text/header.erb +10 -0
- data/templates/default/method_details/text/method_signature.erb +12 -0
- data/templates/default/method_details/text/setup.rb +10 -0
- data/templates/default/module/dot/child.erb +1 -0
- data/templates/default/module/dot/dependencies.erb +3 -0
- data/templates/default/{uml/dot/subgraph.erb → module/dot/header.erb} +3 -3
- data/templates/default/{uml → module}/dot/info.erb +4 -4
- data/templates/default/module/dot/setup.rb +14 -0
- data/templates/default/module/html/attribute_details.erb +11 -0
- data/templates/default/module/html/attribute_summary.erb +8 -0
- data/templates/default/module/html/box_info.erb +32 -0
- data/templates/default/module/html/children.erb +8 -0
- data/templates/default/module/html/constant_summary.erb +13 -0
- data/templates/default/module/html/defines.erb +3 -0
- data/templates/default/module/html/header.erb +4 -4
- data/templates/default/module/html/inherited_constants.erb +8 -0
- data/templates/default/module/html/inherited_methods.erb +9 -0
- data/templates/default/module/html/item_summary.erb +20 -0
- data/templates/default/module/html/method_details_list.erb +8 -0
- data/templates/default/module/html/method_summary.erb +8 -0
- data/templates/default/module/html/methodmissing.erb +12 -0
- data/templates/default/module/html/pre_docstring.erb +1 -0
- data/templates/default/module/setup.rb +83 -0
- data/templates/default/module/text/children.erb +10 -0
- data/templates/default/module/text/class_meths_list.erb +8 -0
- data/templates/default/module/text/extends.erb +8 -0
- data/templates/default/module/text/header.erb +7 -0
- data/templates/default/module/text/includes.erb +8 -0
- data/templates/default/module/text/instance_meths_list.erb +8 -0
- data/templates/default/module/text/setup.rb +12 -0
- data/templates/default/root/dot/child.erb +3 -0
- data/templates/default/root/dot/setup.rb +5 -0
- data/templates/default/tags/html/example.erb +5 -16
- data/templates/default/tags/html/index.erb +3 -0
- data/templates/default/tags/html/option.erb +17 -20
- data/templates/default/tags/html/overload.erb +13 -0
- data/templates/default/tags/html/see.erb +5 -10
- data/templates/default/tags/html/tag.erb +20 -0
- data/templates/default/tags/setup.rb +50 -0
- data/templates/default/tags/text/example.erb +8 -10
- data/templates/default/tags/text/index.erb +1 -0
- data/templates/default/tags/text/option.erb +18 -3
- data/templates/default/tags/text/overload.erb +19 -0
- data/templates/default/tags/text/see.erb +8 -2
- data/templates/default/tags/text/tag.erb +13 -0
- metadata +142 -158
- data/bin/view_generator +0 -17
- data/docs/FAQ.markdown +0 -34
- data/docs/GENERATORS.markdown +0 -211
- data/lib/yard/generators/attributes_generator.rb +0 -22
- data/lib/yard/generators/base.rb +0 -305
- data/lib/yard/generators/class_generator.rb +0 -27
- data/lib/yard/generators/constants_generator.rb +0 -74
- data/lib/yard/generators/constructor_generator.rb +0 -25
- data/lib/yard/generators/deprecated_generator.rb +0 -15
- data/lib/yard/generators/docstring_generator.rb +0 -15
- data/lib/yard/generators/full_doc_generator.rb +0 -127
- data/lib/yard/generators/helpers/html_helper.rb +0 -196
- data/lib/yard/generators/helpers/html_syntax_highlight_helper.rb +0 -49
- data/lib/yard/generators/helpers/uml_helper.rb +0 -16
- data/lib/yard/generators/inheritance_generator.rb +0 -16
- data/lib/yard/generators/method_details_generator.rb +0 -18
- data/lib/yard/generators/method_generator.rb +0 -43
- data/lib/yard/generators/method_listing_generator.rb +0 -105
- data/lib/yard/generators/method_missing_generator.rb +0 -25
- data/lib/yard/generators/method_signature_generator.rb +0 -19
- data/lib/yard/generators/method_summary_generator.rb +0 -21
- data/lib/yard/generators/mixins_generator.rb +0 -21
- data/lib/yard/generators/module_generator.rb +0 -23
- data/lib/yard/generators/overloads_generator.rb +0 -20
- data/lib/yard/generators/quick_doc_generator.rb +0 -25
- data/lib/yard/generators/root_generator.rb +0 -32
- data/lib/yard/generators/source_generator.rb +0 -11
- data/lib/yard/generators/tags_generator.rb +0 -99
- data/lib/yard/generators/uml_generator.rb +0 -102
- data/lib/yard/generators/visibility_group_generator.rb +0 -26
- data/spec/generators/base_spec.rb +0 -64
- data/spec/generators/full_doc_generator_spec.rb +0 -29
- data/spec/generators/helpers/base_helper_spec.rb +0 -15
- data/spec/generators/quick_doc_generator_spec.rb +0 -13
- data/templates/default/attributes/html/header.erb +0 -47
- data/templates/default/attributes/text/header.erb +0 -10
- data/templates/default/class/html/header.erb +0 -4
- data/templates/default/constants/html/constants.erb +0 -9
- data/templates/default/constants/html/header.erb +0 -3
- data/templates/default/constants/html/included.erb +0 -9
- data/templates/default/constants/html/inherited.erb +0 -9
- data/templates/default/constructor/html/header.erb +0 -10
- data/templates/default/deprecated/html/main.erb +0 -6
- data/templates/default/deprecated/text/main.erb +0 -3
- data/templates/default/docstring/html/main.erb +0 -3
- data/templates/default/docstring/text/main.erb +0 -3
- data/templates/default/fulldoc/html/all_files.erb +0 -19
- data/templates/default/fulldoc/html/all_methods.erb +0 -26
- data/templates/default/fulldoc/html/all_namespaces.erb +0 -22
- data/templates/default/fulldoc/html/app.js +0 -18
- data/templates/default/fulldoc/html/custom.css +0 -1
- data/templates/default/fulldoc/html/file.erb +0 -16
- data/templates/default/fulldoc/html/footer.erb +0 -5
- data/templates/default/fulldoc/html/header.erb +0 -16
- data/templates/default/fulldoc/html/html_head.erb +0 -4
- data/templates/default/fulldoc/html/index.erb +0 -19
- data/templates/default/fulldoc/html/jquery.js +0 -11
- data/templates/default/fulldoc/html/style.css +0 -81
- data/templates/default/fulldoc/html/syntax_highlight.css +0 -24
- data/templates/default/inheritance/html/header.erb +0 -8
- data/templates/default/inheritance/text/header.erb +0 -3
- data/templates/default/method/html/aliases.erb +0 -6
- data/templates/default/method/html/title.erb +0 -3
- data/templates/default/method/text/title.erb +0 -1
- data/templates/default/methoddetails/html/header.erb +0 -8
- data/templates/default/methoddetails/html/method_header.erb +0 -3
- data/templates/default/methodmissing/html/header.erb +0 -12
- data/templates/default/methodsignature/html/main.erb +0 -10
- data/templates/default/methodsignature/text/main.erb +0 -8
- data/templates/default/methodsummary/html/header.erb +0 -5
- data/templates/default/methodsummary/html/included.erb +0 -9
- data/templates/default/methodsummary/html/inherited.erb +0 -9
- data/templates/default/methodsummary/html/summary.erb +0 -29
- data/templates/default/methodsummary/text/header.erb +0 -5
- data/templates/default/methodsummary/text/included.erb +0 -0
- data/templates/default/methodsummary/text/inherited.erb +0 -0
- data/templates/default/methodsummary/text/summary.erb +0 -6
- data/templates/default/mixins/html/header.erb +0 -4
- data/templates/default/overloads/html/header.erb +0 -8
- data/templates/default/overloads/text/header.erb +0 -8
- data/templates/default/quickdoc/html/header.erb +0 -15
- data/templates/default/quickdoc/text/header.erb +0 -12
- data/templates/default/root/html/header.erb +0 -4
- data/templates/default/source/html/main.erb +0 -15
- data/templates/default/source/text/main.erb +0 -4
- data/templates/default/tags/html/header.erb +0 -4
- data/templates/default/tags/html/param.erb +0 -21
- data/templates/default/tags/html/tags.erb +0 -23
- data/templates/default/tags/html/todo.erb +0 -8
- data/templates/default/tags/text/header.erb +0 -3
- data/templates/default/tags/text/param.erb +0 -9
- data/templates/default/tags/text/tags.erb +0 -7
- data/templates/default/uml/dot/child.erb +0 -1
- data/templates/default/uml/dot/dependencies.erb +0 -10
- data/templates/default/uml/dot/superclasses.erb +0 -9
- data/templates/default/uml/dot/unknown.erb +0 -3
- data/templates/default/uml/dot/unknown_child.erb +0 -1
- data/templates/default/visibilitygroup/html/header.erb +0 -6
- data/templates/javadoc/attributes/html/header.erb +0 -16
- data/templates/javadoc/class/html/header.erb +0 -4
- data/templates/javadoc/constants/html/constants.erb +0 -9
- data/templates/javadoc/constants/html/header.erb +0 -3
- data/templates/javadoc/constants/html/included.erb +0 -12
- data/templates/javadoc/constants/html/inherited.erb +0 -12
- data/templates/javadoc/constructor/html/header.erb +0 -10
- data/templates/javadoc/deprecated/html/main.erb +0 -0
- data/templates/javadoc/docstring/html/main.erb +0 -6
- data/templates/javadoc/fulldoc/html/all_methods.erb +0 -25
- data/templates/javadoc/fulldoc/html/all_namespaces.erb +0 -19
- data/templates/javadoc/fulldoc/html/app.js +0 -18
- data/templates/javadoc/fulldoc/html/header.erb +0 -15
- data/templates/javadoc/fulldoc/html/html_head.erb +0 -3
- data/templates/javadoc/fulldoc/html/index.erb +0 -18
- data/templates/javadoc/fulldoc/html/jquery.js +0 -11
- data/templates/javadoc/fulldoc/html/readme.erb +0 -15
- data/templates/javadoc/fulldoc/html/style.css +0 -22
- data/templates/javadoc/fulldoc/html/syntax_highlight.css +0 -21
- data/templates/javadoc/inheritance/html/header.erb +0 -6
- data/templates/javadoc/method/html/aliases.erb +0 -6
- data/templates/javadoc/method/html/header.erb +0 -4
- data/templates/javadoc/method/html/title.erb +0 -4
- data/templates/javadoc/methoddetails/html/header.erb +0 -8
- data/templates/javadoc/methoddetails/html/method_header.erb +0 -0
- data/templates/javadoc/methodmissing/html/header.erb +0 -12
- data/templates/javadoc/methodsignature/html/main.erb +0 -8
- data/templates/javadoc/methodsummary/html/header.erb +0 -5
- data/templates/javadoc/methodsummary/html/included.erb +0 -12
- data/templates/javadoc/methodsummary/html/inherited.erb +0 -12
- data/templates/javadoc/methodsummary/html/summary.erb +0 -25
- data/templates/javadoc/mixins/html/header.erb +0 -5
- data/templates/javadoc/module/html/header.erb +0 -4
- data/templates/javadoc/source/html/main.erb +0 -15
- data/templates/javadoc/tags/html/header.erb +0 -5
- data/templates/javadoc/tags/html/see.erb +0 -8
- data/templates/javadoc/tags/html/tags.erb +0 -19
- data/templates/javadoc/visibilitygroup/html/header.erb +0 -5
@@ -2,6 +2,8 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
2
|
|
3
3
|
describe YARD::Rake::YardocTask do
|
4
4
|
before do
|
5
|
+
@yardoc = mock(:cli)
|
6
|
+
YARD::CLI::Yardoc.stub!(:new).and_return(@yardoc)
|
5
7
|
Rake.application.clear
|
6
8
|
end
|
7
9
|
|
@@ -9,40 +11,75 @@ describe YARD::Rake::YardocTask do
|
|
9
11
|
Rake.application.tasks[0].invoke
|
10
12
|
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
14
|
+
describe '#initialize' do
|
15
|
+
it "should allow separate rake task name to be set" do
|
16
|
+
YARD::Rake::YardocTask.new(:notyardoc)
|
17
|
+
Rake.application.tasks[0].name.should == "notyardoc"
|
18
|
+
end
|
15
19
|
end
|
16
20
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
+
describe '#files' do
|
22
|
+
it "should allow files to be set" do
|
23
|
+
@yardoc.should_receive(:run).with('a', 'b', 'c')
|
24
|
+
YARD::Rake::YardocTask.new do |t|
|
25
|
+
t.files = ['a', 'b', 'c']
|
26
|
+
end
|
27
|
+
run
|
21
28
|
end
|
22
|
-
run
|
23
29
|
end
|
24
30
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
31
|
+
describe '#options' do
|
32
|
+
it "should allow extra options to be set" do
|
33
|
+
@yardoc.should_receive(:run).with('--extra', '--opts')
|
34
|
+
YARD::Rake::YardocTask.new do |t|
|
35
|
+
t.options = ['--extra', '--opts']
|
36
|
+
end
|
37
|
+
run
|
29
38
|
end
|
30
|
-
run
|
31
39
|
end
|
32
40
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
41
|
+
describe '#before' do
|
42
|
+
it "should allow before callback" do
|
43
|
+
proc = lambda { }
|
44
|
+
proc.should_receive(:call)
|
45
|
+
@yardoc.should_receive(:run)
|
46
|
+
YARD::Rake::YardocTask.new {|t| t.before = proc }
|
47
|
+
run
|
48
|
+
end
|
39
49
|
end
|
40
50
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
51
|
+
describe '#after' do
|
52
|
+
it "should allow after callback" do
|
53
|
+
proc = lambda { }
|
54
|
+
proc.should_receive(:call)
|
55
|
+
@yardoc.should_receive(:run)
|
56
|
+
YARD::Rake::YardocTask.new {|t| t.after = proc }
|
57
|
+
run
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#verifier' do
|
61
|
+
it "should allow a verifier proc to be set" do
|
62
|
+
proc = mock(:proc)
|
63
|
+
mockopts = mock(:options)
|
64
|
+
mockopts.should_receive(:[]=).with(:verifier, proc)
|
65
|
+
@yardoc.should_receive(:options).and_return(mockopts)
|
66
|
+
@yardoc.should_receive(:run)
|
67
|
+
YARD::Rake::YardocTask.new {|t| t.verifier = proc }
|
68
|
+
run
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should only use verifier if no --query options are passed" do
|
72
|
+
proc = mock(:proc)
|
73
|
+
mockopts = mock(:options)
|
74
|
+
mockopts.should_receive(:[]=).with(:verifier, proc)
|
75
|
+
@yardoc.should_receive(:options).and_return(mockopts)
|
76
|
+
@yardoc.should_receive(:run)
|
77
|
+
YARD::Rake::YardocTask.new do |t|
|
78
|
+
t.options += ['--query', '@return']
|
79
|
+
t.verifier = proc
|
80
|
+
end
|
81
|
+
run
|
82
|
+
end
|
83
|
+
end
|
47
84
|
end
|
48
85
|
end
|
@@ -38,7 +38,7 @@ describe YARD::Serializers::FileSystemSerializer do
|
|
38
38
|
'foo/FooBar/baz_i.txt' => meth2,
|
39
39
|
'foo/FooBar.txt' => yard }.each do |path, obj|
|
40
40
|
io = StringIO.new
|
41
|
-
File.should_receive(:open).with(path, '
|
41
|
+
File.should_receive(:open).with(path, 'wb').and_yield(io)
|
42
42
|
io.should_receive(:write).with("data")
|
43
43
|
|
44
44
|
s = Serializers::FileSystemSerializer.new(:basepath => 'foo', :extension => 'txt')
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe YARD::Templates::Engine.template(:default, :docstring) do
|
4
|
+
before do
|
5
|
+
YARD.parse_string <<-'eof'
|
6
|
+
private
|
7
|
+
# Comments
|
8
|
+
# @abstract override this class
|
9
|
+
# @author Test
|
10
|
+
# @version 1.0
|
11
|
+
# @see A
|
12
|
+
# @see http://example.com Example
|
13
|
+
class A < B
|
14
|
+
# HI
|
15
|
+
def method_missing(*args) end
|
16
|
+
# @deprecated
|
17
|
+
def a; end
|
18
|
+
|
19
|
+
# constructor method!
|
20
|
+
def initialize(test) end
|
21
|
+
end
|
22
|
+
|
23
|
+
class C < A; end
|
24
|
+
eof
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should render html format correctly" do
|
28
|
+
html_equals(Registry.at('A').format(:format => :html, :no_highlight => true), :class001)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should render text format correctly" do
|
32
|
+
text_equals(Registry.at('A').format, :class001)
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe YARD::Templates::Engine do
|
4
|
+
describe '.register_template_path' do
|
5
|
+
it "should register a String path" do
|
6
|
+
Engine.register_template_path('.')
|
7
|
+
Engine.template_paths.pop.should == '.'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '.template!' do
|
12
|
+
it "should create a module including Template" do
|
13
|
+
mod = Engine.template!('path/to/template')
|
14
|
+
mod.should include(Template)
|
15
|
+
mod.full_path.to_s.should == 'path/to/template'
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should create a module including Template with full_path" do
|
19
|
+
mod = Engine.template!('path/to/template2', '/full/path/to/template2')
|
20
|
+
mod.should include(Template)
|
21
|
+
mod.full_path.to_s.should == '/full/path/to/template2'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '.template' do
|
26
|
+
it "should raise an error if the template is not found" do
|
27
|
+
lambda { Engine.template(:a, :b, :c) }.should raise_error(ArgumentError)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should create a module including Template" do
|
31
|
+
mock = mock(:template)
|
32
|
+
Engine.should_receive(:find_template_paths).with(nil, 'template/name').and_return(['/full/path/template/name'])
|
33
|
+
Engine.should_receive(:template!).with('template/name', ['/full/path/template/name']).and_return(mock)
|
34
|
+
Engine.template('template/name').should == mock
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should create a Template from a relative Template path" do
|
38
|
+
Engine.should_receive(:template_paths).and_return([])
|
39
|
+
File.should_receive(:directory?).with("/full/path/template/notname").and_return(true)
|
40
|
+
start_template = mock(:start_template)
|
41
|
+
start_template.stub!(:full_path).and_return('/full/path/template/name')
|
42
|
+
start_template.stub!(:full_paths).and_return(['/full/path/template/name'])
|
43
|
+
start_template.should_receive(:is_a?).with(Template).and_return(true)
|
44
|
+
mod = Engine.template(start_template, '..', 'notname')
|
45
|
+
mod.should include(Template)
|
46
|
+
mod.full_path.to_s.should == "/full/path/template/notname"
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should create a Template including other matching templates in path" do
|
50
|
+
paths = ['/full/path/template/name', '/full/path2/template/name']
|
51
|
+
Engine.should_receive(:find_template_paths).with(nil, 'template/name').and_return(paths)
|
52
|
+
ancestors = Engine.template('template/name').ancestors.map {|m| m.class_name }
|
53
|
+
ancestors.should include("Template__full_path2_template_name")
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should include parent directories before other template paths" do
|
57
|
+
paths = ['/full/path/template/name', '/full/path2/template/name']
|
58
|
+
Engine.should_receive(:find_template_paths).with(nil, 'template/name').and_return(paths)
|
59
|
+
ancestors = Engine.template('template/name').ancestors.map {|m| m.class_name }
|
60
|
+
ancestors[0, 4].should == ["Template__full_path_template_name", "Template__full_path_template",
|
61
|
+
"Template__full_path2_template_name", "Template__full_path2_template"]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '.generate' do
|
66
|
+
it "should generate with fulldoc template" do
|
67
|
+
mod = mock(:template)
|
68
|
+
mod.should_receive(:run).with(:format => :text, :template => :default, :objects => [:a, :b, :c])
|
69
|
+
Engine.should_receive(:template).with(:default, :fulldoc, :text).and_return(mod)
|
70
|
+
Engine.generate([:a, :b, :c])
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe '.render' do
|
75
|
+
def loads_template(*args)
|
76
|
+
Engine.should_receive(:template).with(*args).and_return(@template)
|
77
|
+
end
|
78
|
+
|
79
|
+
before(:all) do
|
80
|
+
@template = mock(:template)
|
81
|
+
@template.stub!(:include)
|
82
|
+
@object = CodeObjects::MethodObject.new(:root, :method)
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should accept method call with no parameters" do
|
86
|
+
loads_template(:default, :method, :text)
|
87
|
+
@template.should_receive(:run).with :type => :method,
|
88
|
+
:template => :default,
|
89
|
+
:format => :text,
|
90
|
+
:object => @object
|
91
|
+
@object.format
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should allow template key to be changed" do
|
95
|
+
loads_template(:javadoc, :method, :text)
|
96
|
+
@template.should_receive(:run).with :type => :method,
|
97
|
+
:template => :javadoc,
|
98
|
+
:format => :text,
|
99
|
+
:object => @object
|
100
|
+
@object.format(:template => :javadoc)
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should allow type key to be changed" do
|
104
|
+
loads_template(:default, :fulldoc, :text)
|
105
|
+
@template.should_receive(:run).with :type => :fulldoc,
|
106
|
+
:template => :default,
|
107
|
+
:format => :text,
|
108
|
+
:object => @object
|
109
|
+
@object.format(:type => :fulldoc)
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should allow format key to be changed" do
|
113
|
+
loads_template(:default, :method, :html)
|
114
|
+
@template.should_receive(:run).with :type => :method,
|
115
|
+
:template => :default,
|
116
|
+
:format => :html,
|
117
|
+
:object => @object
|
118
|
+
@object.format(:format => :html)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,271 @@
|
|
1
|
+
<h1>Class: A
|
2
|
+
<span class="abstract note title">Abstract</span>
|
3
|
+
|
4
|
+
</h1>
|
5
|
+
|
6
|
+
<dl class="box">
|
7
|
+
|
8
|
+
<dt class="r1">Inherits:</dt>
|
9
|
+
<dd class="r1">
|
10
|
+
<span class="inheritName">B</span>
|
11
|
+
|
12
|
+
<ul class="fullTree">
|
13
|
+
<li>Object</li>
|
14
|
+
|
15
|
+
<li class="next">B</li>
|
16
|
+
|
17
|
+
<li class="next">A</li>
|
18
|
+
|
19
|
+
</ul>
|
20
|
+
<a href="#" class="inheritanceTree">show all</a>
|
21
|
+
|
22
|
+
</dd>
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
<dt class="r2 last">Defined in:</dt>
|
32
|
+
<dd class="r2 last">(stdin)</dd>
|
33
|
+
|
34
|
+
</dl>
|
35
|
+
<div class="clear"></div>
|
36
|
+
|
37
|
+
<h2>Overview</h2><div class="docstring">
|
38
|
+
<div class="discussion">
|
39
|
+
<p class="note abstract">
|
40
|
+
<strong>This class is abstract.</strong>
|
41
|
+
override this class
|
42
|
+
</p>
|
43
|
+
Comments
|
44
|
+
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
<div class="tags">
|
48
|
+
|
49
|
+
<h3>See Also:</h3>
|
50
|
+
<ul class="see">
|
51
|
+
|
52
|
+
<li>A</li>
|
53
|
+
|
54
|
+
<li><a href="http://example.com" title="Example">Example</a></li>
|
55
|
+
|
56
|
+
</ul>
|
57
|
+
<h3>Author:</h3>
|
58
|
+
<ul class="author">
|
59
|
+
|
60
|
+
<li>
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
Test
|
67
|
+
|
68
|
+
</li>
|
69
|
+
|
70
|
+
</ul>
|
71
|
+
<h3>Version:</h3>
|
72
|
+
<ul class="version">
|
73
|
+
|
74
|
+
<li>
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
1.0
|
81
|
+
|
82
|
+
</li>
|
83
|
+
|
84
|
+
</ul>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
<h2>Method Summary</h2>
|
91
|
+
<ul class="summary">
|
92
|
+
|
93
|
+
<li class="public deprecated">
|
94
|
+
<span class="summary_signature"><a title="#a (instance method)">- (Object) <strong>a</strong> </a>
|
95
|
+
|
96
|
+
</span>
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<span class="deprecated note title">Deprecated</span>
|
101
|
+
|
102
|
+
|
103
|
+
<span class="summary_desc"><strong>Deprecated.</strong> </span>
|
104
|
+
|
105
|
+
</li>
|
106
|
+
|
107
|
+
|
108
|
+
<li class="public ">
|
109
|
+
<span class="summary_signature"><a title="#initialize (instance method)">- (A) <strong>initialize</strong>(test) </a>
|
110
|
+
|
111
|
+
</span>
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<span class="summary_desc">constructor method!.</span>
|
119
|
+
|
120
|
+
</li>
|
121
|
+
|
122
|
+
|
123
|
+
<li class="public ">
|
124
|
+
<span class="summary_signature"><a title="#method_missing (instance method)">- (Object) <strong>method_missing</strong>(*args) </a>
|
125
|
+
|
126
|
+
</span>
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="summary_desc">HI.</span>
|
134
|
+
|
135
|
+
</li>
|
136
|
+
|
137
|
+
|
138
|
+
</ul>
|
139
|
+
|
140
|
+
|
141
|
+
<div id="constructor_details">
|
142
|
+
<h2>Constructor Details</h2>
|
143
|
+
|
144
|
+
<div class="method_details first">
|
145
|
+
<p class="signature first" id="initialize-instance_method">
|
146
|
+
|
147
|
+
- (<tt>A</tt>) <strong>initialize</strong>(test)
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
</p><div class="docstring">
|
152
|
+
<div class="discussion">
|
153
|
+
constructor method!
|
154
|
+
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
<div class="tags">
|
158
|
+
<h3>Returns:</h3>
|
159
|
+
<ul class="return">
|
160
|
+
|
161
|
+
<li>
|
162
|
+
|
163
|
+
<span class='type'>(<tt>A</tt>)</span>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
—
|
169
|
+
a new instance of +A+
|
170
|
+
|
171
|
+
</li>
|
172
|
+
|
173
|
+
</ul>
|
174
|
+
|
175
|
+
</div><table class="source_code">
|
176
|
+
<tr>
|
177
|
+
<td>
|
178
|
+
<pre class="lines">
|
179
|
+
|
180
|
+
|
181
|
+
15</pre>
|
182
|
+
</td>
|
183
|
+
<td>
|
184
|
+
<pre class="code"><span class="info file"># File '(stdin)', line 15</span>
|
185
|
+
|
186
|
+
def initialize(test) end</pre>
|
187
|
+
</td>
|
188
|
+
</tr>
|
189
|
+
</table>
|
190
|
+
</div>
|
191
|
+
|
192
|
+
</div>
|
193
|
+
<div id="method_missing_details">
|
194
|
+
<h2>Dynamic Method Handling</h2>
|
195
|
+
<p class="notice this">
|
196
|
+
This class handles dynamic methods through the <tt>method_missing</tt> method
|
197
|
+
|
198
|
+
</p>
|
199
|
+
|
200
|
+
<div class="method_details first">
|
201
|
+
<p class="signature first" id="method_missing-instance_method">
|
202
|
+
|
203
|
+
- (<tt>Object</tt>) <strong>method_missing</strong>(*args)
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
</p><div class="docstring">
|
208
|
+
<div class="discussion">
|
209
|
+
HI
|
210
|
+
|
211
|
+
</div>
|
212
|
+
</div>
|
213
|
+
<div class="tags">
|
214
|
+
|
215
|
+
</div><table class="source_code">
|
216
|
+
<tr>
|
217
|
+
<td>
|
218
|
+
<pre class="lines">
|
219
|
+
|
220
|
+
|
221
|
+
10</pre>
|
222
|
+
</td>
|
223
|
+
<td>
|
224
|
+
<pre class="code"><span class="info file"># File '(stdin)', line 10</span>
|
225
|
+
|
226
|
+
def method_missing(*args) end</pre>
|
227
|
+
</td>
|
228
|
+
</tr>
|
229
|
+
</table>
|
230
|
+
</div>
|
231
|
+
|
232
|
+
</div>
|
233
|
+
|
234
|
+
|
235
|
+
<div id="method_details">
|
236
|
+
<h2>Method Details</h2>
|
237
|
+
|
238
|
+
<div class="method_details first">
|
239
|
+
<p class="signature first" id="a-instance_method">
|
240
|
+
|
241
|
+
- (<tt>Object</tt>) <strong>a</strong>
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
</p><div class="docstring">
|
246
|
+
<div class="discussion">
|
247
|
+
<p class="note deprecated"><strong>Deprecated.</strong> </p>
|
248
|
+
|
249
|
+
|
250
|
+
</div>
|
251
|
+
</div>
|
252
|
+
<div class="tags">
|
253
|
+
|
254
|
+
</div><table class="source_code">
|
255
|
+
<tr>
|
256
|
+
<td>
|
257
|
+
<pre class="lines">
|
258
|
+
|
259
|
+
|
260
|
+
12</pre>
|
261
|
+
</td>
|
262
|
+
<td>
|
263
|
+
<pre class="code"><span class="info file"># File '(stdin)', line 12</span>
|
264
|
+
|
265
|
+
def a; end</pre>
|
266
|
+
</td>
|
267
|
+
</tr>
|
268
|
+
</table>
|
269
|
+
</div>
|
270
|
+
|
271
|
+
</div>
|