yard 0.4.0 → 0.5.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 (121) hide show
  1. data/ChangeLog +585 -1
  2. data/README.md +10 -2
  3. data/benchmarks/yri_cache.rb +19 -0
  4. data/bin/yri +1 -26
  5. data/docs/WhatsNew.md +99 -0
  6. data/lib/rubygems_plugin.rb +2 -0
  7. data/lib/yard.rb +2 -2
  8. data/lib/yard/autoload.rb +9 -4
  9. data/lib/yard/cli/base.rb +26 -0
  10. data/lib/yard/cli/yard_graph.rb +2 -9
  11. data/lib/yard/cli/yardoc.rb +93 -33
  12. data/lib/yard/cli/yri.rb +128 -0
  13. data/lib/yard/code_objects/base.rb +16 -5
  14. data/lib/yard/code_objects/class_object.rb +11 -4
  15. data/lib/yard/code_objects/method_object.rb +11 -1
  16. data/lib/yard/code_objects/proxy.rb +5 -2
  17. data/lib/yard/code_objects/root_object.rb +1 -0
  18. data/lib/yard/core_ext/file.rb +1 -1
  19. data/lib/yard/core_ext/hash.rb +15 -0
  20. data/lib/yard/core_ext/module.rb +2 -2
  21. data/lib/yard/core_ext/string.rb +66 -0
  22. data/lib/yard/core_ext/symbol_hash.rb +1 -1
  23. data/lib/yard/docstring.rb +5 -5
  24. data/lib/yard/handlers/base.rb +10 -4
  25. data/lib/yard/handlers/processor.rb +3 -4
  26. data/lib/yard/handlers/ruby/attribute_handler.rb +3 -2
  27. data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +2 -2
  28. data/lib/yard/handlers/ruby/legacy/method_handler.rb +7 -1
  29. data/lib/yard/handlers/ruby/method_handler.rb +7 -1
  30. data/lib/yard/logging.rb +11 -1
  31. data/lib/yard/parser/c_parser.rb +407 -0
  32. data/lib/yard/parser/ruby/ast_node.rb +2 -2
  33. data/lib/yard/parser/ruby/legacy/ruby_lex.rb +3 -4
  34. data/lib/yard/parser/source_parser.rb +18 -7
  35. data/lib/yard/rake/yardoc_task.rb +1 -1
  36. data/lib/yard/registry.rb +83 -29
  37. data/lib/yard/registry_store.rb +213 -0
  38. data/lib/yard/serializers/base.rb +1 -1
  39. data/lib/yard/serializers/yardoc_serializer.rb +113 -0
  40. data/lib/yard/tags/library.rb +4 -0
  41. data/lib/yard/tags/overload_tag.rb +16 -5
  42. data/lib/yard/tags/tag.rb +1 -2
  43. data/lib/yard/templates/engine.rb +3 -3
  44. data/lib/yard/templates/helpers/html_helper.rb +50 -16
  45. data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +1 -3
  46. data/lib/yard/templates/helpers/html_syntax_highlight_helper18.rb +1 -3
  47. data/lib/yard/templates/helpers/method_helper.rb +11 -4
  48. data/lib/yard/templates/helpers/text_helper.rb +24 -2
  49. data/lib/yard/verifier.rb +3 -3
  50. data/spec/cli/yardoc_spec.rb +33 -6
  51. data/spec/cli/yri_spec.rb +30 -0
  52. data/spec/code_objects/base_spec.rb +7 -0
  53. data/spec/code_objects/class_object_spec.rb +6 -1
  54. data/spec/code_objects/method_object_spec.rb +25 -0
  55. data/spec/core_ext/hash_spec.rb +10 -0
  56. data/spec/core_ext/module_spec.rb +1 -1
  57. data/spec/core_ext/string_spec.rb +50 -12
  58. data/spec/handlers/attribute_handler_spec.rb +4 -0
  59. data/spec/handlers/examples/method_handler_001.rb.txt +9 -0
  60. data/spec/handlers/method_handler_spec.rb +22 -4
  61. data/spec/parser/c_parser_spec.rb +22 -0
  62. data/spec/parser/examples/array.c.txt +3887 -0
  63. data/spec/parser/source_parser_spec.rb +29 -7
  64. data/spec/registry_spec.rb +93 -72
  65. data/spec/registry_store_spec.rb +184 -0
  66. data/spec/serializers/file_system_serializer_spec.rb +96 -75
  67. data/spec/spec_helper.rb +2 -2
  68. data/spec/tags/overload_tag_spec.rb +18 -0
  69. data/spec/templates/examples/class001.html +32 -30
  70. data/spec/templates/examples/method001.html +4 -1
  71. data/spec/templates/examples/method002.html +7 -2
  72. data/spec/templates/examples/method002.txt +1 -1
  73. data/spec/templates/examples/method003.html +30 -8
  74. data/spec/templates/examples/method003.txt +4 -4
  75. data/spec/templates/examples/method004.html +44 -0
  76. data/spec/templates/examples/method004.txt +10 -0
  77. data/spec/templates/examples/method005.html +99 -0
  78. data/spec/templates/examples/method005.txt +33 -0
  79. data/spec/templates/examples/module001.dot +1 -1
  80. data/spec/templates/examples/module001.html +391 -37
  81. data/spec/templates/examples/module001.txt +1 -1
  82. data/spec/templates/helpers/base_helper_spec.rb +2 -2
  83. data/spec/templates/helpers/html_helper_spec.rb +83 -0
  84. data/spec/templates/helpers/method_helper_spec.rb +47 -0
  85. data/spec/templates/helpers/shared_signature_examples.rb +102 -0
  86. data/spec/templates/helpers/text_helper_spec.rb +31 -0
  87. data/spec/templates/method_spec.rb +43 -18
  88. data/spec/templates/module_spec.rb +22 -1
  89. data/spec/templates/spec_helper.rb +10 -1
  90. data/spec/yard_spec.rb +4 -3
  91. data/templates/default/class/html/constructor_details.erb +1 -1
  92. data/templates/default/docstring/html/returns_void.erb +1 -0
  93. data/templates/default/docstring/setup.rb +9 -4
  94. data/templates/default/docstring/text/returns_void.erb +1 -0
  95. data/templates/default/fulldoc/html/css/style.css +4 -2
  96. data/templates/default/fulldoc/html/full_list.erb +2 -2
  97. data/templates/default/fulldoc/html/js/app.js +1 -1
  98. data/templates/default/fulldoc/html/setup.rb +14 -6
  99. data/templates/default/layout/dot/setup.rb +1 -1
  100. data/templates/default/layout/html/breadcrumb.erb +2 -2
  101. data/templates/default/layout/html/index.erb +2 -2
  102. data/templates/default/layout/html/setup.rb +5 -5
  103. data/templates/default/method/html/header.erb +6 -4
  104. data/templates/default/method_details/html/method_signature.erb +2 -1
  105. data/templates/default/method_details/html/source.erb +1 -1
  106. data/templates/default/method_details/setup.rb +2 -1
  107. data/templates/default/method_details/text/setup.rb +1 -1
  108. data/templates/default/module/html/attribute_details.erb +4 -4
  109. data/templates/default/module/html/attribute_summary.erb +3 -3
  110. data/templates/default/module/html/box_info.erb +2 -2
  111. data/templates/default/module/html/defines.erb +1 -1
  112. data/templates/default/module/html/inherited_constants.erb +1 -1
  113. data/templates/default/module/html/inherited_methods.erb +1 -1
  114. data/templates/default/module/html/item_summary.erb +13 -4
  115. data/templates/default/module/html/method_details_list.erb +5 -4
  116. data/templates/default/module/html/method_summary.erb +5 -4
  117. data/templates/default/module/html/methodmissing.erb +1 -1
  118. data/templates/default/module/setup.rb +14 -5
  119. data/templates/default/tags/html/overload.erb +3 -2
  120. data/templates/default/tags/setup.rb +4 -0
  121. metadata +23 -2
