yard 0.5.8 → 0.6.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 (211) hide show
  1. data/.yardopts +2 -0
  2. data/ChangeLog +1064 -0
  3. data/README.md +103 -42
  4. data/Rakefile +3 -2
  5. data/benchmarks/parsing.rb +2 -1
  6. data/bin/yard +4 -0
  7. data/bin/yard-graph +1 -1
  8. data/bin/yard-server +4 -0
  9. data/docs/GettingStarted.md +8 -8
  10. data/docs/Handlers.md +5 -5
  11. data/docs/Overview.md +5 -5
  12. data/docs/Parser.md +1 -1
  13. data/docs/Tags.md +1 -1
  14. data/docs/Templates.md +27 -6
  15. data/docs/WhatsNew.md +222 -2
  16. data/lib/rubygems_plugin.rb +1 -0
  17. data/lib/yard.rb +7 -1
  18. data/lib/yard/autoload.rb +46 -6
  19. data/lib/yard/cli/{base.rb → command.rb} +20 -6
  20. data/lib/yard/cli/command_parser.rb +87 -0
  21. data/lib/yard/cli/diff.rb +176 -0
  22. data/lib/yard/cli/gems.rb +74 -0
  23. data/lib/yard/cli/{yard_graph.rb → graph.rb} +9 -8
  24. data/lib/yard/cli/help.rb +18 -0
  25. data/lib/yard/cli/server.rb +137 -0
  26. data/lib/yard/cli/stats.rb +210 -0
  27. data/lib/yard/cli/yardoc.rb +315 -116
  28. data/lib/yard/cli/yri.rb +45 -4
  29. data/lib/yard/code_objects/base.rb +73 -30
  30. data/lib/yard/code_objects/class_object.rb +9 -1
  31. data/lib/yard/code_objects/method_object.rb +11 -0
  32. data/lib/yard/code_objects/namespace_object.rb +8 -2
  33. data/lib/yard/code_objects/proxy.rb +2 -2
  34. data/lib/yard/core_ext/array.rb +3 -49
  35. data/lib/yard/core_ext/file.rb +7 -0
  36. data/lib/yard/core_ext/insertion.rb +60 -0
  37. data/lib/yard/docstring.rb +34 -7
  38. data/lib/yard/globals.rb +2 -2
  39. data/lib/yard/handlers/base.rb +101 -20
  40. data/lib/yard/handlers/processor.rb +23 -7
  41. data/lib/yard/handlers/ruby/alias_handler.rb +1 -0
  42. data/lib/yard/handlers/ruby/attribute_handler.rb +8 -0
  43. data/lib/yard/handlers/ruby/base.rb +71 -2
  44. data/lib/yard/handlers/ruby/class_condition_handler.rb +10 -0
  45. data/lib/yard/handlers/ruby/class_handler.rb +7 -4
  46. data/lib/yard/handlers/ruby/class_variable_handler.rb +1 -0
  47. data/lib/yard/handlers/ruby/constant_handler.rb +1 -0
  48. data/lib/yard/handlers/ruby/exception_handler.rb +1 -0
  49. data/lib/yard/handlers/ruby/extend_handler.rb +2 -3
  50. data/lib/yard/handlers/ruby/legacy/alias_handler.rb +1 -0
  51. data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +2 -0
  52. data/lib/yard/handlers/ruby/legacy/base.rb +15 -2
  53. data/lib/yard/handlers/ruby/legacy/class_condition_handler.rb +5 -0
  54. data/lib/yard/handlers/ruby/legacy/class_handler.rb +7 -4
  55. data/lib/yard/handlers/ruby/legacy/class_variable_handler.rb +1 -0
  56. data/lib/yard/handlers/ruby/legacy/constant_handler.rb +1 -0
  57. data/lib/yard/handlers/ruby/legacy/exception_handler.rb +1 -0
  58. data/lib/yard/handlers/ruby/legacy/extend_handler.rb +1 -3
  59. data/lib/yard/handlers/ruby/legacy/method_handler.rb +7 -3
  60. data/lib/yard/handlers/ruby/legacy/mixin_handler.rb +2 -1
  61. data/lib/yard/handlers/ruby/legacy/module_handler.rb +1 -0
  62. data/lib/yard/handlers/ruby/legacy/process_handler.rb +1 -0
  63. data/lib/yard/handlers/ruby/legacy/visibility_handler.rb +1 -0
  64. data/lib/yard/handlers/ruby/legacy/yield_handler.rb +1 -0
  65. data/lib/yard/handlers/ruby/method_condition_handler.rb +1 -0
  66. data/lib/yard/handlers/ruby/method_handler.rb +5 -1
  67. data/lib/yard/handlers/ruby/mixin_handler.rb +2 -1
  68. data/lib/yard/handlers/ruby/module_handler.rb +1 -0
  69. data/lib/yard/handlers/ruby/process_handler.rb +7 -1
  70. data/lib/yard/handlers/ruby/struct_handler_methods.rb +3 -0
  71. data/lib/yard/handlers/ruby/visibility_handler.rb +8 -2
  72. data/lib/yard/handlers/ruby/yield_handler.rb +1 -0
  73. data/lib/yard/logging.rb +7 -1
  74. data/lib/yard/parser/base.rb +1 -0
  75. data/lib/yard/parser/c_parser.rb +2 -0
  76. data/lib/yard/parser/ruby/ast_node.rb +82 -63
  77. data/lib/yard/parser/ruby/legacy/ruby_lex.rb +36 -10
  78. data/lib/yard/parser/ruby/legacy/ruby_parser.rb +1 -0
  79. data/lib/yard/parser/ruby/legacy/statement.rb +9 -5
  80. data/lib/yard/parser/ruby/legacy/statement_list.rb +20 -11
  81. data/lib/yard/parser/ruby/ruby_parser.rb +18 -1
  82. data/lib/yard/parser/source_parser.rb +6 -1
  83. data/lib/yard/registry.rb +284 -278
  84. data/lib/yard/registry_store.rb +4 -2
  85. data/lib/yard/serializers/base.rb +30 -13
  86. data/lib/yard/serializers/file_system_serializer.rb +10 -1
  87. data/lib/yard/server/adapter.rb +51 -0
  88. data/lib/yard/server/commands/base.rb +98 -0
  89. data/lib/yard/server/commands/display_file_command.rb +20 -0
  90. data/lib/yard/server/commands/display_object_command.rb +50 -0
  91. data/lib/yard/server/commands/frames_command.rb +31 -0
  92. data/lib/yard/server/commands/library_command.rb +83 -0
  93. data/lib/yard/server/commands/library_index_command.rb +23 -0
  94. data/lib/yard/server/commands/list_command.rb +44 -0
  95. data/lib/yard/server/commands/search_command.rb +67 -0
  96. data/lib/yard/server/commands/static_file_command.rb +45 -0
  97. data/lib/yard/server/doc_server_helper.rb +22 -0
  98. data/lib/yard/server/doc_server_serializer.rb +29 -0
  99. data/lib/yard/server/library_version.rb +86 -0
  100. data/lib/yard/server/rack_adapter.rb +38 -0
  101. data/lib/yard/server/router.rb +110 -0
  102. data/lib/yard/server/static_caching.rb +16 -0
  103. data/lib/yard/server/templates/default/fulldoc/html/css/custom.css +78 -0
  104. data/lib/yard/server/templates/default/fulldoc/html/images/processing.gif +0 -0
  105. data/lib/yard/server/templates/default/fulldoc/html/js/autocomplete.js +12 -0
  106. data/lib/yard/server/templates/default/fulldoc/html/js/live.js +32 -0
  107. data/lib/yard/server/templates/default/layout/html/breadcrumb.erb +46 -0
  108. data/lib/yard/server/templates/default/layout/html/headers.erb +11 -0
  109. data/lib/yard/server/templates/doc_server/frames/html/frames.erb +13 -0
  110. data/lib/yard/server/templates/doc_server/frames/html/setup.rb +3 -0
  111. data/lib/yard/server/templates/doc_server/full_list/html/full_list.erb +34 -0
  112. data/lib/yard/server/templates/doc_server/full_list/html/setup.rb +10 -0
  113. data/lib/yard/server/templates/doc_server/library_list/html/contents.erb +13 -0
  114. data/lib/yard/server/templates/doc_server/library_list/html/headers.erb +26 -0
  115. data/lib/yard/server/templates/doc_server/library_list/html/library_list.erb +12 -0
  116. data/lib/yard/server/templates/doc_server/library_list/html/setup.rb +3 -0
  117. data/lib/yard/server/templates/doc_server/library_list/html/title.erb +2 -0
  118. data/lib/yard/server/templates/doc_server/processing/html/processing.erb +51 -0
  119. data/lib/yard/server/templates/doc_server/processing/html/setup.rb +3 -0
  120. data/lib/yard/server/templates/doc_server/search/html/search.erb +19 -0
  121. data/lib/yard/server/templates/doc_server/search/html/setup.rb +8 -0
  122. data/lib/yard/server/webrick_adapter.rb +38 -0
  123. data/lib/yard/tags/default_factory.rb +0 -5
  124. data/lib/yard/tags/library.rb +61 -22
  125. data/lib/yard/tags/tag.rb +26 -4
  126. data/lib/yard/templates/engine.rb +12 -1
  127. data/lib/yard/templates/erb_cache.rb +2 -1
  128. data/lib/yard/templates/helpers/base_helper.rb +96 -3
  129. data/lib/yard/templates/helpers/filter_helper.rb +5 -0
  130. data/lib/yard/templates/helpers/html_helper.rb +204 -94
  131. data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +4 -0
  132. data/lib/yard/templates/helpers/markup_helper.rb +58 -3
  133. data/lib/yard/templates/helpers/method_helper.rb +7 -0
  134. data/lib/yard/templates/helpers/module_helper.rb +5 -0
  135. data/lib/yard/templates/helpers/text_helper.rb +10 -1
  136. data/lib/yard/templates/helpers/uml_helper.rb +13 -0
  137. data/lib/yard/templates/section.rb +106 -0
  138. data/lib/yard/templates/template.rb +20 -19
  139. data/lib/yard/verifier.rb +21 -2
  140. data/spec/cli/command_parser_spec.rb +43 -0
  141. data/spec/cli/diff_spec.rb +170 -0
  142. data/spec/cli/help_spec.rb +22 -0
  143. data/spec/cli/server_spec.rb +140 -0
  144. data/spec/cli/stats_spec.rb +75 -0
  145. data/spec/cli/yardoc_spec.rb +438 -182
  146. data/spec/cli/yri_spec.rb +13 -1
  147. data/spec/code_objects/base_spec.rb +51 -6
  148. data/spec/code_objects/class_object_spec.rb +15 -1
  149. data/spec/code_objects/method_object_spec.rb +29 -0
  150. data/spec/code_objects/namespace_object_spec.rb +150 -129
  151. data/spec/core_ext/array_spec.rb +4 -23
  152. data/spec/core_ext/insertion_spec.rb +37 -0
  153. data/spec/docstring_spec.rb +63 -0
  154. data/spec/handlers/attribute_handler_spec.rb +4 -0
  155. data/spec/handlers/base_spec.rb +98 -26
  156. data/spec/handlers/class_handler_spec.rb +5 -1
  157. data/spec/handlers/examples/attribute_handler_001.rb.txt +5 -0
  158. data/spec/handlers/examples/class_handler_001.rb.txt +4 -0
  159. data/spec/handlers/examples/module_handler_001.rb.txt +6 -1
  160. data/spec/handlers/examples/visibility_handler_001.rb.txt +4 -0
  161. data/spec/handlers/method_handler_spec.rb +5 -0
  162. data/spec/handlers/module_handler_spec.rb +4 -0
  163. data/spec/handlers/visibility_handler_spec.rb +6 -0
  164. data/spec/parser/source_parser_spec.rb +24 -0
  165. data/spec/registry_spec.rb +44 -8
  166. data/spec/server/adapter_spec.rb +38 -0
  167. data/spec/server/commands/base_spec.rb +87 -0
  168. data/spec/server/commands/static_file_command_spec.rb +67 -0
  169. data/spec/server/doc_server_serializer_spec.rb +58 -0
  170. data/spec/server/router_spec.rb +115 -0
  171. data/spec/server/spec_helper.rb +17 -0
  172. data/spec/server/static_caching_spec.rb +39 -0
  173. data/spec/server/webrick_servlet_spec.rb +20 -0
  174. data/spec/templates/constant_spec.rb +40 -0
  175. data/spec/templates/engine_spec.rb +9 -5
  176. data/spec/templates/examples/class002.html +1 -3
  177. data/spec/templates/examples/constant001.txt +25 -0
  178. data/spec/templates/examples/constant002.txt +7 -0
  179. data/spec/templates/examples/constant003.txt +11 -0
  180. data/spec/templates/examples/module001.txt +1 -1
  181. data/spec/templates/examples/module002.html +319 -0
  182. data/spec/templates/helpers/base_helper_spec.rb +2 -2
  183. data/spec/templates/helpers/html_helper_spec.rb +93 -3
  184. data/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +5 -0
  185. data/spec/templates/helpers/markup_helper_spec.rb +94 -67
  186. data/spec/templates/helpers/shared_signature_examples.rb +9 -0
  187. data/spec/templates/helpers/text_helper_spec.rb +12 -0
  188. data/spec/templates/module_spec.rb +21 -4
  189. data/spec/templates/section_spec.rb +146 -0
  190. data/spec/templates/template_spec.rb +9 -20
  191. data/templates/default/class/setup.rb +5 -5
  192. data/templates/default/constant/text/header.erb +11 -0
  193. data/templates/default/constant/text/setup.rb +3 -0
  194. data/templates/default/fulldoc/html/css/style.css +29 -3
  195. data/templates/default/fulldoc/html/js/app.js +67 -1
  196. data/templates/default/fulldoc/html/js/full_list.js +3 -8
  197. data/templates/default/fulldoc/html/js/jquery.js +150 -15
  198. data/templates/default/fulldoc/html/setup.rb +9 -0
  199. data/templates/default/layout/html/footer.erb +1 -1
  200. data/templates/default/layout/html/setup.rb +7 -25
  201. data/templates/default/method_details/html/source.erb +1 -1
  202. data/templates/default/module/html/attribute_summary.erb +2 -2
  203. data/templates/default/module/html/method_summary.erb +2 -2
  204. data/templates/default/module/setup.rb +27 -4
  205. data/templates/default/onefile/html/files.erb +5 -0
  206. data/templates/default/onefile/html/layout.erb +22 -0
  207. data/templates/default/onefile/html/readme.erb +3 -0
  208. data/templates/default/onefile/html/setup.rb +40 -0
  209. data/templates/default/root/html/setup.rb +1 -0
  210. data/templates/default/tags/setup.rb +26 -33
  211. metadata +80 -10
