yard 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- data/ChangeLog +162 -0
- data/README.md +20 -3
- data/docs/Glossary.md +2 -2
- data/docs/Overview.md +1 -1
- data/lib/yard.rb +1 -1
- data/lib/yard/cli/yardoc.rb +1 -0
- data/lib/yard/code_objects/base.rb +7 -0
- data/lib/yard/handlers/ruby/legacy/method_handler.rb +3 -1
- data/lib/yard/handlers/ruby/macro_handler_methods.rb +2 -1
- data/lib/yard/handlers/ruby/method_handler.rb +3 -1
- data/lib/yard/parser/c_parser.rb +48 -52
- data/lib/yard/parser/ruby/ruby_parser.rb +13 -1
- data/lib/yard/registry_store.rb +1 -1
- data/lib/yard/server/commands/library_command.rb +2 -1
- data/lib/yard/server/doc_server_helper.rb +3 -3
- data/lib/yard/server/doc_server_serializer.rb +9 -9
- data/lib/yard/server/rack_adapter.rb +1 -0
- data/lib/yard/server/router.rb +2 -0
- data/lib/yard/server/templates/doc_server/library_list/html/contents.erb +1 -1
- data/lib/yard/server/templates/doc_server/search/html/search.erb +1 -2
- data/lib/yard/server/webrick_adapter.rb +1 -0
- data/lib/yard/templates/helpers/html_helper.rb +48 -22
- data/spec/cli/yardoc_spec.rb +17 -0
- data/spec/code_objects/base_spec.rb +1 -1
- data/spec/handlers/examples/method_handler_001.rb.txt +4 -0
- data/spec/handlers/macro_handler_spec.rb +9 -0
- data/spec/handlers/method_handler_spec.rb +7 -0
- data/spec/parser/c_parser_spec.rb +134 -9
- data/spec/parser/ruby/ruby_parser_spec.rb +17 -1
- data/spec/registry_spec.rb +1 -0
- data/spec/registry_store_spec.rb +2 -2
- data/spec/server/doc_server_helper_spec.rb +51 -0
- data/spec/server/doc_server_serializer_spec.rb +10 -23
- data/spec/server/rack_adapter_spec.rb +2 -0
- data/spec/server/router_spec.rb +8 -1
- data/spec/templates/class_spec.rb +2 -1
- data/spec/templates/examples/module001.html +1 -1
- data/spec/templates/examples/module003.html +186 -0
- data/spec/templates/helpers/html_helper_spec.rb +57 -31
- data/spec/templates/module_spec.rb +22 -0
- data/spec/templates/tag_spec.rb +12 -0
- data/templates/default/fulldoc/html/js/full_list.js +6 -0
- data/templates/default/module/html/inherited_attributes.erb +6 -9
- data/templates/default/module/html/inherited_constants.erb +8 -8
- data/templates/default/module/setup.rb +22 -0
- data/templates/default/tags/setup.rb +4 -0
- metadata +4 -2
@@ -106,4 +106,26 @@ describe YARD::Templates::Engine.template(:default, :module) do
|
|
106
106
|
|
107
107
|
html_equals(Registry.at('A').format(:format => :html, :no_highlight => true), :module002)
|
108
108
|
end
|
109
|
+
|
110
|
+
it "should ignore overwritten/private attributes/constants from inherited list" do
|
111
|
+
Registry.clear
|
112
|
+
YARD.parse_string <<-'eof'
|
113
|
+
module B
|
114
|
+
attr_reader :foo
|
115
|
+
attr_accessor :bar
|
116
|
+
# @private
|
117
|
+
attr_writer :baz
|
118
|
+
FOO = 1
|
119
|
+
end
|
120
|
+
module A
|
121
|
+
include B
|
122
|
+
def foo; end
|
123
|
+
attr_reader :bar
|
124
|
+
FOO = 2
|
125
|
+
end
|
126
|
+
eof
|
127
|
+
|
128
|
+
html_equals(Registry.at('A').format(:format => :html, :no_highlight => true,
|
129
|
+
:verifier => Verifier.new('!@private')), :module003)
|
130
|
+
end
|
109
131
|
end
|
data/spec/templates/tag_spec.rb
CHANGED
@@ -36,4 +36,16 @@ describe YARD::Templates::Engine.template(:default, :tags) do
|
|
36
36
|
text_equals(Registry.at('#m').format, :tag001)
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
40
|
+
describe 'param tags on non-methods' do
|
41
|
+
it 'should not display @param tags on non-method objects' do
|
42
|
+
YARD.parse_string <<-'eof'
|
43
|
+
# @param [#to_s] name the name
|
44
|
+
module Foo; end
|
45
|
+
eof
|
46
|
+
|
47
|
+
proc = lambda { Registry.at('Foo').format(:format => :html) }
|
48
|
+
proc.should_not raise_error(NoMethodError)
|
49
|
+
end
|
50
|
+
end
|
39
51
|
end
|
@@ -4,6 +4,9 @@ var searchCache = [];
|
|
4
4
|
var searchString = '';
|
5
5
|
var regexSearchString = '';
|
6
6
|
var caseSensitiveMatch = false;
|
7
|
+
var ignoreKeyCodeMin = 8;
|
8
|
+
var ignoreKeyCodeMax = 46;
|
9
|
+
var commandKey = 91;
|
7
10
|
|
8
11
|
RegExp.escape = function(text) {
|
9
12
|
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
@@ -19,6 +22,9 @@ function fullListSearch() {
|
|
19
22
|
});
|
20
23
|
|
21
24
|
$('#search input').keyup(function() {
|
25
|
+
if ((event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax)
|
26
|
+
|| event.keyCode == commandKey)
|
27
|
+
return;
|
22
28
|
searchString = this.value;
|
23
29
|
caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
|
24
30
|
regexSearchString = RegExp.escape(searchString);
|
@@ -1,16 +1,13 @@
|
|
1
1
|
<% found_method = false %>
|
2
|
-
<%
|
3
|
-
<% next if superclass.is_a?(YARD::CodeObjects::Proxy) %>
|
4
|
-
<% attribs = superclass.attributes[:instance] %>
|
5
|
-
<% next if attribs.size == 0 %>
|
2
|
+
<% inherited_attr_list do |superclass, attribs| %>
|
6
3
|
<% if attr_listing.size == 0 && !found_method %><h2>Instance Attribute Summary</h2><% end %>
|
7
4
|
<% found_method = true %>
|
8
5
|
<h3 class="inherited">Attributes <%= superclass.type == :class ? 'inherited' : 'included' %> from <%= linkify superclass %></h3>
|
9
|
-
<p class="inherited"><%=
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
<p class="inherited"><%= attribs.map do |method|
|
7
|
+
name = method.name(true).gsub(/=$/, '')
|
8
|
+
if superclass.type == :module && object.instance_mixins.include?(superclass)
|
9
|
+
name = "##{name}" unless name =~ /^#/
|
10
|
+
end
|
14
11
|
linkify(method, name)
|
15
12
|
end.join(", ")
|
16
13
|
%></p>
|
@@ -1,8 +1,8 @@
|
|
1
|
-
<%
|
2
|
-
|
3
|
-
<%
|
4
|
-
<%
|
5
|
-
|
6
|
-
|
7
|
-
<p class="inherited"><%= consts.
|
8
|
-
<% end %>
|
1
|
+
<% found_const = false %>
|
2
|
+
<% inherited_constant_list do |superclass, consts| %>
|
3
|
+
<% if constant_listing.size == 0 && !found_const %><h2>Constant Summary</h2><% end %>
|
4
|
+
<% found_const = true %>
|
5
|
+
<h3 class="inherited">Constants <%= superclass.type == :class ? 'inherited' : 'included' %>
|
6
|
+
from <%= linkify superclass %></h3>
|
7
|
+
<p class="inherited"><%= consts.map {|c| linkify c }.join(", ") %></p>
|
8
|
+
<% end %>
|
@@ -69,6 +69,28 @@ def sort_listing(list)
|
|
69
69
|
list.sort_by {|o| [o.scope.to_s, o.name.to_s.downcase] }
|
70
70
|
end
|
71
71
|
|
72
|
+
def inherited_attr_list(&block)
|
73
|
+
object.inheritance_tree(true)[1..-1].each do |superclass|
|
74
|
+
next if superclass.is_a?(YARD::CodeObjects::Proxy)
|
75
|
+
attribs = superclass.attributes[:instance]
|
76
|
+
attribs = attribs.reject {|name, rw| object.child(:scope => :instance, :name => name) != nil }
|
77
|
+
attribs = attribs.sort_by {|args| args.first.to_s }.map {|n, m| m[:read] || m[:write] }
|
78
|
+
attribs = prune_method_listing(attribs, false)
|
79
|
+
yield superclass, attribs if attribs.size > 0
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def inherited_constant_list(&block)
|
84
|
+
object.inheritance_tree(true)[1..-1].each do |superclass|
|
85
|
+
next if superclass.is_a?(YARD::CodeObjects::Proxy)
|
86
|
+
consts = superclass.constants(:included => false, :inherited => false)
|
87
|
+
consts = consts.reject {|const| object.child(:type => :constant, :name => const.name) != nil }
|
88
|
+
consts = consts.sort_by {|const| const.name.to_s }
|
89
|
+
consts = run_verifier(consts)
|
90
|
+
yield superclass, consts if consts.size > 0
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
72
94
|
def docstring_full(obj)
|
73
95
|
docstring = ""
|
74
96
|
if obj.tags(:overload).size == 1 && obj.docstring.empty?
|
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.7.
|
4
|
+
version: 0.7.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-31 00:00:00.000000000 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
description: ! " YARD is a documentation generation tool for the Ruby programming
|
@@ -308,6 +308,7 @@ files:
|
|
308
308
|
- spec/server/commands/base_spec.rb
|
309
309
|
- spec/server/commands/library_command_spec.rb
|
310
310
|
- spec/server/commands/static_file_command_spec.rb
|
311
|
+
- spec/server/doc_server_helper_spec.rb
|
311
312
|
- spec/server/doc_server_serializer_spec.rb
|
312
313
|
- spec/server/rack_adapter_spec.rb
|
313
314
|
- spec/server/router_spec.rb
|
@@ -344,6 +345,7 @@ files:
|
|
344
345
|
- spec/templates/examples/module001.html
|
345
346
|
- spec/templates/examples/module001.txt
|
346
347
|
- spec/templates/examples/module002.html
|
348
|
+
- spec/templates/examples/module003.html
|
347
349
|
- spec/templates/examples/tag001.txt
|
348
350
|
- spec/templates/helpers/base_helper_spec.rb
|
349
351
|
- spec/templates/helpers/html_helper_spec.rb
|