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.

Files changed (46) hide show
  1. data/.yardopts +12 -0
  2. data/README.markdown +20 -2
  3. data/Rakefile +3 -2
  4. data/lib/rubygems_plugin.rb +91 -0
  5. data/lib/yard.rb +2 -1
  6. data/lib/yard/cli/yardoc.rb +41 -9
  7. data/lib/yard/code_objects/base.rb +2 -12
  8. data/lib/yard/docstring.rb +19 -8
  9. data/lib/yard/generators/full_doc_generator.rb +2 -1
  10. data/lib/yard/generators/helpers/html_helper.rb +6 -2
  11. data/lib/yard/generators/tags_generator.rb +23 -2
  12. data/lib/yard/handlers/base.rb +6 -5
  13. data/lib/yard/parser/ruby/ast_node.rb +2 -1
  14. data/lib/yard/parser/ruby/legacy/ruby_lex.rb +9 -1
  15. data/lib/yard/parser/ruby/legacy/statement.rb +24 -16
  16. data/lib/yard/parser/ruby/legacy/statement_list.rb +82 -13
  17. data/lib/yard/parser/ruby/legacy/token_list.rb +10 -2
  18. data/lib/yard/parser/ruby/ruby_parser.rb +1 -0
  19. data/lib/yard/parser/source_parser.rb +1 -5
  20. data/lib/yard/tags/library.rb +1 -1
  21. data/lib/yard/tags/overload_tag.rb +1 -0
  22. data/spec/cli/yardoc_spec.rb +33 -0
  23. data/spec/docstring_spec.rb +24 -0
  24. data/spec/generators/helpers/html_helper_spec.rb +104 -102
  25. data/spec/handlers/ruby/legacy/base_spec.rb +25 -0
  26. data/spec/parser/examples/parse_in_order_001.rb.txt +2 -0
  27. data/spec/parser/examples/parse_in_order_002.rb.txt +2 -0
  28. data/spec/parser/ruby/ast_node_spec.rb +13 -9
  29. data/spec/parser/ruby/legacy/statement_list_spec.rb +122 -44
  30. data/spec/parser/ruby/legacy/token_list_spec.rb +57 -23
  31. data/spec/parser/ruby/ruby_parser_spec.rb +53 -0
  32. data/spec/parser/source_parser_spec.rb +59 -16
  33. data/spec/spec_helper.rb +2 -4
  34. data/spec/tags/library_spec.rb +23 -0
  35. data/templates/default/deprecated/html/main.erb +5 -3
  36. data/templates/default/fulldoc/html/all_methods.erb +1 -1
  37. data/templates/default/fulldoc/html/all_namespaces.erb +1 -1
  38. data/templates/default/fulldoc/html/custom.css +1 -0
  39. data/templates/default/fulldoc/html/file.erb +1 -0
  40. data/templates/default/fulldoc/html/footer.erb +5 -0
  41. data/templates/default/fulldoc/html/header.erb +1 -0
  42. data/templates/default/fulldoc/html/html_head.erb +1 -0
  43. data/templates/default/fulldoc/html/index.erb +1 -1
  44. data/templates/default/fulldoc/html/style.css +6 -0
  45. data/templates/default/tags/html/see.erb +1 -1
  46. metadata +13 -5
@@ -5,24 +5,67 @@ describe YARD::Parser::SourceParser do
5
5
  Registry.clear
6
6
  end
7
7
 
8
- it "should parse basic Ruby code" do
9
- Parser::SourceParser.parse_string(<<-eof)
10
- module Hello
11
- class Hi
12
- # Docstring
13
- def me; "VALUE" end
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
- end
16
- eof
17
- Registry.at(:Hello).should_not == nil
18
- Registry.at("Hello::Hi#me").should_not == nil
19
- Registry.at("Hello::Hi#me").docstring.should == "Docstring"
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
- it "should parse a basic Ruby file" do
23
- parse_file :example1, __FILE__
24
- Registry.at(:Hello).should_not == nil
25
- Registry.at("Hello::Hi#me").should_not == nil
26
- Registry.at("Hello::Hi#me").docstring.should == "Docstring"
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
@@ -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
- p = YARD::Parser::SourceParser.new
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
- <p class="section <%= generator_name %>">
2
- <strong>Deprecated.</strong> <em><%= htmlify object.tag(:deprecated).text %></em>
3
- </p>
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 */
@@ -11,5 +11,6 @@
11
11
  <%= htmlify @contents, markup_for(filename) %>
12
12
  </div>
13
13
  </div>
14
+ <%= render :footer %>
14
15
  </body>
15
16
  </html>
@@ -0,0 +1,5 @@
1
+ <div id="yard_info">
2
+ Generated on <%= Time.now.strftime("%A, %B %d %Y at %r") %> by
3
+ <abbr class="yard" title="Yay! A Ruby Documentation Tool"><a href="http://yard.soen.ca">YARD</a></abbr>
4
+ <%= YARD::VERSION %> (ruby-<%= RUBY_VERSION %>).
5
+ </div>
@@ -11,5 +11,6 @@
11
11
  <div id="content">
12
12
  <%= yield object %>
13
13
  </div>
14
+ <%= render :footer %>
14
15
  </body>
15
16
  </html>
@@ -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" />
@@ -3,7 +3,7 @@
3
3
  <html>
4
4
  <head>
5
5
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6
- <title>YARD Documentation</title>
6
+ <title><%= options[:title] || "YARD Documentation" %></title>
7
7
  </head>
8
8
  <frameset cols="20%,*">
9
9
  <frameset rows="13%,45%,42%">
@@ -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; }
@@ -5,7 +5,7 @@
5
5
  <dt></dt>
6
6
  <dd>
7
7
  <span class='desc'>
8
- <%= object.tags(:see).map {|t| "<tt>" + linkify(t.text, t.text) + "</tt>" }.join(", ") %>
8
+ <%= object.tags(:see).map {|t| "<tt>" + linkify(t.name, t.text || t.name) + "</tt>" }.join(", ") %>
9
9
  </span>
10
10
  </dd>
11
11
  </dl>
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-07 00:00:00 -04:00
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
- has_rdoc: false
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.2
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.