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.

Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -1
  3. data/LICENSE +2 -2
  4. data/README.md +2 -2
  5. data/Rakefile +1 -1
  6. data/bin/yard +0 -0
  7. data/bin/yardoc +0 -0
  8. data/bin/yri +0 -0
  9. data/docs/GettingStarted.md +88 -6
  10. data/docs/images/handlers-class-diagram.png +0 -0
  11. data/docs/images/overview-class-diagram.png +0 -0
  12. data/docs/images/parser-class-diagram.png +0 -0
  13. data/docs/templates/default/fulldoc/html/full_list_tag.erb +6 -4
  14. data/lib/yard/autoload.rb +3 -0
  15. data/lib/yard/cli/yardoc.rb +1 -1
  16. data/lib/yard/code_objects/base.rb +4 -1
  17. data/lib/yard/code_objects/extra_file_object.rb +3 -1
  18. data/lib/yard/code_objects/proxy.rb +2 -2
  19. data/lib/yard/docstring.rb +11 -6
  20. data/lib/yard/handlers/base.rb +1 -2
  21. data/lib/yard/handlers/c/base.rb +19 -0
  22. data/lib/yard/handlers/c/handler_methods.rb +42 -8
  23. data/lib/yard/handlers/c/init_handler.rb +1 -1
  24. data/lib/yard/handlers/c/method_handler.rb +3 -3
  25. data/lib/yard/handlers/ruby/decorator_handler_methods.rb +132 -0
  26. data/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb +1 -1
  27. data/lib/yard/handlers/ruby/private_class_method_handler.rb +6 -39
  28. data/lib/yard/handlers/ruby/private_constant_handler.rb +36 -30
  29. data/lib/yard/handlers/ruby/public_class_method_handler.rb +13 -0
  30. data/lib/yard/handlers/ruby/struct_handler_methods.rb +1 -0
  31. data/lib/yard/handlers/ruby/visibility_handler.rb +5 -8
  32. data/lib/yard/logging.rb +1 -0
  33. data/lib/yard/parser/ruby/ruby_parser.rb +2 -2
  34. data/lib/yard/parser/source_parser.rb +6 -6
  35. data/lib/yard/rake/yardoc_task.rb +2 -2
  36. data/lib/yard/serializers/file_system_serializer.rb +33 -1
  37. data/lib/yard/server/commands/display_file_command.rb +8 -3
  38. data/lib/yard/server/commands/display_object_command.rb +7 -3
  39. data/lib/yard/server/doc_server_helper.rb +2 -8
  40. data/lib/yard/server/doc_server_serializer.rb +2 -4
  41. data/lib/yard/server/router.rb +1 -1
  42. data/lib/yard/server/templates/default/fulldoc/html/css/custom.css +57 -8
  43. data/lib/yard/server/templates/default/layout/html/breadcrumb.erb +2 -10
  44. data/lib/yard/server/templates/default/layout/html/script_setup.erb +1 -2
  45. data/lib/yard/server/templates/default/method_details/html/permalink.erb +3 -3
  46. data/lib/yard/server/templates/doc_server/processing/html/processing.erb +4 -4
  47. data/lib/yard/tags/directives.rb +1 -0
  48. data/lib/yard/tags/library.rb +9 -7
  49. data/lib/yard/tags/overload_tag.rb +4 -1
  50. data/lib/yard/templates/helpers/html_helper.rb +4 -3
  51. data/lib/yard/templates/template_options.rb +3 -0
  52. data/lib/yard/version.rb +1 -1
  53. data/spec/cli/command_parser_spec.rb +14 -14
  54. data/spec/cli/command_spec.rb +11 -11
  55. data/spec/cli/config_spec.rb +32 -32
  56. data/spec/cli/diff_spec.rb +86 -90
  57. data/spec/cli/display_spec.rb +6 -6
  58. data/spec/cli/gems_spec.rb +28 -28
  59. data/spec/cli/graph_spec.rb +8 -8
  60. data/spec/cli/help_spec.rb +8 -8
  61. data/spec/cli/i18n_spec.rb +33 -37
  62. data/spec/cli/list_spec.rb +2 -2
  63. data/spec/cli/markup_types_spec.rb +3 -3
  64. data/spec/cli/server_spec.rb +74 -88
  65. data/spec/cli/stats_spec.rb +14 -14
  66. data/spec/cli/yardoc_spec.rb +316 -321
  67. data/spec/cli/yri_spec.rb +45 -45
  68. data/spec/code_objects/base_spec.rb +174 -173
  69. data/spec/code_objects/class_object_spec.rb +65 -65
  70. data/spec/code_objects/code_object_list_spec.rb +13 -11
  71. data/spec/code_objects/constants_spec.rb +68 -58
  72. data/spec/code_objects/extra_file_object_spec.rb +71 -59
  73. data/spec/code_objects/macro_object_spec.rb +64 -64
  74. data/spec/code_objects/method_object_spec.rb +80 -72
  75. data/spec/code_objects/module_object_spec.rb +47 -47
  76. data/spec/code_objects/namespace_object_spec.rb +51 -51
  77. data/spec/code_objects/proxy_spec.rb +54 -54
  78. data/spec/config_spec.rb +104 -104
  79. data/spec/core_ext/array_spec.rb +5 -5
  80. data/spec/core_ext/file_spec.rb +33 -33
  81. data/spec/core_ext/hash_spec.rb +5 -5
  82. data/spec/core_ext/insertion_spec.rb +18 -18
  83. data/spec/core_ext/module_spec.rb +6 -6
  84. data/spec/core_ext/string_spec.rb +17 -17
  85. data/spec/core_ext/symbol_hash_spec.rb +42 -39
  86. data/spec/docstring_parser_spec.rb +65 -65
  87. data/spec/docstring_spec.rb +137 -130
  88. data/spec/handlers/alias_handler_spec.rb +39 -39
  89. data/spec/handlers/attribute_handler_spec.rb +35 -35
  90. data/spec/handlers/base_spec.rb +60 -51
  91. data/spec/handlers/c/alias_handler_spec.rb +6 -6
  92. data/spec/handlers/c/attribute_handler_spec.rb +12 -12
  93. data/spec/handlers/c/class_handler_spec.rb +35 -22
  94. data/spec/handlers/c/constant_handler_spec.rb +24 -22
  95. data/spec/handlers/c/init_handler_spec.rb +10 -10
  96. data/spec/handlers/c/method_handler_spec.rb +150 -65
  97. data/spec/handlers/c/mixin_handler_spec.rb +5 -5
  98. data/spec/handlers/c/module_handler_spec.rb +27 -15
  99. data/spec/handlers/c/override_comment_handler_spec.rb +14 -14
  100. data/spec/handlers/c/path_handler_spec.rb +8 -8
  101. data/spec/handlers/c/spec_helper.rb +10 -0
  102. data/spec/handlers/c/struct_handler_spec.rb +3 -3
  103. data/spec/handlers/class_condition_handler_spec.rb +18 -18
  104. data/spec/handlers/class_handler_spec.rb +97 -97
  105. data/spec/handlers/class_method_handler_shared_examples.rb +132 -0
  106. data/spec/handlers/class_variable_handler_spec.rb +3 -3
  107. data/spec/handlers/constant_handler_spec.rb +32 -29
  108. data/spec/handlers/decorator_handler_methods_spec.rb +405 -0
  109. data/spec/handlers/dsl_handler_spec.rb +108 -109
  110. data/spec/handlers/examples/constant_handler_001.rb.txt +4 -1
  111. data/spec/handlers/examples/visibility_handler_001.rb.txt +4 -0
  112. data/spec/handlers/exception_handler_spec.rb +23 -23
  113. data/spec/handlers/extend_handler_spec.rb +9 -9
  114. data/spec/handlers/legacy_base_spec.rb +60 -60
  115. data/spec/handlers/method_condition_handler_spec.rb +5 -5
  116. data/spec/handlers/method_handler_spec.rb +92 -92
  117. data/spec/handlers/mixin_handler_spec.rb +25 -25
  118. data/spec/handlers/module_function_handler_spec.rb +24 -24
  119. data/spec/handlers/module_handler_spec.rb +15 -15
  120. data/spec/handlers/private_class_method_handler_spec.rb +4 -48
  121. data/spec/handlers/private_constant_handler_spec.rb +8 -8
  122. data/spec/handlers/processor_spec.rb +12 -12
  123. data/spec/handlers/public_class_method_handler_spec.rb +10 -0
  124. data/spec/handlers/ruby/base_spec.rb +16 -16
  125. data/spec/handlers/ruby/legacy/base_spec.rb +20 -18
  126. data/spec/handlers/spec_helper.rb +1 -1
  127. data/spec/handlers/visibility_handler_spec.rb +25 -21
  128. data/spec/handlers/yield_handler_spec.rb +28 -28
  129. data/spec/i18n/locale_spec.rb +16 -16
  130. data/spec/i18n/message_spec.rb +8 -8
  131. data/spec/i18n/messages_spec.rb +14 -14
  132. data/spec/i18n/pot_generator_spec.rb +32 -32
  133. data/spec/i18n/text_spec.rb +22 -22
  134. data/spec/logging_spec.rb +12 -12
  135. data/spec/options_spec.rb +56 -56
  136. data/spec/parser/base_spec.rb +9 -9
  137. data/spec/parser/c_parser_spec.rb +50 -50
  138. data/spec/parser/ruby/ast_node_spec.rb +7 -7
  139. data/spec/parser/ruby/legacy/statement_list_spec.rb +106 -106
  140. data/spec/parser/ruby/legacy/token_list_spec.rb +27 -27
  141. data/spec/parser/ruby/ruby_parser_spec.rb +123 -113
  142. data/spec/parser/source_parser_spec.rb +224 -224
  143. data/spec/parser/tag_parsing_spec.rb +6 -7
  144. data/spec/rake/yardoc_task_spec.rb +38 -48
  145. data/spec/registry_spec.rb +143 -143
  146. data/spec/registry_store_spec.rb +165 -165
  147. data/spec/rubygems/doc_manager_spec.rb +38 -38
  148. data/spec/serializers/file_system_serializer_spec.rb +53 -33
  149. data/spec/serializers/yardoc_serializer_spec.rb +15 -15
  150. data/spec/server/adapter_spec.rb +15 -15
  151. data/spec/server/commands/base_spec.rb +29 -29
  152. data/spec/server/commands/library_command_spec.rb +12 -12
  153. data/spec/server/commands/static_file_command_spec.rb +28 -28
  154. data/spec/server/doc_server_helper_spec.rb +8 -8
  155. data/spec/server/doc_server_serializer_spec.rb +23 -18
  156. data/spec/server/rack_adapter_spec.rb +6 -6
  157. data/spec/server/router_spec.rb +39 -39
  158. data/spec/server/static_caching_spec.rb +16 -16
  159. data/spec/server/webrick_servlet_spec.rb +6 -7
  160. data/spec/server_spec.rb +3 -3
  161. data/spec/spec_helper.rb +11 -2
  162. data/spec/tags/default_factory_spec.rb +64 -64
  163. data/spec/tags/default_tag_spec.rb +5 -5
  164. data/spec/tags/directives_spec.rb +121 -121
  165. data/spec/tags/library_spec.rb +14 -14
  166. data/spec/tags/overload_tag_spec.rb +24 -24
  167. data/spec/tags/ref_tag_list_spec.rb +12 -12
  168. data/spec/templates/class_spec.rb +3 -3
  169. data/spec/templates/constant_spec.rb +4 -4
  170. data/spec/templates/engine_spec.rb +47 -48
  171. data/spec/templates/examples/class001.html +129 -101
  172. data/spec/templates/examples/class002.html +31 -27
  173. data/spec/templates/examples/method001.html +54 -47
  174. data/spec/templates/examples/method002.html +33 -28
  175. data/spec/templates/examples/method003.html +70 -64
  176. data/spec/templates/examples/method004.html +13 -9
  177. data/spec/templates/examples/method005.html +38 -32
  178. data/spec/templates/examples/module001.html +343 -339
  179. data/spec/templates/examples/module002.html +147 -124
  180. data/spec/templates/examples/module003.html +94 -81
  181. data/spec/templates/examples/module004.html +40 -33
  182. data/spec/templates/helpers/base_helper_spec.rb +91 -95
  183. data/spec/templates/helpers/html_helper_spec.rb +276 -279
  184. data/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +16 -15
  185. data/spec/templates/helpers/markup/rdoc_markup_spec.rb +27 -34
  186. data/spec/templates/helpers/markup_helper_spec.rb +57 -57
  187. data/spec/templates/helpers/method_helper_spec.rb +20 -20
  188. data/spec/templates/helpers/shared_signature_examples.rb +33 -31
  189. data/spec/templates/helpers/text_helper_spec.rb +6 -6
  190. data/spec/templates/method_spec.rb +7 -7
  191. data/spec/templates/module_spec.rb +7 -7
  192. data/spec/templates/onefile_spec.rb +7 -7
  193. data/spec/templates/section_spec.rb +66 -69
  194. data/spec/templates/spec_helper.rb +1 -1
  195. data/spec/templates/tag_spec.rb +5 -5
  196. data/spec/templates/template_spec.rb +158 -158
  197. data/spec/verifier_spec.rb +52 -52
  198. data/templates/default/fulldoc/html/css/full_list.css +32 -31
  199. data/templates/default/fulldoc/html/css/style.css +212 -77
  200. data/templates/default/fulldoc/html/frames.erb +6 -15
  201. data/templates/default/fulldoc/html/full_list.erb +14 -21
  202. data/templates/default/fulldoc/html/full_list_class.erb +1 -1
  203. data/templates/default/fulldoc/html/full_list_file.erb +6 -4
  204. data/templates/default/fulldoc/html/full_list_method.erb +8 -6
  205. data/templates/default/fulldoc/html/js/app.js +100 -76
  206. data/templates/default/fulldoc/html/js/full_list.js +170 -135
  207. data/templates/default/fulldoc/html/setup.rb +50 -7
  208. data/templates/default/layout/html/breadcrumb.erb +0 -2
  209. data/templates/default/layout/html/headers.erb +2 -1
  210. data/templates/default/layout/html/layout.erb +16 -10
  211. data/templates/default/layout/html/script_setup.erb +1 -2
  212. data/templates/default/layout/html/search.erb +7 -2
  213. data/templates/default/layout/html/setup.rb +16 -0
  214. data/templates/default/method/html/header.erb +7 -6
  215. data/templates/default/module/html/attribute_summary.erb +1 -1
  216. data/templates/default/module/html/box_info.erb +24 -18
  217. data/templates/default/module/html/constant_summary.erb +9 -11
  218. data/templates/default/module/html/item_summary.erb +1 -1
  219. data/templates/default/module/html/method_summary.erb +1 -1
  220. data/templates/guide/fulldoc/html/setup.rb +1 -1
  221. data/yard.gemspec +1 -2
  222. metadata +10 -7
  223. data/spec/handlers/examples/private_class_method_handler_001.rb.txt +0 -9
  224. data/spec/handlers/examples/private_class_method_handler_002.rb.txt +0 -18
  225. 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 IO.read(filename)
