yard 0.6.1 → 0.6.2
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 +356 -0
- data/README.md +27 -5
- data/docs/GettingStarted.md +45 -6
- data/docs/Tags.md +16 -5
- data/docs/WhatsNew.md +60 -2
- data/lib/yard.rb +16 -37
- data/lib/yard/autoload.rb +5 -0
- data/lib/yard/cli/command.rb +18 -6
- data/lib/yard/cli/command_parser.rb +1 -0
- data/lib/yard/cli/config.rb +113 -0
- data/lib/yard/cli/gems.rb +16 -7
- data/lib/yard/cli/server.rb +30 -8
- data/lib/yard/cli/stats.rb +1 -1
- data/lib/yard/cli/yardoc.rb +16 -1
- data/lib/yard/code_objects/base.rb +7 -2
- data/lib/yard/code_objects/class_object.rb +1 -0
- data/lib/yard/code_objects/method_object.rb +1 -0
- data/lib/yard/code_objects/proxy.rb +8 -2
- data/lib/yard/config.rb +225 -0
- data/lib/yard/handlers/base.rb +29 -2
- data/lib/yard/handlers/processor.rb +1 -1
- data/lib/yard/handlers/ruby/class_handler.rb +6 -1
- data/lib/yard/handlers/ruby/constant_handler.rb +13 -15
- data/lib/yard/handlers/ruby/exception_handler.rb +1 -1
- data/lib/yard/handlers/ruby/extend_handler.rb +3 -0
- data/lib/yard/handlers/ruby/legacy/class_condition_handler.rb +1 -0
- data/lib/yard/handlers/ruby/legacy/class_handler.rb +7 -1
- data/lib/yard/handlers/ruby/legacy/constant_handler.rb +8 -10
- data/lib/yard/handlers/ruby/legacy/exception_handler.rb +1 -1
- data/lib/yard/handlers/ruby/legacy/extend_handler.rb +3 -0
- data/lib/yard/handlers/ruby/legacy/method_handler.rb +1 -0
- data/lib/yard/handlers/ruby/legacy/mixin_handler.rb +13 -2
- data/lib/yard/handlers/ruby/method_handler.rb +1 -0
- data/lib/yard/handlers/ruby/mixin_handler.rb +14 -4
- data/lib/yard/handlers/ruby/struct_handler_methods.rb +10 -1
- data/lib/yard/handlers/ruby/visibility_handler.rb +1 -1
- data/lib/yard/parser/c_parser.rb +26 -11
- data/lib/yard/parser/ruby/legacy/statement_list.rb +26 -9
- data/lib/yard/parser/source_parser.rb +5 -2
- data/lib/yard/serializers/yardoc_serializer.rb +2 -2
- data/lib/yard/server.rb +11 -0
- data/lib/yard/server/commands/frames_command.rb +1 -1
- data/lib/yard/server/commands/library_command.rb +22 -13
- data/lib/yard/server/commands/library_index_command.rb +1 -0
- data/lib/yard/server/commands/search_command.rb +2 -0
- data/lib/yard/server/commands/static_file_command.rb +6 -1
- data/lib/yard/server/templates/doc_server/processing/html/processing.erb +3 -3
- data/lib/yard/templates/helpers/html_helper.rb +1 -1
- data/lib/yard/templates/helpers/markup_helper.rb +13 -12
- data/lib/yard/verifier.rb +3 -1
- data/spec/cli/config_spec.rb +72 -0
- data/spec/cli/gems_spec.rb +81 -0
- data/spec/cli/server_spec.rb +35 -5
- data/spec/cli/stats_spec.rb +15 -0
- data/spec/cli/yardoc_spec.rb +39 -1
- data/spec/code_objects/base_spec.rb +2 -0
- data/spec/code_objects/method_object_spec.rb +5 -0
- data/spec/code_objects/proxy_spec.rb +20 -5
- data/spec/config_spec.rb +165 -0
- data/spec/handlers/alias_handler_spec.rb +7 -0
- data/spec/handlers/base_spec.rb +64 -0
- data/spec/handlers/class_condition_handler_spec.rb +13 -8
- data/spec/handlers/class_handler_spec.rb +54 -46
- data/spec/handlers/constant_handler_spec.rb +13 -0
- data/spec/handlers/examples/alias_handler_001.rb.txt +2 -0
- data/spec/handlers/examples/class_handler_001.rb.txt +12 -1
- data/spec/handlers/examples/constant_handler_001.rb.txt +6 -0
- data/spec/handlers/examples/exception_handler_001.rb.txt +8 -0
- data/spec/handlers/examples/method_handler_001.rb.txt +6 -0
- data/spec/handlers/examples/visibility_handler_001.rb.txt +3 -0
- data/spec/handlers/exception_handler_spec.rb +5 -0
- data/spec/handlers/extend_handler_spec.rb +4 -0
- data/spec/handlers/method_handler_spec.rb +5 -0
- data/spec/handlers/mixin_handler_spec.rb +10 -0
- data/spec/handlers/visibility_handler_spec.rb +4 -0
- data/spec/parser/base_spec.rb +1 -1
- data/spec/parser/c_parser_spec.rb +39 -1
- data/spec/parser/examples/override.c.txt +424 -0
- data/spec/parser/ruby/legacy/statement_list_spec.rb +11 -0
- data/spec/parser/source_parser_spec.rb +33 -1
- data/spec/server/commands/static_file_command_spec.rb +20 -3
- data/spec/server_spec.rb +10 -0
- data/spec/templates/examples/method001.html +33 -3
- data/spec/templates/examples/method001.txt +8 -1
- data/spec/templates/helpers/markup_helper_spec.rb +21 -26
- data/spec/templates/method_spec.rb +3 -1
- data/spec/verifier_spec.rb +5 -0
- data/templates/default/fulldoc/html/css/style.css +4 -1
- data/templates/default/fulldoc/html/js/app.js +1 -1
- data/templates/default/tags/html/option.erb +1 -3
- data/templates/default/tags/setup.rb +18 -15
- metadata +11 -4
- data/spec/yard_spec.rb +0 -55
@@ -270,4 +270,15 @@ eof
|
|
270
270
|
s[1].tokens.to_s.should == "else"
|
271
271
|
s[1].block.to_s.should == "bar"
|
272
272
|
end
|
273
|
+
|
274
|
+
it "should allow aliasing keywords" do
|
275
|
+
['do x', 'x do', 'end begin', 'begin end'].each do |a|
|
276
|
+
s = stmt("alias #{a}\ndef foo; end")
|
277
|
+
s.tokens.to_s.should == "alias #{a}"
|
278
|
+
s.block.should be_nil
|
279
|
+
end
|
280
|
+
|
281
|
+
s = stmt("alias do x if 2 ==\n 2")
|
282
|
+
s.tokens.to_s.should == "alias do x if 2 ==\n 2"
|
283
|
+
end
|
273
284
|
end
|
@@ -204,6 +204,38 @@ describe YARD::Parser::SourceParser do
|
|
204
204
|
File.should_not_receive(:read_binary)
|
205
205
|
YARD.parse(["foo/bar", "foo/baz"], ["foo", /baz$/])
|
206
206
|
end
|
207
|
+
|
208
|
+
it "should convert file contents to proper encoding if coding line is present" do
|
209
|
+
valid = []
|
210
|
+
valid << "# encoding: sjis"
|
211
|
+
valid << "# xxxxxencoding: sjis"
|
212
|
+
valid << "# xxxxxencoding: sjis xxxxxx"
|
213
|
+
valid << "# ENCODING: sjis"
|
214
|
+
valid << "#coDiNG: sjis"
|
215
|
+
valid << "# -*- coding: sjis -*-"
|
216
|
+
valid << "### coding: sjis"
|
217
|
+
valid << "# encoding=sjis"
|
218
|
+
valid << "# encoding:sjis"
|
219
|
+
valid << "# encoding = sjis"
|
220
|
+
valid << "# encoding == sjis"
|
221
|
+
valid << "# encoding : sjis"
|
222
|
+
valid << "# encoding :: sjis"
|
223
|
+
valid << "#!/bin/shebang\n# encoding: sjis"
|
224
|
+
valid << "#!/bin/shebang\r\n# coding: sjis"
|
225
|
+
invalid = []
|
226
|
+
invalid << "#\n# encoding: sjis"
|
227
|
+
invalid << "#!/bin/shebang\n#\n# encoding: sjis"
|
228
|
+
invalid << "# !/bin/shebang\n# encoding: sjis"
|
229
|
+
{:should => valid, :should_not => invalid}.each do |msg, list|
|
230
|
+
list.each do |src|
|
231
|
+
Registry.clear
|
232
|
+
parser = Parser::SourceParser.new
|
233
|
+
File.should_receive(:read_binary).with('tmpfile').and_return(src)
|
234
|
+
result = parser.parse("tmpfile")
|
235
|
+
result.enumerator[0].source.encoding.to_s.send(msg) == 'Shift_JIS'
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end if RUBY19
|
207
239
|
end
|
208
240
|
|
209
241
|
describe '#parse_in_order' do
|
@@ -220,7 +252,7 @@ describe YARD::Parser::SourceParser do
|
|
220
252
|
msgs[2].should =~ /Missing object MyModule/
|
221
253
|
msgs[3].should =~ /Processing .+parse_in_order_002.+/
|
222
254
|
msgs[4].should =~ /Re-processing .+parse_in_order_001.+/
|
223
|
-
end
|
255
|
+
end if CONTINUATIONS_SUPPORTED
|
224
256
|
|
225
257
|
it "should attempt to order files by length (process toplevel files first)" do
|
226
258
|
%w(a a/b a/b/c).each do |file|
|
@@ -17,23 +17,40 @@ describe YARD::Server::Commands::StaticFileCommand do
|
|
17
17
|
|
18
18
|
it "should search through document root before static paths" do
|
19
19
|
File.should_receive(:exist?).with('/c/path/to/file.txt').ordered.and_return(false)
|
20
|
-
StaticFileCommand::STATIC_PATHS.each do |path|
|
20
|
+
StaticFileCommand::STATIC_PATHS.reverse.each do |path|
|
21
21
|
File.should_receive(:exist?).with(File.join(path, 'path/to/file.txt')).ordered.and_return(false)
|
22
22
|
end
|
23
23
|
run '/path/to/file.txt'
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should return file contents if found" do
|
27
|
-
path = File.join(StaticFileCommand::STATIC_PATHS
|
27
|
+
path = File.join(StaticFileCommand::STATIC_PATHS.last, '/path/to/file.txt')
|
28
28
|
File.should_receive(:exist?).with('/c/path/to/file.txt').and_return(false)
|
29
29
|
File.should_receive(:exist?).with(path).and_return(true)
|
30
30
|
File.should_receive(:read).with(path).and_return('FOO')
|
31
31
|
run('/path/to/file.txt', 200, 'FOO')
|
32
32
|
end
|
33
33
|
|
34
|
+
it "should allow registering of new paths and use those before other static paths" do
|
35
|
+
Server.register_static_path '/foo'
|
36
|
+
path = '/foo/path/to/file.txt'
|
37
|
+
File.should_receive(:exist?).with('/c/path/to/file.txt').and_return(false)
|
38
|
+
File.should_receive(:exist?).with(path).and_return(true)
|
39
|
+
File.should_receive(:read).with(path).and_return('FOO')
|
40
|
+
run('/path/to/file.txt', 200, 'FOO')
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should not use registered path before docroot" do
|
44
|
+
Server.register_static_path '/foo'
|
45
|
+
path = '/foo/path/to/file.txt'
|
46
|
+
File.should_receive(:exist?).with('/c/path/to/file.txt').and_return(true)
|
47
|
+
File.should_receive(:read).with('/c/path/to/file.txt').and_return('FOO')
|
48
|
+
run('/c/path/to/file.txt', 200, 'FOO')
|
49
|
+
end
|
50
|
+
|
34
51
|
it "should return 404 if not found" do
|
35
52
|
File.should_receive(:exist?).with('/c/path/to/file.txt').ordered.and_return(false)
|
36
|
-
StaticFileCommand::STATIC_PATHS.each do |path|
|
53
|
+
StaticFileCommand::STATIC_PATHS.reverse.each do |path|
|
37
54
|
File.should_receive(:exist?).with(File.join(path, 'path/to/file.txt')).ordered.and_return(false)
|
38
55
|
end
|
39
56
|
run('/path/to/file.txt', 404)
|
data/spec/server_spec.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
+
|
3
|
+
describe YARD::Server do
|
4
|
+
describe '.register_static_path' do
|
5
|
+
it "should register a static path" do
|
6
|
+
YARD::Server.register_static_path 'foo'
|
7
|
+
YARD::Server::Commands::StaticFileCommand::STATIC_PATHS.last.should == "foo"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -33,7 +33,7 @@ Comments
|
|
33
33
|
|
34
34
|
<li>
|
35
35
|
|
36
|
-
<span class='type'>(<tt>
|
36
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
37
37
|
|
38
38
|
|
39
39
|
<span class='name'>x</span>
|
@@ -46,6 +46,36 @@ Comments
|
|
46
46
|
</li>
|
47
47
|
|
48
48
|
</ul>
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
<h3>Options Hash (<tt>x</tt>):</h3>
|
54
|
+
<ul class="option">
|
55
|
+
|
56
|
+
<li>
|
57
|
+
<span class="type">(<tt>String</tt>)</span>
|
58
|
+
<span class="name">:key1</span>
|
59
|
+
<span class="default">
|
60
|
+
|
61
|
+
— default:
|
62
|
+
<tt>default</tt>
|
63
|
+
|
64
|
+
</span>
|
65
|
+
— <div class='inline'>first key</div>
|
66
|
+
</tr>
|
67
|
+
|
68
|
+
<li>
|
69
|
+
<span class="type">(<tt>Symbol</tt>)</span>
|
70
|
+
<span class="name">:key2</span>
|
71
|
+
<span class="default">
|
72
|
+
|
73
|
+
</span>
|
74
|
+
— <div class='inline'>second key</div>
|
75
|
+
</tr>
|
76
|
+
|
77
|
+
</ul>
|
78
|
+
|
49
79
|
<h3>Returns:</h3>
|
50
80
|
<ul class="return">
|
51
81
|
|
@@ -85,10 +115,10 @@ Comments
|
|
85
115
|
<pre class="lines">
|
86
116
|
|
87
117
|
|
88
|
-
|
118
|
+
9</pre>
|
89
119
|
</td>
|
90
120
|
<td>
|
91
|
-
<pre class="code"><span class="info file"># File '(stdin)', line
|
121
|
+
<pre class="code"><span class="info file"># File '(stdin)', line 9</span>
|
92
122
|
|
93
123
|
def m(x) end</pre>
|
94
124
|
</td>
|
@@ -12,7 +12,14 @@
|
|
12
12
|
Parameters:
|
13
13
|
-----------
|
14
14
|
|
15
|
-
(
|
15
|
+
(Hash) x - the x argument
|
16
|
+
|
17
|
+
Options Hash (x):
|
18
|
+
-----------------
|
19
|
+
|
20
|
+
(String) :key1 - default: default - first key
|
21
|
+
|
22
|
+
(Symbol) :key2 - second key
|
16
23
|
|
17
24
|
Returns:
|
18
25
|
--------
|
@@ -12,37 +12,25 @@ end
|
|
12
12
|
describe YARD::Templates::Helpers::MarkupHelper do
|
13
13
|
describe '#load_markup_provider' do
|
14
14
|
before do
|
15
|
+
log.stub!(:error)
|
15
16
|
@gen = mock('Generator')
|
16
17
|
@gen.extend(YARD::Templates::Helpers::MarkupHelper)
|
17
18
|
end
|
18
19
|
|
19
|
-
def generator_should_exit
|
20
|
-
STDERR.should_receive(:puts)
|
21
|
-
@gen.should_receive(:exit)
|
22
|
-
end
|
23
|
-
|
24
20
|
it "should exit on an invalid markup type" do
|
25
|
-
generator_should_exit
|
26
21
|
@gen.stub!(:options).and_return({:markup => :invalid})
|
27
|
-
|
28
|
-
# it will raise since providers == nil
|
29
|
-
# but in reality it would have already `exit`ed.
|
30
|
-
@gen.load_markup_provider rescue nil
|
22
|
+
@gen.load_markup_provider.should == false
|
31
23
|
end
|
32
24
|
|
33
|
-
it "should
|
34
|
-
generator_should_exit
|
25
|
+
it "should fail on when an invalid markup provider is specified" do
|
35
26
|
@gen.stub!(:options).and_return({:markup => :markdown, :markup_provider => :invalid})
|
36
|
-
|
37
|
-
# it will raise since providers == nil
|
38
|
-
# but in reality it would have already `exit`ed.
|
39
|
-
@gen.load_markup_provider rescue nil
|
27
|
+
@gen.load_markup_provider.should == false
|
40
28
|
@gen.markup_class.should == nil
|
41
29
|
end
|
42
30
|
|
43
31
|
it "should load nothing if rdoc is specified" do
|
44
32
|
@gen.stub!(:options).and_return({:markup => :rdoc})
|
45
|
-
@gen.load_markup_provider
|
33
|
+
@gen.load_markup_provider.should == true
|
46
34
|
@gen.markup_class.should == YARD::Templates::Helpers::MarkupHelper::SimpleMarkup
|
47
35
|
end
|
48
36
|
|
@@ -52,44 +40,51 @@ describe YARD::Templates::Helpers::MarkupHelper do
|
|
52
40
|
# this only raises an exception because we mock out require to avoid
|
53
41
|
# loading any libraries but our implementation tries to return the library
|
54
42
|
# name as a constant
|
55
|
-
@gen.load_markup_provider rescue nil
|
43
|
+
@gen.load_markup_provider.should rescue nil
|
56
44
|
@gen.markup_provider.should == :bluecloth
|
57
45
|
end
|
58
46
|
|
59
47
|
it "should continue searching if some of the providers are unavailable" do
|
60
48
|
@gen.should_receive(:require).with('bluecloth').and_raise(LoadError)
|
61
49
|
@gen.should_receive(:require).with('maruku').and_raise(LoadError)
|
62
|
-
@gen.should_receive(:require).with('rpeg-markdown').
|
50
|
+
@gen.should_receive(:require).with('rpeg-markdown').and_raise(LoadError)
|
51
|
+
@gen.should_receive(:require).with('rdiscount').and_raise(LoadError)
|
52
|
+
@gen.should_receive(:require).with('kramdown').and_return(true)
|
63
53
|
@gen.stub!(:options).and_return({:markup => :markdown})
|
64
54
|
# this only raises an exception because we mock out require to avoid
|
65
55
|
# loading any libraries but our implementation tries to return the library
|
66
56
|
# name as a constant
|
67
|
-
@gen.load_markup_provider rescue nil
|
68
|
-
@gen.markup_provider.should == :"
|
57
|
+
@gen.load_markup_provider.should rescue nil
|
58
|
+
@gen.markup_provider.should == :"kramdown"
|
69
59
|
end
|
70
60
|
|
71
61
|
it "should override the search if `:markup_provider` is set in options" do
|
72
62
|
@gen.should_receive(:require).with('rdiscount').and_return(true)
|
73
63
|
@gen.stub!(:options).and_return({:markup => :markdown, :markup_provider => :rdiscount})
|
74
|
-
@gen.load_markup_provider rescue nil
|
64
|
+
@gen.load_markup_provider.should rescue nil
|
75
65
|
@gen.markup_provider.should == :rdiscount
|
76
66
|
end
|
77
67
|
|
78
68
|
it "should fail if no provider is found" do
|
79
|
-
generator_should_exit
|
80
69
|
YARD::Templates::Helpers::MarkupHelper::MARKUP_PROVIDERS[:markdown].each do |p|
|
81
70
|
@gen.should_receive(:require).with(p[:lib].to_s).and_raise(LoadError)
|
82
71
|
end
|
83
72
|
@gen.stub!(:options).and_return({:markup => :markdown})
|
84
|
-
@gen.load_markup_provider
|
73
|
+
@gen.load_markup_provider.should == false
|
85
74
|
@gen.markup_provider.should == nil
|
86
75
|
end
|
87
76
|
|
88
77
|
it "should fail if overridden provider is not found" do
|
89
|
-
generator_should_exit
|
90
78
|
@gen.should_receive(:require).with('rdiscount').and_raise(LoadError)
|
91
79
|
@gen.stub!(:options).and_return({:markup => :markdown, :markup_provider => :rdiscount})
|
92
|
-
@gen.load_markup_provider
|
80
|
+
@gen.load_markup_provider.should == false
|
81
|
+
@gen.markup_provider.should == nil
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should fail if the markup type is not found" do
|
85
|
+
log.should_receive(:error).with(/Invalid markup/)
|
86
|
+
@gen.stub!(:options).and_return(:markup => :xxx)
|
87
|
+
@gen.load_markup_provider.should == false
|
93
88
|
@gen.markup_provider.should == nil
|
94
89
|
end
|
95
90
|
end
|
@@ -22,7 +22,9 @@ describe YARD::Templates::Engine.template(:default, :method) do
|
|
22
22
|
YARD.parse_string <<-'eof'
|
23
23
|
private
|
24
24
|
# Comments
|
25
|
-
# @param [
|
25
|
+
# @param [Hash] x the x argument
|
26
|
+
# @option x [String] :key1 (default) first key
|
27
|
+
# @option x [Symbol] :key2 second key
|
26
28
|
# @return [String] the result
|
27
29
|
# @raise [Exception] hi!
|
28
30
|
# @deprecated for great justice
|
data/spec/verifier_spec.rb
CHANGED
@@ -51,6 +51,11 @@ describe YARD::Verifier do
|
|
51
51
|
it "should not fail if no expressions were added" do
|
52
52
|
lambda { Verifier.new.call(nil) }.should_not raise_error
|
53
53
|
end
|
54
|
+
|
55
|
+
it "should always ignore proxy objects and return true" do
|
56
|
+
v = Verifier.new('tag(:x)')
|
57
|
+
lambda { v.call(P('foo')).should == true }.should_not raise_error
|
58
|
+
end
|
54
59
|
end
|
55
60
|
|
56
61
|
describe '#expressions' do
|
@@ -35,12 +35,15 @@ h2 small { font-weight: normal; font-size: 0.7em; display: block; float: right;
|
|
35
35
|
.note.returns_void { background: #efefef; }
|
36
36
|
.note.deprecated { background: #ffe5e5; border-color: #e9dada; }
|
37
37
|
.note.private { background: #ffffc5; border-color: #ececaa; }
|
38
|
-
.note.title { text-transform: lowercase; padding: 1px 5px;
|
38
|
+
.note.title { text-transform: lowercase; padding: 1px 5px; font-size: 0.9em; font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; display: inline; }
|
39
|
+
.summary_signature + .note.title { margin-left: 7px; }
|
39
40
|
h1 .note.title { font-size: 0.5em; font-weight: normal; padding: 3px 5px; position: relative; top: -3px; text-transform: capitalize; }
|
40
41
|
.note.title.constructor { color: #fff; background: #6a98d6; border-color: #6689d6; }
|
41
42
|
.note.title.writeonly { color: #fff; background: #45a638; border-color: #2da31d; }
|
42
43
|
.note.title.readonly { color: #fff; background: #6a98d6; border-color: #6689d6; }
|
43
44
|
.note.title.private { background: #d5d5d5; border-color: #c5c5c5; }
|
45
|
+
.discussion .note { margin-top: 6px; }
|
46
|
+
.discussion .note:first-child { margin-top: 0; }
|
44
47
|
|
45
48
|
h3.inherited {
|
46
49
|
font-style: italic;
|
@@ -152,7 +152,7 @@ function generateTOC() {
|
|
152
152
|
show = true;
|
153
153
|
var thisTag = parseInt(this.tagName[1]);
|
154
154
|
if (this.id.length == 0) {
|
155
|
-
var proposedId = $(this).text().replace(/[^a-z0-9
|
155
|
+
var proposedId = $(this).text().replace(/[^a-z0-9:\.()=-]/ig, '_');
|
156
156
|
if ($('#' + proposedId).length > 0) proposedId += counter++;
|
157
157
|
this.id = proposedId;
|
158
158
|
}
|
@@ -12,11 +12,9 @@
|
|
12
12
|
<% if tag.pair.defaults %>
|
13
13
|
— default:
|
14
14
|
<%= tag.pair.defaults.map {|t| "<tt>#{h t}</tt>" }.join(", ") %>
|
15
|
-
<% else %>
|
16
|
-
<span class="na">N/A</span>
|
17
15
|
<% end %>
|
18
16
|
</span>
|
19
|
-
<%= "—" + htmlify_line(tag.pair.text) if tag.pair.text %>
|
17
|
+
<%= "— " + htmlify_line(tag.pair.text) if tag.pair.text %>
|
20
18
|
</tr>
|
21
19
|
<% end %>
|
22
20
|
</ul>
|
@@ -10,13 +10,14 @@ def return
|
|
10
10
|
return if object.name == :initialize && object.scope == :instance
|
11
11
|
return if object.tags(:return).size == 1 && object.tag(:return).types == ['void']
|
12
12
|
end
|
13
|
-
tag
|
13
|
+
tag(:return)
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
17
17
|
|
18
|
-
def tag(name, opts =
|
18
|
+
def tag(name, opts = nil)
|
19
19
|
return unless object.has_tag?(name)
|
20
|
+
opts ||= options_for_tag(name)
|
20
21
|
@no_names = true if opts[:no_names]
|
21
22
|
@no_types = true if opts[:no_types]
|
22
23
|
@name = name
|
@@ -29,19 +30,21 @@ def create_tag_methods(tags)
|
|
29
30
|
tags.each do |tag|
|
30
31
|
next if respond_to?(tag)
|
31
32
|
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
|
33
|
+
def #{tag}; tag(#{tag.inspect}) end
|
45
34
|
eof
|
46
35
|
end
|
47
36
|
end
|
37
|
+
|
38
|
+
def options_for_tag(tag)
|
39
|
+
opts = {:no_types => true, :no_names => true}
|
40
|
+
case Tags::Library.factory_method_for(tag)
|
41
|
+
when :with_types
|
42
|
+
opts[:no_types] = false
|
43
|
+
when :with_types_and_name
|
44
|
+
opts[:no_types] = false
|
45
|
+
opts[:no_names] = false
|
46
|
+
when :with_name
|
47
|
+
opts[:no_names] = false
|
48
|
+
end
|
49
|
+
opts
|
50
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 6
|
8
|
-
-
|
9
|
-
version: 0.6.
|
8
|
+
- 2
|
9
|
+
version: 0.6.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Loren Segal
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-11-15 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- lib/yard/autoload.rb
|
53
53
|
- lib/yard/cli/command.rb
|
54
54
|
- lib/yard/cli/command_parser.rb
|
55
|
+
- lib/yard/cli/config.rb
|
55
56
|
- lib/yard/cli/diff.rb
|
56
57
|
- lib/yard/cli/gems.rb
|
57
58
|
- lib/yard/cli/graph.rb
|
@@ -70,6 +71,7 @@ files:
|
|
70
71
|
- lib/yard/code_objects/namespace_object.rb
|
71
72
|
- lib/yard/code_objects/proxy.rb
|
72
73
|
- lib/yard/code_objects/root_object.rb
|
74
|
+
- lib/yard/config.rb
|
73
75
|
- lib/yard/core_ext/array.rb
|
74
76
|
- lib/yard/core_ext/file.rb
|
75
77
|
- lib/yard/core_ext/hash.rb
|
@@ -168,6 +170,7 @@ files:
|
|
168
170
|
- lib/yard/server/templates/doc_server/search/html/search.erb
|
169
171
|
- lib/yard/server/templates/doc_server/search/html/setup.rb
|
170
172
|
- lib/yard/server/webrick_adapter.rb
|
173
|
+
- lib/yard/server.rb
|
171
174
|
- lib/yard/tags/default_factory.rb
|
172
175
|
- lib/yard/tags/default_tag.rb
|
173
176
|
- lib/yard/tags/library.rb
|
@@ -194,7 +197,9 @@ files:
|
|
194
197
|
- lib/yard/verifier.rb
|
195
198
|
- lib/yard.rb
|
196
199
|
- spec/cli/command_parser_spec.rb
|
200
|
+
- spec/cli/config_spec.rb
|
197
201
|
- spec/cli/diff_spec.rb
|
202
|
+
- spec/cli/gems_spec.rb
|
198
203
|
- spec/cli/help_spec.rb
|
199
204
|
- spec/cli/server_spec.rb
|
200
205
|
- spec/cli/stats_spec.rb
|
@@ -209,6 +214,7 @@ files:
|
|
209
214
|
- spec/code_objects/namespace_object_spec.rb
|
210
215
|
- spec/code_objects/proxy_spec.rb
|
211
216
|
- spec/code_objects/spec_helper.rb
|
217
|
+
- spec/config_spec.rb
|
212
218
|
- spec/core_ext/array_spec.rb
|
213
219
|
- spec/core_ext/file_spec.rb
|
214
220
|
- spec/core_ext/hash_spec.rb
|
@@ -257,6 +263,7 @@ files:
|
|
257
263
|
- spec/parser/c_parser_spec.rb
|
258
264
|
- spec/parser/examples/array.c.txt
|
259
265
|
- spec/parser/examples/example1.rb.txt
|
266
|
+
- spec/parser/examples/override.c.txt
|
260
267
|
- spec/parser/examples/parse_in_order_001.rb.txt
|
261
268
|
- spec/parser/examples/parse_in_order_002.rb.txt
|
262
269
|
- spec/parser/examples/tag_handler_001.rb.txt
|
@@ -286,6 +293,7 @@ files:
|
|
286
293
|
- spec/server/spec_helper.rb
|
287
294
|
- spec/server/static_caching_spec.rb
|
288
295
|
- spec/server/webrick_servlet_spec.rb
|
296
|
+
- spec/server_spec.rb
|
289
297
|
- spec/spec_helper.rb
|
290
298
|
- spec/tags/default_factory_spec.rb
|
291
299
|
- spec/tags/default_tag_spec.rb
|
@@ -330,7 +338,6 @@ files:
|
|
330
338
|
- spec/templates/tag_spec.rb
|
331
339
|
- spec/templates/template_spec.rb
|
332
340
|
- spec/verifier_spec.rb
|
333
|
-
- spec/yard_spec.rb
|
334
341
|
- templates/default/class/dot/setup.rb
|
335
342
|
- templates/default/class/dot/superklass.erb
|
336
343
|
- templates/default/class/html/constructor_details.erb
|