@@ -6,6 +6,7 @@ def init
6
6
  options[:readme] = options[:files].first
7
7
  options[:title] ||= "Documentation by YARD #{YARD::VERSION}"
8
8
 
9
+ return serialize_onefile if options[:onefile]
9
10
  generate_assets
10
11
  serialize('_index.html')
11
12
  options[:files].each_with_index do |file, i|
@@ -34,6 +35,14 @@ def serialize(object)
34
35
  end
35
36
  end
36
37
 
38
+ def serialize_onefile
39
+ options[:css_data] = file('css/style.css', true) + "\n" + file('css/common.css', true)
40
+ options[:js_data] = file('js/jquery.js', true) + file('js/app.js', true)
41
+ Templates::Engine.with_serializer('index.html', options[:serializer]) do
42
+ T('onefile').run(options)
43
+ end
44
+ end
45
+
37
46
  def serialize_index(options)
38
47
  Templates::Engine.with_serializer('index.html', options[:serializer]) do
39
48
  T('layout').run(options)
@@ -1,5 +1,5 @@
1
1
  <div id="footer">
2
2
  Generated on <%= Time.now.strftime("%c") %> by
3
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
3
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
4
4
  <%= YARD::VERSION %> (ruby-<%= RUBY_VERSION %>).
5
5
  </div>