@@ -1,8 +1,9 @@
1
- <% if method_listing.size > 0 %>
2
- <h2>Method Summary</h2>
1
+ <% scopes(method_listing) do |list, scope| %>
2
+ <h2><%= scope.to_s.capitalize %> Method Summary</h2>
3
+
3
4
  <ul class="summary">
4
- <% method_listing.each do |meth| %>
5
+ <% list.each do |meth| %>
5
6
  <%= yieldall :item => meth %>
6
7
  <% end %>
7
8
  </ul>
8
- <% end %>
9
+ <% end %>
@@ -1,4 +1,4 @@
1
- <div id="method_missing_details">
1
+ <div id="method_missing_details" class="method_details_list">
2
2
  <h2>Dynamic Method Handling</h2>
3
3
  <p class="notice <%= @mm.namespace == object ? 'this' : 'super' %>">
4
4
  This class handles dynamic methods through the <tt>method_missing</tt> method
@@ -21,8 +21,8 @@ def children
21
21
  @inner[0][1] << child if child.type == :module
22
22
  @inner[1][1] << child if child.type == :class
23
23
  end
24
+ @inner.map! {|v| [v[0], run_verifier(v[1].sort_by {|o| o.name.to_s })] }
24
25
  return if (@inner[0][1].size + @inner[1][1].size) == 0
25
- @inner.map! {|v| [v[0], v[1].sort_by {|o| o.name.to_s }] }
26
26
  erb(:children)
27
27
  end