16
+ render File.read_binary(filename)
15
17
  else
16
18
  file = CodeObjects::ExtraFileObject.new(filename)
17
- options.update(:object => Registry.root, :type => :layout, :file => file)
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
- url = url_for_file(options.readme)
12
- self.status, self.headers, self.body = *router.send(:route, url)
13
- cache(body.first)
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
- url = options.file ? url_for_file(options.file) : url_for(object)
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
- if options.frames && !options.command.path.empty?
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 'webrick/httputils'
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
@@ -124,7 +124,7 @@ module YARD
124
124
  case paths.first
125
125
  when "frames"
126
126
  paths.shift
127
- cmd = FramesCommand
127
+ cmd = DisplayObjectCommand
128
128
  when "file"
129
129
  paths.shift
130
130
  cmd = DisplayFileCommand
@@ -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
- position: relative;
7
+ z-index: 8000;
8
+ position: absolute;
10
9
  color: #fff;
11
- margin-top: 3px; padding: 7px; border: 1px solid #99f; width: 315px; background: #05a;
12
- -moz-border-radius: 4px; -webkit-border-radius: 4px;
13
- margin-bottom: 10px;
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: 0; border-top: 0; }
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
- Search: <input name="q" type="search" placeholder="Search" id="search_box" size="30" value="<%= h @query %>" />
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: document.body.className == 'frames' ? 250 : 340,
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> &raquo; <% 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
- hasFrames = window.top.frames.main ? true : false;
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
- $("#<%= anchor_for(object) %>").prepend(
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 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1
+ <!DOCTYPE html>
3
2
  <html>
4
3
  <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
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>
@@ -479,6 +479,7 @@ module YARD
479
479
  writer.source = object.source
480
480
  writer.group = object.group
481
481
  writer.parameters = [['value', nil]]
482
+ writer.docstring = object.base_docstring
482
483
  handler.register_file_info(writer)
483
484
  end
484
485
  attrs[clean_name][:write] = writer
@@ -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] key describe key param
428
- # # @param [Object] value describe value param
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] value describe value param
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
- # def load_page(url) end
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! {|a| k, v = *a.split('=', 2); [k.strip.to_s, (v ? v.strip : nil)] } if args
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 = "(#{type}) " unless type.empty?
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
- scope = meth.scope == :class ? "+" : "-"
482
+ type = "&#x21d2; #{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 %s<strong>%s</strong>%s %s" % [scope, type, h(name), args, blk]
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
@@ -1,3 +1,3 @@
1
1
  module YARD