@@ -1,7 +1,9 @@
1
1
  def init
2
2
  @breadcrumb = []
3
3
 
4
- if @file
4
+ if @onefile
5
+ sections :layout
6
+ elsif @file
5
7
  @contents = File.read(@file)
6
8
  @file = File.basename(@file)
7
9
  @fname = @file.gsub(/\.[^.]+$/, '')
@@ -37,33 +39,13 @@ end
37
39
 
38
40
  def index
39
41
  @objects_by_letter = {}
40
- objects = @objects.reject {|o| o.root? }.sort_by {|o| o.name.to_s }
42
+ objects = Registry.all(:class, :module).sort_by {|o| o.name.to_s }
43
+ objects = run_verifier(objects)
41
44
  objects.each {|o| (@objects_by_letter[o.name.to_s[0,1].upcase] ||= []) << o }
42
45
  erb(:index)
43
46
  end
44
47
 
45
48
  def diskfile
46
- "<div id='filecontents'>" +
47
- case (File.extname(@file)[1..-1] || '').downcase
48
- when 'htm', 'html'
49
- @contents
50
- when 'txt'
51
- "<pre>#{@contents}</pre>"
52
- when 'textile', 'txtile'
53
- htmlify(@contents, :textile)
54
- when 'markdown', 'md', 'mdown', 'mkd'
55
- htmlify(@contents, :markdown)
56
- else
57
- htmlify(@contents, diskfile_shebang_or_default)
58
- end +
59
- "</div>"
49
+ data = htmlify(markup_file_contents(@contents), markup_for_file(@contents, @file))
50
+ "<div id='filecontents'>" + data + "</div>"
60
51
  end