28
28
 
@@ -33,15 +33,17 @@ def methodmissing
33
33
  end
34
34
 
35
35
  def method_listing(include_specials = true)
36
- return @smeths ||= method_listing.reject {|o| special_methods.include? o.name(true) } unless include_specials
36
+ return @smeths ||= method_listing.reject {|o| special_method?(o) } unless include_specials
37
37
  return @meths if @meths
38
38
  @meths = object.meths(:inherited => false, :included => false)
39
39
  @meths = sort_listing(prune_method_listing(@meths))
40
40
  @meths
41
41
  end
42
42
 
43
- def special_methods
44
- ["#initialize", "#method_missing"]
43
+ def special_method?(meth)
44
+ return true if meth.name(true) == '#method_missing'
45
+ return true if meth.constructor?
46
+ false
45
47
  end
46
48
 
47
49
  def attr_listing
@@ -64,7 +66,7 @@ def constant_listing
64
66
  end
65
67
 
66
68
  def sort_listing(list)
67
- list.sort_by {|o| [o.scope, (options[:visibilities]||[]).index(o.visibility), o.name].join(":") }
69
+ list.sort_by {|o| [o.scope.to_s, o.name.to_s.downcase] }
68
70
  end
69
71
 
70
72
  def docstring_summary(obj)
@@ -81,3 +83,10 @@ def docstring_summary(obj)
81
83
 
82
84
  docstring.summary
83
85
  end
86
+
87
+ def scopes(list)
88
+ [:class, :instance].each do |scope|
89
+ items = list.select {|m| m.scope == scope }
90
+ yield(items, scope) unless items.empty?
91
+ end
92
+ end
@@ -1,11 +1,12 @@
1
1
  <% if object.tags(:overload).size == 1 %>
2
2
  <%= yieldall :object => object.tag(:overload) %>
3
- <% elsif object.has_tag?(:overload) %>
3
+ <% elsif object.has_tag?(:overload) && object.tags(:overload).any? {|o| !o.docstring.blank? } %>
4
4
  <h3>Overloads:</h3>
5
5
  <ul class="overload">
6
6
  <% object.tags(:overload).each do |overload| %>
7
+ <% next if overload.docstring.blank? %>
7
8
  <li class="overload_item">
8
- <span class="signature"><%= signature(overload, false) %></span>
9
+ <span class="signature"><%= signature(overload, false, false) %></span>
9
10
  <%= yieldall :object => overload %>
10
11
  </li>
11
12
  <% end %>
@@ -20,6 +20,10 @@ def yieldreturn
20
20
  end
21
21
 
22
22
  def return
23
+ if object.type == :method
24
+ return if object.name == :initialize && object.scope == :instance
25
+ return if object.tags(:return).size == 1 && object.tag(:return).types == ['void']
26
+ end
23
27
  tag :return, :no_names => true
24
28
  end
25
29
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loren Segal
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-15 00:00:00 -05:00
12
+ date: 2009-12-13 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -43,8 +43,10 @@ files:
43
43
  - bin/yri
44
44
  - lib/rubygems_plugin.rb
45
45
  - lib/yard/autoload.rb
46
+ - lib/yard/cli/base.rb
46
47
  - lib/yard/cli/yard_graph.rb
47
48
  - lib/yard/cli/yardoc.rb
49
+ - lib/yard/cli/yri.rb
48
50
  - lib/yard/code_objects/base.rb
49
51
  - lib/yard/code_objects/class_object.rb
50
52
  - lib/yard/code_objects/class_variable_object.rb
@@ -57,6 +59,7 @@ files:
57
59
  - lib/yard/code_objects/root_object.rb
58
60
  - lib/yard/core_ext/array.rb
59
61
  - lib/yard/core_ext/file.rb
62
+ - lib/yard/core_ext/hash.rb
60
63
  - lib/yard/core_ext/module.rb
61
64
  - lib/yard/core_ext/string.rb
62
65
  - lib/yard/core_ext/symbol_hash.rb
@@ -93,6 +96,7 @@ files:
93
96
  - lib/yard/handlers/ruby/visibility_handler.rb
94
97
  - lib/yard/handlers/ruby/yield_handler.rb
95
98
  - lib/yard/logging.rb
99
+ - lib/yard/parser/c_parser.rb
96
100
  - lib/yard/parser/ruby/ast_node.rb
97
101
  - lib/yard/parser/ruby/legacy/ruby_lex.rb
98
102
  - lib/yard/parser/ruby/legacy/statement.rb
@@ -102,10 +106,12 @@ files:
102
106
  - lib/yard/parser/source_parser.rb
103
107
  - lib/yard/rake/yardoc_task.rb
104
108
  - lib/yard/registry.rb
