yard 0.2.3 → 0.2.3.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/.yardopts +12 -0
- data/README.markdown +20 -2
- data/Rakefile +3 -2
- data/lib/rubygems_plugin.rb +91 -0
- data/lib/yard.rb +2 -1
- data/lib/yard/cli/yardoc.rb +41 -9
- data/lib/yard/code_objects/base.rb +2 -12
- data/lib/yard/docstring.rb +19 -8
- data/lib/yard/generators/full_doc_generator.rb +2 -1
- data/lib/yard/generators/helpers/html_helper.rb +6 -2
- data/lib/yard/generators/tags_generator.rb +23 -2
- data/lib/yard/handlers/base.rb +6 -5
- data/lib/yard/parser/ruby/ast_node.rb +2 -1
- data/lib/yard/parser/ruby/legacy/ruby_lex.rb +9 -1
- data/lib/yard/parser/ruby/legacy/statement.rb +24 -16
- data/lib/yard/parser/ruby/legacy/statement_list.rb +82 -13
- data/lib/yard/parser/ruby/legacy/token_list.rb +10 -2
- data/lib/yard/parser/ruby/ruby_parser.rb +1 -0
- data/lib/yard/parser/source_parser.rb +1 -5
- data/lib/yard/tags/library.rb +1 -1
- data/lib/yard/tags/overload_tag.rb +1 -0
- data/spec/cli/yardoc_spec.rb +33 -0
- data/spec/docstring_spec.rb +24 -0
- data/spec/generators/helpers/html_helper_spec.rb +104 -102
- data/spec/handlers/ruby/legacy/base_spec.rb +25 -0
- data/spec/parser/examples/parse_in_order_001.rb.txt +2 -0
- data/spec/parser/examples/parse_in_order_002.rb.txt +2 -0
- data/spec/parser/ruby/ast_node_spec.rb +13 -9
- data/spec/parser/ruby/legacy/statement_list_spec.rb +122 -44
- data/spec/parser/ruby/legacy/token_list_spec.rb +57 -23
- data/spec/parser/ruby/ruby_parser_spec.rb +53 -0
- data/spec/parser/source_parser_spec.rb +59 -16
- data/spec/spec_helper.rb +2 -4
- data/spec/tags/library_spec.rb +23 -0
- data/templates/default/deprecated/html/main.erb +5 -3
- data/templates/default/fulldoc/html/all_methods.erb +1 -1
- data/templates/default/fulldoc/html/all_namespaces.erb +1 -1
- data/templates/default/fulldoc/html/custom.css +1 -0
- data/templates/default/fulldoc/html/file.erb +1 -0
- data/templates/default/fulldoc/html/footer.erb +5 -0
- data/templates/default/fulldoc/html/header.erb +1 -0
- data/templates/default/fulldoc/html/html_head.erb +1 -0
- data/templates/default/fulldoc/html/index.erb +1 -1
- data/templates/default/fulldoc/html/style.css +6 -0
- data/templates/default/tags/html/see.erb +1 -1
- metadata +13 -5
@@ -5,24 +5,67 @@ describe YARD::Parser::SourceParser do
|
|
5
5
|
Registry.clear
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
describe '#parse_string' do
|
9
|
+
it "should parse basic Ruby code" do
|
10
|
+
Parser::SourceParser.parse_string(<<-eof)
|
11
|
+
module Hello
|
12
|
+
class Hi
|
13
|
+
# Docstring
|
14
|
+
# Docstring2
|
15
|
+
def me; "VALUE" end
|
16
|
+
end
|
14
17
|
end
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
eof
|
19
|
+
Registry.at(:Hello).should_not == nil
|
20
|
+
Registry.at("Hello::Hi#me").should_not == nil
|
21
|
+
Registry.at("Hello::Hi#me").docstring.should == "Docstring\nDocstring2"
|
22
|
+
Registry.at("Hello::Hi#me").docstring.line_range.should == (3..4)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#parse' do
|
27
|
+
it "should parse a basic Ruby file" do
|
28
|
+
parse_file :example1, __FILE__
|
29
|
+
Registry.at(:Hello).should_not == nil
|
30
|
+
Registry.at("Hello::Hi#me").should_not == nil
|
31
|
+
Registry.at("Hello::Hi#me").docstring.should == "Docstring"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should parse a set of file globs" do
|
35
|
+
Dir.should_receive(:[]).with('lib/**/*.rb')
|
36
|
+
YARD.parse('lib/**/*.rb')
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should parse a set of absolute paths" do
|
40
|
+
Dir.should_not_receive(:[])
|
41
|
+
IO.should_receive(:read).with('/path/to/file').and_return("")
|
42
|
+
YARD.parse('/path/to/file')
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should parse files with '*' in them as globs and others as absolute paths" do
|
46
|
+
Dir.should_receive(:[]).with('*.rb').and_return(['a.rb', 'b.rb'])
|
47
|
+
IO.should_receive(:read).with('/path/to/file').and_return("")
|
48
|
+
IO.should_receive(:read).with('a.rb').and_return("")
|
49
|
+
IO.should_receive(:read).with('b.rb').and_return("")
|
50
|
+
YARD.parse ['/path/to/file', '*.rb']
|
51
|
+
end
|
20
52
|
end
|
21
53
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
54
|
+
describe '#parse_in_order' do
|
55
|
+
def in_order_parse(*files)
|
56
|
+
paths = files.map {|f| File.join(File.dirname(__FILE__), 'examples', f.to_s + '.rb.txt') }
|
57
|
+
YARD::Parser::SourceParser.parse(paths, Logger::DEBUG)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should attempt to parse files in order" do
|
61
|
+
msgs = []
|
62
|
+
log.should_receive(:debug) {|m| msgs << m }.at_least(:once)
|
63
|
+
in_order_parse 'parse_in_order_001', 'parse_in_order_002'
|
64
|
+
msgs[1].should =~ /Processing .+parse_in_order_001.+/
|
65
|
+
msgs[2].should =~ /Missing object MyModule/
|
66
|
+
msgs[3].should =~ /Processing .+parse_in_order_002.+/
|
67
|
+
msgs[4].should =~ /Re-processing .+parse_in_order_001.+/
|
68
|
+
msgs[5].should =~ /Object MyModule successfully resolved/
|
69
|
+
end
|
27
70
|
end
|
28
71
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,12 +3,10 @@ require "spec"
|
|
3
3
|
|
4
4
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'yard'))
|
5
5
|
|
6
|
-
def parse_file(file, thisfile = __FILE__)
|
6
|
+
def parse_file(file, thisfile = __FILE__, log_level = log.level)
|
7
7
|
Registry.clear
|
8
8
|
path = File.join(File.dirname(thisfile), 'examples', file.to_s + '.rb.txt')
|
9
|
-
|
10
|
-
p.parse(path)
|
11
|
-
p
|
9
|
+
YARD::Parser::SourceParser.parse(path, log_level)
|
12
10
|
end
|
13
11
|
|
14
12
|
def described_in_docs(klass, meth, file = nil)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe YARD::Tags::Library do
|
4
|
+
def tag(docstring)
|
5
|
+
Docstring.new(docstring).tags.first
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#see_tag' do
|
9
|
+
it "should take a URL" do
|
10
|
+
tag("@see http://example.com").name.should == "http://example.com"
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should take an object path" do
|
14
|
+
tag("@see String#reverse").name.should == "String#reverse"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should take a description after the url/object" do
|
18
|
+
tag = tag("@see http://example.com An Example Site")
|
19
|
+
tag.name.should == "http://example.com"
|
20
|
+
tag.text.should == "An Example Site"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
<
|
2
|
-
<
|
3
|
-
|
1
|
+
<div class="section <%= generator_name %>">
|
2
|
+
<p>
|
3
|
+
<strong>Deprecated.</strong> <em><%= htmlify(object.tag(:deprecated).text).gsub(/<\/?p>/, '') %></em>
|
4
|
+
</p>
|
5
|
+
</div>
|
4
6
|
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<h1>Method List</h1>
|
12
12
|
<ul>
|
13
13
|
<% for obj in objects %>
|
14
|
-
<li nowrap="nowrap">
|
14
|
+
<li nowrap="nowrap" class="<%= 'deprecated' if obj.has_tag?(:deprecated) %>">
|
15
15
|
<%= linkify(obj, (obj.scope == :class ? '' : '#') + obj.name.to_s, nil, false) %>
|
16
16
|
<% if obj.namespace == Registry.root %>
|
17
17
|
<em>(Global method)</em>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<li><%= linkify(root, "Top Level Namespace", nil, false) %></li>
|
15
15
|
<% end %>
|
16
16
|
<% for obj in objects %>
|
17
|
-
<li><%= linkify(obj) %> <em>(<%= obj.type %>)</em></li>
|
17
|
+
<li class="<%= 'deprecated' if obj.has_tag?(:deprecated) %>"><%= linkify(obj) %> <em>(<%= obj.type %>)</em></li>
|
18
18
|
<% end %>
|
19
19
|
</ul>
|
20
20
|
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
/* Override this stylesheet in your templates directory with any extra declarations */
|
@@ -1,3 +1,4 @@
|
|
1
1
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
2
2
|
<link rel="stylesheet" href="<%= url_for(css_file) %>" type="text/css" charset="utf-8" />
|
3
|
+
<link rel="stylesheet" href="<%= url_for(css_custom_file) %>" type="text/css" charset="utf-8" />
|
3
4
|
<link rel="stylesheet" href="<%= url_for(css_syntax_file) %>" type="text/css" charset="utf-8" />
|
@@ -1,6 +1,7 @@
|
|
1
1
|
body { font-family: Myriad, Helvetica, Arial, Verdana, sans-serif; font-size: 10pt; }
|
2
2
|
#nav ul { list-style: none; padding: 0; margin: 0; }
|
3
3
|
#nav ul li { white-space: nowrap; }
|
4
|
+
#nav ul li.deprecated a { text-decoration: line-through; font-style: italic; }
|
4
5
|
#nav li em { font-size: 0.9em; color: #999; }
|
5
6
|
#nav h1 { font-size: 1.2em; }
|
6
7
|
h1 { font-size: 1.5em; background: #eee; color: #000; padding: 3px; text-decoration: none; }
|
@@ -20,6 +21,7 @@ h3 { font-size: 1.0em; }
|
|
20
21
|
.section.tags,.section.docstring,.section.source { padding: 5px 12px; }
|
21
22
|
.section.method .details_title { font-size: 1.1em; background: #dde; padding: 7px; }
|
22
23
|
.overload .section.method .details_title { background: #e2e2ea; }
|
24
|
+
.overload .section.source { display: none; }
|
23
25
|
.section.method .details_title p.aliases { padding: 0; margin: 0; font-style: italic; font-size: 0.9em; }
|
24
26
|
.section.method .details_title p.aliases tt { font-weight: bold; font-style: normal; font-size: 1.1em; }
|
25
27
|
.section.constants dl { font-family: monospace; }
|
@@ -43,6 +45,7 @@ h3 { font-size: 1.0em; }
|
|
43
45
|
.section.attributes .docstring { width: 80%; }
|
44
46
|
.section.attributes .docstring * { display: inline; }
|
45
47
|
.section.attributes tr.hasaliases td, .section.attributes tr.hasaliases th { padding-bottom: 0; }
|
48
|
+
.section.deprecated { margin-left: 15px; }
|
46
49
|
.section.inheritance { background: #ddd; padding: 5px; border: 1px solid #ccc; border-top: 0; }
|
47
50
|
.section.inheritance ul { list-style: none; padding-left: 2.2em; margin: 0; }
|
48
51
|
.section.inheritance ul li { line-height: 1.2em; }
|
@@ -73,3 +76,6 @@ h3 { font-size: 1.0em; }
|
|
73
76
|
.included div, .inherited div { color: #444; margin: 1.5em 0; width: 47%; border: 1px solid #ccc; float: left; margin-right: 12px; }
|
74
77
|
.included p .name, .inherited p .name { font-family: monospace; }
|
75
78
|
.included p, .inherited p { margin: 5px; }
|
79
|
+
#yard_info a:link, #yard_info a:visited { color: #333; }
|
80
|
+
#yard_info { margin-top: 12px; margin-bottom: 7px; text-align: center; color: #444; background: #ddd; padding: 8px; border: 1px solid #ccc; font-size: 0.8em; }
|
81
|
+
#yard_info .yard { font-weight: bold; }
|
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.2.3
|
4
|
+
version: 0.2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loren Segal
|
@@ -9,11 +9,11 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06
|
12
|
+
date: 2009-07-06 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
16
|
+
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"
|
17
17
|
email: lsegal@soen.ca
|
18
18
|
executables:
|
19
19
|
- yardoc
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- bin/yard-graph
|
44
44
|
- bin/yardoc
|
45
45
|
- bin/yri
|
46
|
+
- lib/rubygems_plugin.rb
|
46
47
|
- lib/yard/autoload.rb
|
47
48
|
- lib/yard/cli/yard_graph.rb
|
48
49
|
- lib/yard/cli/yardoc.rb
|
@@ -202,10 +203,13 @@ files:
|
|
202
203
|
- spec/handlers/visibility_handler_spec.rb
|
203
204
|
- spec/handlers/yield_handler_spec.rb
|
204
205
|
- spec/parser/examples/example1.rb.txt
|
206
|
+
- spec/parser/examples/parse_in_order_001.rb.txt
|
207
|
+
- spec/parser/examples/parse_in_order_002.rb.txt
|
205
208
|
- spec/parser/examples/tag_handler_001.rb.txt
|
206
209
|
- spec/parser/ruby/ast_node_spec.rb
|
207
210
|
- spec/parser/ruby/legacy/statement_list_spec.rb
|
208
211
|
- spec/parser/ruby/legacy/token_list_spec.rb
|
212
|
+
- spec/parser/ruby/ruby_parser_spec.rb
|
209
213
|
- spec/parser/source_parser_spec.rb
|
210
214
|
- spec/parser/tag_parsing_spec.rb
|
211
215
|
- spec/rake/yardoc_task_spec.rb
|
@@ -215,6 +219,7 @@ files:
|
|
215
219
|
- spec/spec_helper.rb
|
216
220
|
- spec/tags/default_factory_spec.rb
|
217
221
|
- spec/tags/default_tag_spec.rb
|
222
|
+
- spec/tags/library_spec.rb
|
218
223
|
- spec/tags/overload_tag_spec.rb
|
219
224
|
- spec/tags/ref_tag_list_spec.rb
|
220
225
|
- templates/default/attributes/html/header.erb
|
@@ -233,7 +238,9 @@ files:
|
|
233
238
|
- templates/default/fulldoc/html/all_methods.erb
|
234
239
|
- templates/default/fulldoc/html/all_namespaces.erb
|
235
240
|
- templates/default/fulldoc/html/app.js
|
241
|
+
- templates/default/fulldoc/html/custom.css
|
236
242
|
- templates/default/fulldoc/html/file.erb
|
243
|
+
- templates/default/fulldoc/html/footer.erb
|
237
244
|
- templates/default/fulldoc/html/header.erb
|
238
245
|
- templates/default/fulldoc/html/html_head.erb
|
239
246
|
- templates/default/fulldoc/html/index.erb
|
@@ -339,7 +346,8 @@ files:
|
|
339
346
|
- LICENSE
|
340
347
|
- README.markdown
|
341
348
|
- Rakefile
|
342
|
-
|
349
|
+
- .yardopts
|
350
|
+
has_rdoc: yard
|
343
351
|
homepage: http://yard.soen.ca
|
344
352
|
licenses: []
|
345
353
|
|
@@ -363,7 +371,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
363
371
|
requirements: []
|
364
372
|
|
365
373
|
rubyforge_project: yard
|
366
|
-
rubygems_version: 1.3.
|
374
|
+
rubygems_version: 1.3.4
|
367
375
|
signing_key:
|
368
376
|
specification_version: 3
|
369
377
|
summary: Documentation tool for consistent and usable documentation in Ruby.
|