61
-
62
- def diskfile_shebang_or_default
63
- if @contents =~ /\A#!(\S+)\s*$/ # Shebang support
64
- @contents = $'
65
- $1.to_sym
66
- else
67
- options[:markup]
68
- end
69
- end
@@ -4,7 +4,7 @@
4
4
  <pre class="lines"><%= "\n\n\n" %><%= h format_lines(object) %></pre>
5
5
  </td>
6
6
  <td>
7
- <pre class="code"><span class="info file"># File '<%= h object.file %>'<% if object.line %>, line <%= object.line %><% end %></span><%= "\n\n" %><%= html_syntax_highlight object.source, object.source_type %></pre>
7
+ <pre class="code"><span class="info file"># File '<%= h object.file %>'<% if object.line %>, line <%= object.line %><% end %></span><%= "\n\n" %><%= html_syntax_highlight object.source %></pre>
8
8
  </td>
9
9
  </tr>
10
10
  </table>
@@ -1,5 +1,5 @@
1
- <% scopes(attr_listing) do |list, scope| %>
2
- <h2><%= scope.to_s.capitalize %> Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
1
+ <% groups(attr_listing, "Attribute") do |list, name| %>
2
+ <h2><%= name %> <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
3
3
  <ul class="summary">
4
4
  <% list.each do |meth| %>