109
+ - lib/yard/registry_store.rb
105
110
  - lib/yard/serializers/base.rb
106
111
  - lib/yard/serializers/file_system_serializer.rb
107
112
  - lib/yard/serializers/process_serializer.rb
108
113
  - lib/yard/serializers/stdout_serializer.rb
114
+ - lib/yard/serializers/yardoc_serializer.rb
109
115
  - lib/yard/tags/default_factory.rb
110
116
  - lib/yard/tags/default_tag.rb
111
117
  - lib/yard/tags/library.rb
@@ -130,6 +136,7 @@ files:
130
136
  - lib/yard/verifier.rb
131
137
  - lib/yard.rb
132
138
  - spec/cli/yardoc_spec.rb
139
+ - spec/cli/yri_spec.rb
133
140
  - spec/code_objects/base_spec.rb
134
141
  - spec/code_objects/class_object_spec.rb
135
142
  - spec/code_objects/code_object_list_spec.rb
@@ -141,6 +148,7 @@ files:
141
148
  - spec/code_objects/spec_helper.rb
142
149
  - spec/core_ext/array_spec.rb
143
150
  - spec/core_ext/file_spec.rb
151
+ - spec/core_ext/hash_spec.rb
144
152
  - spec/core_ext/module_spec.rb
145
153
  - spec/core_ext/string_spec.rb
146
154
  - spec/core_ext/symbol_hash_spec.rb
@@ -179,6 +187,8 @@ files:
179
187
  - spec/handlers/spec_helper.rb
180
188
  - spec/handlers/visibility_handler_spec.rb
181
189
  - spec/handlers/yield_handler_spec.rb
190
+ - spec/parser/c_parser_spec.rb
191
+ - spec/parser/examples/array.c.txt
182
192
  - spec/parser/examples/example1.rb.txt
183
193
  - spec/parser/examples/parse_in_order_001.rb.txt
184
194
  - spec/parser/examples/parse_in_order_002.rb.txt
@@ -191,6 +201,7 @@ files:
191
201
  - spec/parser/tag_parsing_spec.rb
192
202
  - spec/rake/yardoc_task_spec.rb
193
203
  - spec/registry_spec.rb
204
+ - spec/registry_store_spec.rb
194
205
  - spec/serializers/file_system_serializer_spec.rb
195
206
  - spec/serializers/spec_helper.rb
196
207
  - spec/spec_helper.rb
@@ -209,6 +220,10 @@ files:
209
220
  - spec/templates/examples/method002.txt
210
221
  - spec/templates/examples/method003.html
211
222
  - spec/templates/examples/method003.txt
223
+ - spec/templates/examples/method004.html
224
+ - spec/templates/examples/method004.txt
225
+ - spec/templates/examples/method005.html
226
+ - spec/templates/examples/method005.txt
212
227
  - spec/templates/examples/module001.dot
213
228
  - spec/templates/examples/module001.html
214
229
  - spec/templates/examples/module001.txt
@@ -217,6 +232,9 @@ files:
217
232
  - spec/templates/helpers/html_helper_spec.rb
218
233
  - spec/templates/helpers/html_syntax_highlight_helper_spec.rb
219
234
  - spec/templates/helpers/markup_helper_spec.rb
235
+ - spec/templates/helpers/method_helper_spec.rb
236
+ - spec/templates/helpers/shared_signature_examples.rb
237
+ - spec/templates/helpers/text_helper_spec.rb
220
238
  - spec/templates/method_spec.rb
221
239
  - spec/templates/module_spec.rb
222
240
  - spec/templates/spec_helper.rb
@@ -236,6 +254,7 @@ files:
236
254
  - templates/default/docstring/html/deprecated.erb
237
255
  - templates/default/docstring/html/index.erb
238
256
  - templates/default/docstring/html/note.erb
257
+ - templates/default/docstring/html/returns_void.erb
239
258
  - templates/default/docstring/html/text.erb
240
259
  - templates/default/docstring/html/todo.erb
241
260
  - templates/default/docstring/setup.rb
@@ -243,6 +262,7 @@ files:
243
262
  - templates/default/docstring/text/deprecated.erb
244
263
  - templates/default/docstring/text/index.erb
245
264
  - templates/default/docstring/text/note.erb
265
+ - templates/default/docstring/text/returns_void.erb
246
266
  - templates/default/docstring/text/text.erb
247
267
  - templates/default/docstring/text/todo.erb
248
268
  - templates/default/fulldoc/html/css/common.css
@@ -328,6 +348,7 @@ files:
328
348
  - benchmarks/template_erb.rb
329
349
  - benchmarks/template_format.rb
330
350
  - benchmarks/template_profile.rb
351
+ - benchmarks/yri_cache.rb
331
352
  - ChangeLog
332
353
  - LICENSE
333
354
  - README.md