2
- VERSION = '0.8.7.6'
2
+ VERSION = '0.9.0'
3
3
  end
@@ -1,42 +1,42 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  describe YARD::CLI::CommandParser do
4
- describe '#run' do
4
+ describe "#run" do
5
5
  before do
6
6
  @cmd = CLI::CommandParser.new
7
7
  end
8
8
 
9
- it "should show help if --help is provided" do
10
- command = mock(:command)
11
- command.should_receive(:run).with('--help')
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 "should use default command if first argument is a switch" do
18
- command = mock(:command)
19
- command.should_receive(:run).with('--a', 'b', 'c')
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 "should use default command if no arguments are provided" do
26
- command = mock(:command)
27
- command.should_receive(:run)
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 "should list commands if command is not found" do
34
- @cmd.should_receive(:list_commands)
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 "should list commands if --help is provided as sole argument" do
39
- @cmd.should_receive(:list_commands)
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
@@ -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 '#parse_options' do
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 "should skip unrecognized options but continue to next option" do
18
- log.should_receive(:warn).with(/Unrecognized.*--list/)
19
- log.should_receive(:warn).with(/Unrecognized.*--list2/)
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.should be_true
21
+ expect(@saw_foo).to be true
22
22
  end
23
23
 
24
- it "should skip unrecognized options and any extra non-option arg that follows" do
25
- log.should_receive(:warn).with(/Unrecognized.*--list/)
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.should be_true
27
+ expect(@saw_foo).to be true
28
28
  end
29
29
 
30
- it "should stop retrying to parse at non-switch argument" do
31
- log.should_receive(:warn).with(/Unrecognized.*--list/)
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.should == %w(foo foo)
33
+ expect(args).to eq %w(foo foo)
34
34
  end
35
35
  end
36
36
  end