5
5
  <%= yieldall :item => meth %>
@@ -1,7 +1,7 @@
1
1
  <% if method_listing.size > 0 %>
2
- <% scopes(method_listing) do |list, scope| %>
2
+ <% groups(method_listing) do |list, name| %>
3
3
  <h2>
4
- <%= scope.to_s.capitalize %> Method Summary
4
+ <%= name %>
5
5
  <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
6
6
  </h2>
7
7
 
@@ -88,6 +88,29 @@ def docstring_summary(obj)
88
88
  docstring_full(obj).summary
89
89
  end
90
90
 
91
+ def groups(list, type = "Method")
92
+ if groups_data = object.groups
93
+ others = list.select {|m| !m.group }
94
+ groups_data.each do |name|
95
+ items = list.select {|m| m.group == name }
96
+ yield(items, name) unless items.empty?
97
+ end
98
+ else
99
+ others = []
100
+ group_data = {}
101
+ list.each do |meth|
102
+ if meth.group
103
+ (group_data[meth.group] ||= []) << meth
104
+ else
105
+ others << meth
106
+ end
107
+ end
108
+ group_data.each {|group, items| yield(items, group) unless items.empty? }
109
+ end
110
+
111
+ scopes(others) {|items, scope| yield(items, "#{scope.to_s.capitalize} #{type} Summary") }
112
+ end
113
+
91
114
  def scopes(list)
92
115
  [:class, :instance].each do |scope|
93
116
  items = list.select {|m| m.scope == scope }
@@ -96,11 +119,11 @@ def scopes(list)
96
119
  end
97
120
 
98
121
  def mixed_into(object)
99
- unless defined?(@@mixed_into) && @@mixed_into
100
- @@mixed_into = {}
122
+ unless globals.mixed_into
123
+ globals.mixed_into = {}
101
124
  list = run_verifier Registry.all(:class, :module)
102
- list.each {|o| o.mixins.each {|m| (@@mixed_into[m.path] ||= []) << o } }
125
+ list.each {|o| o.mixins.each {|m| (globals.mixed_into[m.path] ||= []) << o } }
103
126
  end
104
127
 
105
- @@mixed_into[object.path] || []
128
+ globals.mixed_into[object.path] || []
106
129
  end
