yard 0.8.7.6 → 0.9.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -1
- data/LICENSE +2 -2
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/bin/yard +0 -0
- data/bin/yardoc +0 -0
- data/bin/yri +0 -0
- data/docs/GettingStarted.md +88 -6
- 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/templates/default/fulldoc/html/full_list_tag.erb +6 -4
- data/lib/yard/autoload.rb +3 -0
- data/lib/yard/cli/yardoc.rb +1 -1
- data/lib/yard/code_objects/base.rb +4 -1
- data/lib/yard/code_objects/extra_file_object.rb +3 -1
- data/lib/yard/code_objects/proxy.rb +2 -2
- data/lib/yard/docstring.rb +11 -6
- data/lib/yard/handlers/base.rb +1 -2
- data/lib/yard/handlers/c/base.rb +19 -0
- data/lib/yard/handlers/c/handler_methods.rb +42 -8
- data/lib/yard/handlers/c/init_handler.rb +1 -1
- data/lib/yard/handlers/c/method_handler.rb +3 -3
- data/lib/yard/handlers/ruby/decorator_handler_methods.rb +132 -0
- data/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb +1 -1
- data/lib/yard/handlers/ruby/private_class_method_handler.rb +6 -39
- data/lib/yard/handlers/ruby/private_constant_handler.rb +36 -30
- data/lib/yard/handlers/ruby/public_class_method_handler.rb +13 -0
- data/lib/yard/handlers/ruby/struct_handler_methods.rb +1 -0
- data/lib/yard/handlers/ruby/visibility_handler.rb +5 -8
- data/lib/yard/logging.rb +1 -0
- data/lib/yard/parser/ruby/ruby_parser.rb +2 -2
- data/lib/yard/parser/source_parser.rb +6 -6
- data/lib/yard/rake/yardoc_task.rb +2 -2
- data/lib/yard/serializers/file_system_serializer.rb +33 -1
- data/lib/yard/server/commands/display_file_command.rb +8 -3
- data/lib/yard/server/commands/display_object_command.rb +7 -3
- data/lib/yard/server/doc_server_helper.rb +2 -8
- data/lib/yard/server/doc_server_serializer.rb +2 -4
- data/lib/yard/server/router.rb +1 -1
- data/lib/yard/server/templates/default/fulldoc/html/css/custom.css +57 -8
- data/lib/yard/server/templates/default/layout/html/breadcrumb.erb +2 -10
- data/lib/yard/server/templates/default/layout/html/script_setup.erb +1 -2
- data/lib/yard/server/templates/default/method_details/html/permalink.erb +3 -3
- data/lib/yard/server/templates/doc_server/processing/html/processing.erb +4 -4
- data/lib/yard/tags/directives.rb +1 -0
- data/lib/yard/tags/library.rb +9 -7
- data/lib/yard/tags/overload_tag.rb +4 -1
- data/lib/yard/templates/helpers/html_helper.rb +4 -3
- data/lib/yard/templates/template_options.rb +3 -0
- data/lib/yard/version.rb +1 -1
- data/spec/cli/command_parser_spec.rb +14 -14
- data/spec/cli/command_spec.rb +11 -11
- data/spec/cli/config_spec.rb +32 -32
- data/spec/cli/diff_spec.rb +86 -90
- data/spec/cli/display_spec.rb +6 -6
- data/spec/cli/gems_spec.rb +28 -28
- data/spec/cli/graph_spec.rb +8 -8
- data/spec/cli/help_spec.rb +8 -8
- data/spec/cli/i18n_spec.rb +33 -37
- data/spec/cli/list_spec.rb +2 -2
- data/spec/cli/markup_types_spec.rb +3 -3
- data/spec/cli/server_spec.rb +74 -88
- data/spec/cli/stats_spec.rb +14 -14
- data/spec/cli/yardoc_spec.rb +316 -321
- data/spec/cli/yri_spec.rb +45 -45
- data/spec/code_objects/base_spec.rb +174 -173
- data/spec/code_objects/class_object_spec.rb +65 -65
- data/spec/code_objects/code_object_list_spec.rb +13 -11
- data/spec/code_objects/constants_spec.rb +68 -58
- data/spec/code_objects/extra_file_object_spec.rb +71 -59
- data/spec/code_objects/macro_object_spec.rb +64 -64
- data/spec/code_objects/method_object_spec.rb +80 -72
- data/spec/code_objects/module_object_spec.rb +47 -47
- data/spec/code_objects/namespace_object_spec.rb +51 -51
- data/spec/code_objects/proxy_spec.rb +54 -54
- data/spec/config_spec.rb +104 -104
- data/spec/core_ext/array_spec.rb +5 -5
- data/spec/core_ext/file_spec.rb +33 -33
- data/spec/core_ext/hash_spec.rb +5 -5
- data/spec/core_ext/insertion_spec.rb +18 -18
- data/spec/core_ext/module_spec.rb +6 -6
- data/spec/core_ext/string_spec.rb +17 -17
- data/spec/core_ext/symbol_hash_spec.rb +42 -39
- data/spec/docstring_parser_spec.rb +65 -65
- data/spec/docstring_spec.rb +137 -130
- data/spec/handlers/alias_handler_spec.rb +39 -39
- data/spec/handlers/attribute_handler_spec.rb +35 -35
- data/spec/handlers/base_spec.rb +60 -51
- data/spec/handlers/c/alias_handler_spec.rb +6 -6
- data/spec/handlers/c/attribute_handler_spec.rb +12 -12
- data/spec/handlers/c/class_handler_spec.rb +35 -22
- data/spec/handlers/c/constant_handler_spec.rb +24 -22
- data/spec/handlers/c/init_handler_spec.rb +10 -10
- data/spec/handlers/c/method_handler_spec.rb +150 -65
- data/spec/handlers/c/mixin_handler_spec.rb +5 -5
- data/spec/handlers/c/module_handler_spec.rb +27 -15
- data/spec/handlers/c/override_comment_handler_spec.rb +14 -14
- data/spec/handlers/c/path_handler_spec.rb +8 -8
- data/spec/handlers/c/spec_helper.rb +10 -0
- data/spec/handlers/c/struct_handler_spec.rb +3 -3
- data/spec/handlers/class_condition_handler_spec.rb +18 -18
- data/spec/handlers/class_handler_spec.rb +97 -97
- data/spec/handlers/class_method_handler_shared_examples.rb +132 -0
- data/spec/handlers/class_variable_handler_spec.rb +3 -3
- data/spec/handlers/constant_handler_spec.rb +32 -29
- data/spec/handlers/decorator_handler_methods_spec.rb +405 -0
- data/spec/handlers/dsl_handler_spec.rb +108 -109
- data/spec/handlers/examples/constant_handler_001.rb.txt +4 -1
- data/spec/handlers/examples/visibility_handler_001.rb.txt +4 -0
- data/spec/handlers/exception_handler_spec.rb +23 -23
- data/spec/handlers/extend_handler_spec.rb +9 -9
- data/spec/handlers/legacy_base_spec.rb +60 -60
- data/spec/handlers/method_condition_handler_spec.rb +5 -5
- data/spec/handlers/method_handler_spec.rb +92 -92
- data/spec/handlers/mixin_handler_spec.rb +25 -25
- data/spec/handlers/module_function_handler_spec.rb +24 -24
- data/spec/handlers/module_handler_spec.rb +15 -15
- data/spec/handlers/private_class_method_handler_spec.rb +4 -48
- data/spec/handlers/private_constant_handler_spec.rb +8 -8
- data/spec/handlers/processor_spec.rb +12 -12
- data/spec/handlers/public_class_method_handler_spec.rb +10 -0
- data/spec/handlers/ruby/base_spec.rb +16 -16
- data/spec/handlers/ruby/legacy/base_spec.rb +20 -18
- data/spec/handlers/spec_helper.rb +1 -1
- data/spec/handlers/visibility_handler_spec.rb +25 -21
- data/spec/handlers/yield_handler_spec.rb +28 -28
- data/spec/i18n/locale_spec.rb +16 -16
- data/spec/i18n/message_spec.rb +8 -8
- data/spec/i18n/messages_spec.rb +14 -14
- data/spec/i18n/pot_generator_spec.rb +32 -32
- data/spec/i18n/text_spec.rb +22 -22
- data/spec/logging_spec.rb +12 -12
- data/spec/options_spec.rb +56 -56
- data/spec/parser/base_spec.rb +9 -9
- data/spec/parser/c_parser_spec.rb +50 -50
- data/spec/parser/ruby/ast_node_spec.rb +7 -7
- data/spec/parser/ruby/legacy/statement_list_spec.rb +106 -106
- data/spec/parser/ruby/legacy/token_list_spec.rb +27 -27
- data/spec/parser/ruby/ruby_parser_spec.rb +123 -113
- data/spec/parser/source_parser_spec.rb +224 -224
- data/spec/parser/tag_parsing_spec.rb +6 -7
- data/spec/rake/yardoc_task_spec.rb +38 -48
- data/spec/registry_spec.rb +143 -143
- data/spec/registry_store_spec.rb +165 -165
- data/spec/rubygems/doc_manager_spec.rb +38 -38
- data/spec/serializers/file_system_serializer_spec.rb +53 -33
- data/spec/serializers/yardoc_serializer_spec.rb +15 -15
- data/spec/server/adapter_spec.rb +15 -15
- data/spec/server/commands/base_spec.rb +29 -29
- data/spec/server/commands/library_command_spec.rb +12 -12
- data/spec/server/commands/static_file_command_spec.rb +28 -28
- data/spec/server/doc_server_helper_spec.rb +8 -8
- data/spec/server/doc_server_serializer_spec.rb +23 -18
- data/spec/server/rack_adapter_spec.rb +6 -6
- data/spec/server/router_spec.rb +39 -39
- data/spec/server/static_caching_spec.rb +16 -16
- data/spec/server/webrick_servlet_spec.rb +6 -7
- data/spec/server_spec.rb +3 -3
- data/spec/spec_helper.rb +11 -2
- data/spec/tags/default_factory_spec.rb +64 -64
- data/spec/tags/default_tag_spec.rb +5 -5
- data/spec/tags/directives_spec.rb +121 -121
- data/spec/tags/library_spec.rb +14 -14
- data/spec/tags/overload_tag_spec.rb +24 -24
- data/spec/tags/ref_tag_list_spec.rb +12 -12
- data/spec/templates/class_spec.rb +3 -3
- data/spec/templates/constant_spec.rb +4 -4
- data/spec/templates/engine_spec.rb +47 -48
- data/spec/templates/examples/class001.html +129 -101
- data/spec/templates/examples/class002.html +31 -27
- data/spec/templates/examples/method001.html +54 -47
- data/spec/templates/examples/method002.html +33 -28
- data/spec/templates/examples/method003.html +70 -64
- data/spec/templates/examples/method004.html +13 -9
- data/spec/templates/examples/method005.html +38 -32
- data/spec/templates/examples/module001.html +343 -339
- data/spec/templates/examples/module002.html +147 -124
- data/spec/templates/examples/module003.html +94 -81
- data/spec/templates/examples/module004.html +40 -33
- data/spec/templates/helpers/base_helper_spec.rb +91 -95
- data/spec/templates/helpers/html_helper_spec.rb +276 -279
- data/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +16 -15
- data/spec/templates/helpers/markup/rdoc_markup_spec.rb +27 -34
- data/spec/templates/helpers/markup_helper_spec.rb +57 -57
- data/spec/templates/helpers/method_helper_spec.rb +20 -20
- data/spec/templates/helpers/shared_signature_examples.rb +33 -31
- data/spec/templates/helpers/text_helper_spec.rb +6 -6
- data/spec/templates/method_spec.rb +7 -7
- data/spec/templates/module_spec.rb +7 -7
- data/spec/templates/onefile_spec.rb +7 -7
- data/spec/templates/section_spec.rb +66 -69
- data/spec/templates/spec_helper.rb +1 -1
- data/spec/templates/tag_spec.rb +5 -5
- data/spec/templates/template_spec.rb +158 -158
- data/spec/verifier_spec.rb +52 -52
- data/templates/default/fulldoc/html/css/full_list.css +32 -31
- data/templates/default/fulldoc/html/css/style.css +212 -77
- data/templates/default/fulldoc/html/frames.erb +6 -15
- data/templates/default/fulldoc/html/full_list.erb +14 -21
- data/templates/default/fulldoc/html/full_list_class.erb +1 -1
- data/templates/default/fulldoc/html/full_list_file.erb +6 -4
- data/templates/default/fulldoc/html/full_list_method.erb +8 -6
- data/templates/default/fulldoc/html/js/app.js +100 -76
- data/templates/default/fulldoc/html/js/full_list.js +170 -135
- data/templates/default/fulldoc/html/setup.rb +50 -7
- data/templates/default/layout/html/breadcrumb.erb +0 -2
- data/templates/default/layout/html/headers.erb +2 -1
- data/templates/default/layout/html/layout.erb +16 -10
- data/templates/default/layout/html/script_setup.erb +1 -2
- data/templates/default/layout/html/search.erb +7 -2
- data/templates/default/layout/html/setup.rb +16 -0
- data/templates/default/method/html/header.erb +7 -6
- data/templates/default/module/html/attribute_summary.erb +1 -1
- data/templates/default/module/html/box_info.erb +24 -18
- data/templates/default/module/html/constant_summary.erb +9 -11
- data/templates/default/module/html/item_summary.erb +1 -1
- data/templates/default/module/html/method_summary.erb +1 -1
- data/templates/guide/fulldoc/html/setup.rb +1 -1
- data/yard.gemspec +1 -2
- metadata +10 -7
- data/spec/handlers/examples/private_class_method_handler_001.rb.txt +0 -9
- data/spec/handlers/examples/private_class_method_handler_002.rb.txt +0 -18
- data/spec/handlers/examples/private_class_method_handler_003.rb.txt +0 -11
@@ -5,20 +5,25 @@ module YARD
|
|
5
5
|
#
|
6
6
|
# @todo Implement better support for detecting binary (image) filetypes
|
7
7
|
class DisplayFileCommand < LibraryCommand
|
8
|
+
attr_accessor :index
|
9
|
+
|
8
10
|
def run
|
9
11
|
ppath = library.source_path
|
10
12
|
filename = File.cleanpath(File.join(library.source_path, path))
|
11
13
|
raise NotFoundError if !File.file?(filename)
|
12
14
|
if filename =~ /\.(jpe?g|gif|png|bmp)$/i
|
13
15
|
headers['Content-Type'] = StaticFileCommand::DefaultMimeTypes[$1.downcase] || 'text/html'
|
14
|
-
render
|
16
|
+
render File.read_binary(filename)
|
15
17
|
else
|
16
18
|
file = CodeObjects::ExtraFileObject.new(filename)
|
17
|
-
options.update
|
19
|
+
options.update :object => Registry.root,
|
20
|
+
:type => :layout,
|
21
|
+
:file => file,
|
22
|
+
:index => index ? true : false
|
18
23
|
render
|
19
24
|
end
|
20
25
|
end
|
21
26
|
end
|
22
27
|
end
|
23
28
|
end
|
24
|
-
end
|
29
|
+
end
|
@@ -8,9 +8,13 @@ module YARD
|
|
8
8
|
def run
|
9
9
|
if path.empty?
|
10
10
|
if options.readme
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
filename = options.readme.filename
|
12
|
+
opts = adapter.options.merge(
|
13
|
+
:index => true, :library => library,
|
14
|
+
:path => filename.sub(%r{^#{library.source_path.to_s}/}, ''))
|
15
|
+
self.status, self.headers, self.body =
|
16
|
+
*DisplayFileCommand.new(opts).call(request)
|
17
|
+
cache(self.body)
|
14
18
|
return
|
15
19
|
else
|
16
20
|
self.path = 'index'
|
@@ -39,19 +39,13 @@ module YARD
|
|
39
39
|
# Returns the frames URL for the page
|
40
40
|
# @return (see Templates::Helpers::HtmlHelper#url_for_frameset)
|
41
41
|
def url_for_frameset
|
42
|
-
|
43
|
-
url = url.gsub(%r{^/#{base_path(router.docs_prefix)}/}, '')
|
44
|
-
File.join('', base_path(router.docs_prefix), "frames", url)
|
42
|
+
options.file ? url_for_file(options.file) : url_for(object)
|
45
43
|
end
|
46
44
|
|
47
45
|
# Returns the main URL, first checking a readme and then linking to the index
|
48
46
|
# @return (see Templates::Helpers::HtmlHelper#url_for_main)
|
49
47
|
def url_for_main
|
50
|
-
|
51
|
-
File.join('', base_path(router.docs_prefix), options.command.path)
|
52
|
-
else
|
53
|
-
options.readme ? url_for_file(options.readme) : url_for_index
|
54
|
-
end
|
48
|
+
options.readme ? url_for_file(options.readme) : url_for_index
|
55
49
|
end
|
56
50
|
|
57
51
|
# Returns the URL for the alphabetic index page
|
@@ -1,12 +1,10 @@
|
|
1
|
-
require '
|
1
|
+
require 'cgi'
|
2
2
|
|
3
3
|
module YARD
|
4
4
|
module Server
|
5
5
|
# A custom {Serializers::Base serializer} which returns resource URLs instead of
|
6
6
|
# static relative paths to files on disk.
|
7
7
|
class DocServerSerializer < Serializers::FileSystemSerializer
|
8
|
-
include WEBrick::HTTPUtils
|
9
|
-
|
10
8
|
def initialize(command = nil)
|
11
9
|
super(:basepath => '', :extension => '')
|
12
10
|
end
|
@@ -36,7 +34,7 @@ module YARD
|
|
36
34
|
if name.respond_to?(:force_encoding)
|
37
35
|
name = name.dup.force_encoding('binary')
|
38
36
|
end
|
39
|
-
escape(name)
|
37
|
+
CGI.escape(name)
|
40
38
|
end
|
41
39
|
end
|
42
40
|
end
|
data/lib/yard/server/router.rb
CHANGED
@@ -3,19 +3,68 @@
|
|
3
3
|
#search_results ul { list-style-position: inside; padding-left: 0; list-style: none; }
|
4
4
|
#search_results ul li { padding: 7px 15px; font-size: 1.1em; }
|
5
5
|
|
6
|
-
#search_frame { z-index: 9999; }
|
7
|
-
|
8
6
|
form.search {
|
9
|
-
|
7
|
+
z-index: 8000;
|
8
|
+
position: absolute;
|
10
9
|
color: #fff;
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
border: 1px solid #99f; width: 210px; background: #05a;
|
11
|
+
border-radius: 4px; border-top-left-radius: 0; border-top-right-radius: 0;
|
12
|
+
}
|
13
|
+
form.search input {
|
14
|
+
height: 25px;
|
15
|
+
padding: 0;
|
16
|
+
padding-left: 4px;
|
17
|
+
margin: 4px;
|
18
|
+
margin-right: 0;
|
19
|
+
width: 202px;
|
20
|
+
border: 1px solid #99f;
|
21
|
+
border-radius: 3px;
|
22
|
+
font-size: 1.1em;
|
23
|
+
box-sizing: border-box;
|
24
|
+
-webkit-appearance: none;
|
25
|
+
}
|
26
|
+
|
27
|
+
@media (max-width: 920px) {
|
28
|
+
form.search {
|
29
|
+
position: absolute;
|
30
|
+
color: #fff;
|
31
|
+
width: 100%;
|
32
|
+
margin-top: 0;
|
33
|
+
background: #05a;
|
34
|
+
border-radius: 0;
|
35
|
+
border: 0;
|
36
|
+
margin-bottom: 10px;
|
37
|
+
left: 0;
|
38
|
+
top: 0;
|
39
|
+
}
|
40
|
+
form.search input {
|
41
|
+
margin-top: 9px;
|
42
|
+
margin-bottom: 11px;
|
43
|
+
margin-left: 12px;
|
44
|
+
padding-left: 6px;
|
45
|
+
border: 1px solid #eaf0ff;
|
46
|
+
}
|
47
|
+
#menu { margin-top: 41px; }
|
48
|
+
#search a {
|
49
|
+
border-top-left-radius: 3px; border-top-right-radius: 3px;
|
50
|
+
background: none;
|
51
|
+
border: 0;
|
52
|
+
box-shadow: none;
|
53
|
+
margin-top: 4px;
|
54
|
+
padding-bottom: 5px;
|
55
|
+
color: #eaf0ff; fill: #eaf0ff;
|
56
|
+
}
|
57
|
+
#search a.active {
|
58
|
+
background: #048; border: 0;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
@media (min-width: 920px) {
|
63
|
+
form.search { right: 12px; top: 0; }
|
14
64
|
}
|
15
|
-
form.search input { margin-left: 5px; width: 250px; border: 1px solid #99f; -moz-border-radius: 3px; font-family: monospace; }
|
16
65
|
|
17
66
|
#menu { padding-top: 5px; }
|
18
|
-
#content h1 { margin-top:
|
67
|
+
#content h1 { margin-top: 15px; border-top: 0; }
|
19
68
|
|
20
69
|
#content.error { font-size: 1.2em; }
|
21
70
|
#content.error p tt { font-size: 1.2em; }
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<form class="search" method="get" action="/<%= base_path(router.search_prefix) %>">
|
2
|
-
|
2
|
+
<input name="q" type="search" placeholder="Search" id="search_box" size="30" value="<%= h @query %>" />
|
3
3
|
</form>
|
4
4
|
<script type="text/javascript" charset="utf-8">
|
5
5
|
$(function() {
|
6
6
|
$('#search_box').autocomplete($('#search_box').parent().attr('action'), {
|
7
|
-
width:
|
7
|
+
width: 200,
|
8
8
|
formatItem: function(item) {
|
9
9
|
var values = item[0].split(",");
|
10
10
|
return values[0] + (values[1] == '' ? "" : " <small>(" + values[1] + ")</small>");
|
@@ -17,12 +17,6 @@
|
|
17
17
|
});
|
18
18
|
});
|
19
19
|
</script>
|
20
|
-
<style>
|
21
|
-
.frames form.search { position: absolute; right: 14px; top: -6px; padding-top: 10px; }
|
22
|
-
.frames #menu .noframes { float: none; }
|
23
|
-
.frames #menu { float: left; }
|
24
|
-
.frames #content h1 { margin-top: 15px; }
|
25
|
-
</style>
|
26
20
|
|
27
21
|
<div id="menu">
|
28
22
|
<% unless @single_library %>
|
@@ -40,7 +34,5 @@
|
|
40
34
|
<% if object != '_index.html' %><a href="<%= url_for_index %>">Index</a> » <% end %>
|
41
35
|
<span class='title'><%= @breadcrumb_title %></span>
|
42
36
|
<% end %>
|
43
|
-
|
44
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
45
37
|
</div>
|
46
38
|
|
@@ -1,8 +1,7 @@
|
|
1
1
|
<script type="text/javascript" charset="utf-8">
|
2
|
-
|
2
|
+
pathId = <%= @path ? @path.inspect : 'null' %>
|
3
3
|
relpath = '/';
|
4
4
|
docsPrefix = '<%= base_path(router.docs_prefix) %>';
|
5
5
|
listPrefix = '<%= base_path(router.list_prefix) %>';
|
6
6
|
searchPrefix = '<%= base_path(router.search_prefix) %>';
|
7
|
-
framesUrl = '<%= url_for_frameset %>';
|
8
7
|
</script>
|
@@ -1,4 +1,4 @@
|
|
1
1
|
<script>
|
2
|
-
$("
|
3
|
-
'<a class="permalink" href="/<%= base_path(router.docs_prefix) %>/<%= serializer.serialized_path(object) %>">permalink</a>');
|
4
|
-
</script>
|
2
|
+
$(document.getElementById("<%= anchor_for(object) %>")).prepend(
|
3
|
+
'<a class="permalink" href="/<%= base_path(router.docs_prefix) %>/<%= urlencode serializer.serialized_path(object) %>">permalink</a>');
|
4
|
+
</script>
|
@@ -1,8 +1,7 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
1
|
+
<!DOCTYPE html>
|
3
2
|
<html>
|
4
3
|
<head>
|
5
|
-
<meta
|
4
|
+
<meta charset="utf-8">
|
6
5
|
<link rel="stylesheet" href="/css/style.css" type="text/css" media="screen" charset="utf-8" />
|
7
6
|
<link rel="stylesheet" href="/css/custom.css" type="text/css" media="screen" charset="utf-8" />
|
8
7
|
<script type="text/javascript" charset="utf-8" src="/js/jquery.js"></script>
|
@@ -28,7 +27,8 @@
|
|
28
27
|
$(setFade);
|
29
28
|
</script>
|
30
29
|
<style type="text/css" media="screen">
|
31
|
-
body { overflow: hidden; }
|
30
|
+
body { overflow: hidden; margin: 12px; display: block; }
|
31
|
+
#menu { margin-top: 0 !important; padding-top: 0 !important; }
|
32
32
|
</style>
|
33
33
|
<title>Processing <%= @library.to_s(false) %></title>
|
34
34
|
</head>
|
data/lib/yard/tags/directives.rb
CHANGED
data/lib/yard/tags/library.rb
CHANGED
@@ -231,7 +231,6 @@ module YARD
|
|
231
231
|
meth = meth.to_s
|
232
232
|
send_name = "parse_tag" + (meth.empty? ? "" : "_" + meth)
|
233
233
|
if @factory.respond_to?(send_name)
|
234
|
-
arity = @factory.method(send_name).arity
|
235
234
|
@factory.send(send_name, tag_name, text)
|
236
235
|
else
|
237
236
|
raise NoMethodError, "Factory #{@factory.class_name} does not implement factory method :#{meth}."
|
@@ -405,6 +404,8 @@ module YARD
|
|
405
404
|
# Note that a +@param+ tag need not be defined for the options
|
406
405
|
# hash itself, though it is useful to do so for completeness.
|
407
406
|
#
|
407
|
+
# @note For keyword parameters, use +@param+, not +@option+.
|
408
|
+
#
|
408
409
|
# @example
|
409
410
|
# # @param [Hash] opts the options to create a message with.
|
410
411
|
# # @option opts [String] :subject The subject
|
@@ -424,22 +425,23 @@ module YARD
|
|
424
425
|
# @example
|
425
426
|
# # @overload set(key, value)
|
426
427
|
# # Sets a value on key
|
427
|
-
# # @param [Symbol]
|
428
|
-
# # @param [Object]
|
428
|
+
# # @param key [Symbol] describe key param
|
429
|
+
# # @param value [Object] describe value param
|
429
430
|
# # @overload set(value)
|
430
431
|
# # Sets a value on the default key +:foo+
|
431
|
-
# # @param [Object]
|
432
|
+
# # @param value [Object] describe value param
|
432
433
|
# def set(*args) end
|
433
434
|
# @yard.signature method_signature(parameters)
|
434
435
|
# Indented docstring for overload method
|
435
436
|
define_tag "Overloads", :overload, OverloadTag
|
436
437
|
|
437
|
-
# Documents a single method parameter with a given name, type
|
438
|
+
# Documents a single method parameter (either regular or keyword) with a given name, type
|
438
439
|
# and optional description.
|
439
440
|
#
|
440
441
|
# @example
|
441
|
-
# # @param [String] the URL of the page to download
|
442
|
-
#
|
442
|
+
# # @param url [String] the URL of the page to download
|
443
|
+
# # @param directory [String] the name of the directory to save to
|
444
|
+
# def load_page(url, directory: 'pages') end
|
443
445
|
define_tag "Parameters", :param, :with_types_and_name
|
444
446
|
|
445
447
|
# Declares that the _logical_ visibility of an object is private.
|
@@ -56,7 +56,10 @@ module YARD
|
|
56
56
|
# FIXME refactor this code to not make use of the Handlers::Base class (tokval_list should be moved)
|
57
57
|
toks = YARD::Parser::Ruby::Legacy::TokenList.new(args)
|
58
58
|
args = YARD::Handlers::Ruby::Legacy::Base.new(nil, nil).send(:tokval_list, toks, :all)
|
59
|
-
args.map
|
59
|
+
args = args.map do |a|
|
60
|
+
k, v = *a.split(/:|=/, 2)
|
61
|
+
[k.strip.to_s + (a[k.size, 1] == ':' ? ':' : ''), (v ? v.strip : nil)]
|
62
|
+
end if args
|
60
63
|
@name = meth.to_sym
|
61
64
|
@parameters = args
|
62
65
|
end
|
@@ -462,7 +462,7 @@ module YARD
|
|
462
462
|
elsif !type.empty?
|
463
463
|
type = link ? h(type) : format_types([type], false)
|
464
464
|
end
|
465
|
-
type = "
|
465
|
+
type = "#{type} " unless type.empty?
|
466
466
|
type
|
467
467
|
end
|
468
468
|
|
@@ -479,7 +479,8 @@ module YARD
|
|
479
479
|
meth = convert_method_to_overload(meth)
|
480
480
|
|
481
481
|
type = signature_types(meth, link)
|
482
|
-
|
482
|
+
type = "⇒ #{type}" if type && !type.empty?
|
483
|
+
scope = meth.scope == :class ? "." : "#"
|
483
484
|
name = full_attr_name ? meth.name : meth.name.to_s.gsub(/^(\w+)=$/, '\1')
|
484
485
|
blk = format_block(meth)
|
485
486
|
args = !full_attr_name && meth.writer? ? "" : format_args(meth)
|
@@ -494,7 +495,7 @@ module YARD
|
|
494
495
|
extras << meth.visibility if meth.visibility != :public
|
495
496
|
extras_text = ' <span class="extras">(' + extras.join(", ") + ')</span>' unless extras.empty?
|
496
497
|
end
|
497
|
-
title = "%s
|
498
|
+
title = "%s<strong>%s</strong>%s %s %s" % [scope, h(name), args, blk, type]
|
498
499
|
if link
|
499
500
|
if meth.is_a?(YARD::CodeObjects::MethodObject)
|
500
501
|
link_title = "#{h meth.name(true)} (#{meth.scope} #{meth.type})"
|
@@ -59,6 +59,9 @@ module YARD
|
|
59
59
|
# @return [String] the title of a given page
|
60
60
|
attr_accessor :page_title
|
61
61
|
|
62
|
+
# @return [Boolean] whether the page is the "index"
|
63
|
+
attr_accessor :index
|
64
|
+
|
62
65
|
# @example A list of mixin path names (including wildcards)
|
63
66
|
# opts.embed_mixins #=> ['ClassMethods', '*Helper', 'YARD::*']
|
64
67
|
# @return [Array<String>] an array of module name wildcards to embed into
|
data/lib/yard/version.rb
CHANGED
@@ -1,42 +1,42 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
3
|
describe YARD::CLI::CommandParser do
|
4
|
-
describe
|
4
|
+
describe "#run" do
|
5
5
|
before do
|
6
6
|
@cmd = CLI::CommandParser.new
|
7
7
|
end
|
8
8
|
|
9
|
-
it "
|
10
|
-
command =
|
11
|
-
command.
|
9
|
+
it "shows help if --help is provided" do
|
10
|
+
command = double(:command)
|
11
|
+
expect(command).to receive(:run).with('--help')
|
12
12
|
CLI::CommandParser.commands[:foo] = command
|
13
13
|
@cmd.class.default_command = :foo
|
14
14
|
@cmd.run *%w( foo --help )
|
15
15
|
end
|
16
16
|
|
17
|
-
it "
|
18
|
-
command =
|
19
|
-
command.
|
17
|
+
it "uses default command if first argument is a switch" do
|
18
|
+
command = double(:command)
|
19
|
+
expect(command).to receive(:run).with('--a', 'b', 'c')
|
20
20
|
CLI::CommandParser.commands[:foo] = command
|
21
21
|
@cmd.class.default_command = :foo
|
22
22
|
@cmd.run *%w( --a b c )
|
23
23
|
end
|
24
24
|
|
25
|
-
it "
|
26
|
-
command =
|
27
|
-
command.
|
25
|
+
it "uses default command if no arguments are provided" do
|
26
|
+
command = double(:command)
|
27
|
+
expect(command).to receive(:run)
|
28
28
|
CLI::CommandParser.commands[:foo] = command
|
29
29
|
@cmd.class.default_command = :foo
|
30
30
|
@cmd.run
|
31
31
|
end
|
32
32
|
|
33
|
-
it "
|
34
|
-
@cmd.
|
33
|
+
it "lists commands if command is not found" do
|
34
|
+
expect(@cmd).to receive(:list_commands)
|
35
35
|
@cmd.run *%w( unknown_command --args )
|
36
36
|
end
|
37
37
|
|
38
|
-
it "
|
39
|
-
@cmd.
|
38
|
+
it "lists commands if --help is provided as sole argument" do
|
39
|
+
expect(@cmd).to receive(:list_commands)
|
40
40
|
@cmd.run *%w( --help )
|
41
41
|
end
|
42
42
|
end
|
data/spec/cli/command_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + "/../spec_helper"
|
|
2
2
|
require 'optparse'
|
3
3
|
|
4
4
|
describe YARD::CLI::Command do
|
5
|
-
describe
|
5
|
+
describe "#parse_options" do
|
6
6
|
before do
|
7
7
|
@options = OptionParser.new
|
8
8
|
@saw_foo = false
|
@@ -14,23 +14,23 @@ describe YARD::CLI::Command do
|
|
14
14
|
args
|
15
15
|
end
|
16
16
|
|
17
|
-
it "
|
18
|
-
log.
|
19
|
-
log.
|
17
|
+
it "skips unrecognized options but continue to next option" do
|
18
|
+
expect(log).to receive(:warn).with(/Unrecognized.*--list/)
|
19
|
+
expect(log).to receive(:warn).with(/Unrecognized.*--list2/)
|
20
20
|
parse('--list', '--list2', '--foo')
|
21
|
-
@saw_foo.
|
21
|
+
expect(@saw_foo).to be true
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
25
|
-
log.
|
24
|
+
it "skips unrecognized options and any extra non-option arg that follows" do
|
25
|
+
expect(log).to receive(:warn).with(/Unrecognized.*--list/)
|
26
26
|
parse('--list', 'foo', '--foo')
|
27
|
-
@saw_foo.
|
27
|
+
expect(@saw_foo).to be true
|
28
28
|
end
|
29
29
|
|
30
|
-
it "
|
31
|
-
log.
|
30
|
+
it "stops retrying to parse at non-switch argument" do
|
31
|
+
expect(log).to receive(:warn).with(/Unrecognized.*--list/)
|
32
32
|
args = parse('--list', 'foo', 'foo', 'foo')
|
33
|
-
args.
|
33
|
+
expect(args).to eq %w(foo foo)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|