@@ -0,0 +1,5 @@
1
+ <% @files.each do |file| %>
2
+ <% @file, @contents = file, read_file(file) %>
3
+ <h2><%= file %></h2>
4
+ <%= diskfile %>
5
+ <% end %>
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta name="Content-Type" content="text/html; charset=<%= charset %>" />
6
+ <title><%= @title %></title>
7
+ <style type="text/css" media="screen">
8
+ <%= @css_data %>
9
+ </style>
10
+ <script type="text/javascript" charset="utf-8">
11
+ <%= @js_data %>
12
+ </script>
13
+ </head>
14
+ <body>
15
+ <div id="content">
16
+ <h1><%= @title %></h1>
17
+ <%= yieldall %>
18
+ </div>
19
+
20
+ <%= erb(:footer) %>
21
+ </body>
22
+ </html>
@@ -0,0 +1,3 @@
1
+ <div id="readme">
2
+ <%= htmlify(parse_top_comments_from_file) %>
3
+ </div>
@@ -0,0 +1,40 @@
1
+ include T('default/layout/html')
2
+ include YARD::Parser::Ruby::Legacy
3
+
4
+ def init
5
+ override_serializer
6
+ @object = YARD::Registry.root
7
+ @files.shift
8
+ @objects.delete(YARD::Registry.root)
9
+ @objects.unshift(YARD::Registry.root)
10
+ sections :layout, [:readme, :files, :all_objects]
11
+ end
12
+
13
+ def all_objects
14
+ @objects.map {|obj| obj.format(options) }.join("\n")
15
+ end
16
+
17
+ private
18
+
19
+ def read_file(file)
20
+ File.read(file).force_encoding(charset)
21
+ end
22
+
23
+ def parse_top_comments_from_file
24
+ data = ""
25
+ tokens = TokenList.new(read_file(@readme))
26
+ tokens.each do |token|
27
+ break unless token.is_a?(RubyToken::TkCOMMENT) || token.is_a?(RubyToken::TkNL)
28
+ data << (token.text[/\A#\s{0,1}(.*)/, 1] || "\n")
29
+ end
30
+ YARD::Docstring.new(data)
31
+ end
32
+
33
+ def override_serializer
34
+ class << @serializer
35
+ def serialized_path(object)
36
+ return object if object.is_a?(String)
37
+ return 'index.html'
38
+ end
39
+ end
40
+ end
@@ -0,0 +1 @@
1
+ include T('default/module/html')
@@ -1,22 +1,8 @@
1
1
  def init
2
- sections :index, [:example, :overload, [T('docstring')], :param, :option, :yields,
3
- :yieldparam, :yieldreturn, :return, :raises, :see, :author, :since, :version]
4
- end
5
-
6
- def param
7
- tag :param
8
- end
9
-
10
- def yields
11
- tag :yield, :no_names => true
12
- end
13
-
14
- def yieldparam
15
- tag :yieldparam
16
- end
17
-
18
- def yieldreturn
19
- tag :yieldreturn, :no_names => true
2
+ tags = Tags::Library.visible_tags - [:abstract, :deprecated, :note, :todo]
3
+ create_tag_methods(tags - [:example, :option, :overload, :see])
4
+ sections :index, tags
5
+ sections.any(:overload).push(T('docstring'))
20
6
  end
21
7
 
22
8
  def return
@@ -27,21 +13,7 @@ def return
27
13
  tag :return, :no_names => true
28
14
  end
29
15
 
30
- def raises
31
- tag :raise, :no_names => true
32
- end
33
-
34
- def author
35
- tag :author, :no_types => true, :no_names => true
36
- end
37
-
38
- def since
39
- tag :since, :no_types => true, :no_names => true
40
- end
41
-
42
- def version
43
- tag :version, :no_types => true, :no_names => true
44
- end
16
+ private
45
17
 
46
18
  def tag(name, opts = {})
47
19
  return unless object.has_tag?(name)
@@ -52,3 +24,24 @@ def tag(name, opts = {})
52
24
  @no_names, @no_types = nil, nil
53
25
  out
54
26
  end
27
+
28
+ def create_tag_methods(tags)
29
+ tags.each do |tag|
30
+ next if respond_to?(tag)
31
+ instance_eval(<<-eof, __FILE__, __LINE__ + 1)
32
+ def #{tag}
33
+ opts = {:no_types => true, :no_names => true}
34
+ case Tags::Library.factory_method_for(#{tag.inspect})
35
+ when :with_types
36
+ opts[:no_types] = false
37
+ when :with_types_and_name
38
+ opts[:no_types] = false
39
+ opts[:no_names] = false
40
+ when :with_name
41
+ opts[:no_names] = false
42
+ end
43
+ tag #{tag.inspect}, opts
44
+ end
45
+ eof
46
+ end
47
+ end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 5
9
- - 8
10
- version: 0.5.8
7
+ - 6
8
+ - 0
9
+ version: 0.6.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Loren Segal
@@ -15,16 +14,16 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-06-22 00:00:00 -04:00
17
+ date: 2010-08-29 00:00:00 -04:00
19
18
  default_executable:
20
19
  dependencies: []
21
20
 
22
21
  description: " YARD is a documentation generation tool for the Ruby programming language.\n It enables the user to generate consistent, usable documentation that can be\n exported to a number of formats very easily, and also supports extending for\n custom Ruby constructs such as custom class level definitions.\n"
23
22
  email: lsegal@soen.ca
24
23
  executables:
24
+ - yard
25
25
  - yardoc
26
26
  - yri
27
- - yard-graph
28
27
  extensions: []
29
28
 
30
29
  extra_rdoc_files: []
@@ -44,13 +43,21 @@ files:
44
43
  - docs/Tags.md
45
44
  - docs/Templates.md
46
45
  - docs/WhatsNew.md
46
+ - bin/yard
47
47
  - bin/yard-graph
48
+ - bin/yard-server
48
49
  - bin/yardoc
49
50
  - bin/yri
50
51
  - lib/rubygems_plugin.rb
51
52
  - lib/yard/autoload.rb
52
- - lib/yard/cli/base.rb
53
- - lib/yard/cli/yard_graph.rb
53
+ - lib/yard/cli/command.rb
54
+ - lib/yard/cli/command_parser.rb
55
+ - lib/yard/cli/diff.rb
56
+ - lib/yard/cli/gems.rb
57
+ - lib/yard/cli/graph.rb
58
+ - lib/yard/cli/help.rb
59
+ - lib/yard/cli/server.rb
60
+ - lib/yard/cli/stats.rb
54
61
  - lib/yard/cli/yardoc.rb
55
62
  - lib/yard/cli/yri.rb
56
63
  - lib/yard/code_objects/base.rb
@@ -66,6 +73,7 @@ files:
66
73
  - lib/yard/core_ext/array.rb
67
74
  - lib/yard/core_ext/file.rb
68
75
  - lib/yard/core_ext/hash.rb
76
+ - lib/yard/core_ext/insertion.rb
69
77
  - lib/yard/core_ext/module.rb
70
78
  - lib/yard/core_ext/string.rb
71
79
  - lib/yard/core_ext/symbol_hash.rb
@@ -124,6 +132,42 @@ files:
124
132
  - lib/yard/serializers/process_serializer.rb
125
133
  - lib/yard/serializers/stdout_serializer.rb
126
134
  - lib/yard/serializers/yardoc_serializer.rb
135
+ - lib/yard/server/adapter.rb
136
+ - lib/yard/server/commands/base.rb
137
+ - lib/yard/server/commands/display_file_command.rb
138
+ - lib/yard/server/commands/display_object_command.rb
139
+ - lib/yard/server/commands/frames_command.rb
140
+ - lib/yard/server/commands/library_command.rb
141
+ - lib/yard/server/commands/library_index_command.rb
142
+ - lib/yard/server/commands/list_command.rb
143
+ - lib/yard/server/commands/search_command.rb
144
+ - lib/yard/server/commands/static_file_command.rb
145
+ - lib/yard/server/doc_server_helper.rb
146
+ - lib/yard/server/doc_server_serializer.rb
147
+ - lib/yard/server/library_version.rb
148
+ - lib/yard/server/rack_adapter.rb
149
+ - lib/yard/server/router.rb
150
+ - lib/yard/server/static_caching.rb
151
+ - lib/yard/server/templates/default/fulldoc/html/css/custom.css
152
+ - lib/yard/server/templates/default/fulldoc/html/images/processing.gif
153
+ - lib/yard/server/templates/default/fulldoc/html/js/autocomplete.js
154
+ - lib/yard/server/templates/default/fulldoc/html/js/live.js
155
+ - lib/yard/server/templates/default/layout/html/breadcrumb.erb
156
+ - lib/yard/server/templates/default/layout/html/headers.erb
157
+ - lib/yard/server/templates/doc_server/frames/html/frames.erb
158
+ - lib/yard/server/templates/doc_server/frames/html/setup.rb
159
+ - lib/yard/server/templates/doc_server/full_list/html/full_list.erb
160
+ - lib/yard/server/templates/doc_server/full_list/html/setup.rb
161
+ - lib/yard/server/templates/doc_server/library_list/html/contents.erb
162
+ - lib/yard/server/templates/doc_server/library_list/html/headers.erb
163
+ - lib/yard/server/templates/doc_server/library_list/html/library_list.erb
164
+ - lib/yard/server/templates/doc_server/library_list/html/setup.rb
165
+ - lib/yard/server/templates/doc_server/library_list/html/title.erb
166
+ - lib/yard/server/templates/doc_server/processing/html/processing.erb
167
+ - lib/yard/server/templates/doc_server/processing/html/setup.rb
168
+ - lib/yard/server/templates/doc_server/search/html/search.erb
169
+ - lib/yard/server/templates/doc_server/search/html/setup.rb
170
+ - lib/yard/server/webrick_adapter.rb
127
171
  - lib/yard/tags/default_factory.rb
128
172
  - lib/yard/tags/default_tag.rb
129
173
  - lib/yard/tags/library.rb
@@ -145,9 +189,15 @@ files:
145
189
  - lib/yard/templates/helpers/module_helper.rb
146
190
  - lib/yard/templates/helpers/text_helper.rb
147
191
  - lib/yard/templates/helpers/uml_helper.rb
192
+ - lib/yard/templates/section.rb
148
193
  - lib/yard/templates/template.rb
149
194
  - lib/yard/verifier.rb
150
195
  - lib/yard.rb
196
+ - spec/cli/command_parser_spec.rb
197
+ - spec/cli/diff_spec.rb
198
+ - spec/cli/help_spec.rb
199
+ - spec/cli/server_spec.rb
200
+ - spec/cli/stats_spec.rb
151
201
  - spec/cli/yardoc_spec.rb
152
202
  - spec/cli/yri_spec.rb
153
203
  - spec/code_objects/base_spec.rb
@@ -162,6 +212,7 @@ files:
162
212
  - spec/core_ext/array_spec.rb
163
213
  - spec/core_ext/file_spec.rb
164
214
  - spec/core_ext/hash_spec.rb
215
+ - spec/core_ext/insertion_spec.rb
165
216
  - spec/core_ext/module_spec.rb
166
217
  - spec/core_ext/string_spec.rb
167
218
  - spec/core_ext/symbol_hash_spec.rb
@@ -227,6 +278,14 @@ files:
227
278
  - spec/serializers/file_system_serializer_spec.rb
228
279
  - spec/serializers/spec_helper.rb
229
280
  - spec/serializers/yardoc_serializer_spec.rb
281
+ - spec/server/adapter_spec.rb
282
+ - spec/server/commands/base_spec.rb
283
+ - spec/server/commands/static_file_command_spec.rb
284
+ - spec/server/doc_server_serializer_spec.rb
285
+ - spec/server/router_spec.rb
286
+ - spec/server/spec_helper.rb
287
+ - spec/server/static_caching_spec.rb
288
+ - spec/server/webrick_servlet_spec.rb
230
289
  - spec/spec_helper.rb
231
290
  - spec/tags/default_factory_spec.rb
232
291
  - spec/tags/default_tag_spec.rb
@@ -234,10 +293,14 @@ files:
234
293
  - spec/tags/overload_tag_spec.rb
235
294
  - spec/tags/ref_tag_list_spec.rb
236
295
  - spec/templates/class_spec.rb
296
+ - spec/templates/constant_spec.rb
237
297
  - spec/templates/engine_spec.rb
238
298
  - spec/templates/examples/class001.html
239
299
  - spec/templates/examples/class001.txt
240
300
  - spec/templates/examples/class002.html
301
+ - spec/templates/examples/constant001.txt
302
+ - spec/templates/examples/constant002.txt
303
+ - spec/templates/examples/constant003.txt
241
304
  - spec/templates/examples/method001.html
242
305
  - spec/templates/examples/method001.txt
243
306
  - spec/templates/examples/method002.html
@@ -251,6 +314,7 @@ files:
251
314
  - spec/templates/examples/module001.dot
252
315
  - spec/templates/examples/module001.html
253
316
  - spec/templates/examples/module001.txt
317
+ - spec/templates/examples/module002.html
254
318
  - spec/templates/examples/tag001.txt
255
319
  - spec/templates/helpers/base_helper_spec.rb
256
320
  - spec/templates/helpers/html_helper_spec.rb
@@ -261,6 +325,7 @@ files:
261
325
  - spec/templates/helpers/text_helper_spec.rb
262
326
  - spec/templates/method_spec.rb
263
327
  - spec/templates/module_spec.rb
328
+ - spec/templates/section_spec.rb
264
329
  - spec/templates/spec_helper.rb
265
330
  - spec/templates/tag_spec.rb
266
331
  - spec/templates/template_spec.rb
@@ -274,6 +339,8 @@ files:
274
339
  - templates/default/class/setup.rb
275
340
  - templates/default/class/text/setup.rb
276
341
  - templates/default/class/text/subclasses.erb
342
+ - templates/default/constant/text/header.erb
343
+ - templates/default/constant/text/setup.rb
277
344
  - templates/default/docstring/html/abstract.erb
278
345
  - templates/default/docstring/html/deprecated.erb
279
346
  - templates/default/docstring/html/index.erb
@@ -349,8 +416,13 @@ files:
349
416
  - templates/default/module/text/includes.erb
350
417
  - templates/default/module/text/instance_meths_list.erb
351
418
  - templates/default/module/text/setup.rb
419
+ - templates/default/onefile/html/files.erb
420
+ - templates/default/onefile/html/layout.erb
421
+ - templates/default/onefile/html/readme.erb
422
+ - templates/default/onefile/html/setup.rb
352
423
  - templates/default/root/dot/child.erb
353
424
  - templates/default/root/dot/setup.rb
425
+ - templates/default/root/html/setup.rb
354
426
  - templates/default/tags/html/example.erb
355
427
  - templates/default/tags/html/index.erb
356
428
  - templates/default/tags/html/option.erb
@@ -399,7 +471,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
399
471
  requirements:
400
472
  - - ">="
401
473
  - !ruby/object:Gem::Version
402
- hash: 3
403
474
  segments:
404
475
  - 0
405
476
  version: "0"
@@ -408,7 +479,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
408
479
  requirements:
409
480
  - - ">="
410
481
  - !ruby/object:Gem::Version
411
- hash: 3
412
482
  segments:
413
483
  - 0
414
484
  version: "0"