yard-rest-plugin 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -1,18 +1,33 @@
1
+ require 'pp'
2
+
1
3
  module YARD::Templates::Helpers
2
4
  module BaseHelper
3
5
 
4
6
  # Adds additional test that only includes Objects that contain a URL tag
5
7
  def run_verifier(list)
8
+
6
9
  if options[:verifier]
7
- list = list.reject {|item| options[:verifier].call(item).is_a?(FalseClass) }
10
+ list.reject! {|item| options[:verifier].call(item).is_a?(FalseClass) }
8
11
  end
9
12
 
13
+ reject_module(list)
10
14
  reject_without_url(list)
15
+ reject_without_topic(list)
16
+
17
+ list
11
18
  end
12
19
 
20
+ def reject_module(list)
21
+ list.reject! { |object| [:root, :module].include?(object.type) }
22
+ end
23
+
13
24
  def reject_without_url(list)
14
- list.reject {|object| object.tags("url").empty? }
25
+ list.reject! { |object| [:class,:method].include?(object.type) and object.tags("url").empty? }
26
+ end
27
+
28
+ def reject_without_topic(list)
29
+ list.reject! { |object| [:class].include?(object.type) and object.tags("topic").empty? }
15
30
  end
16
-
31
+
17
32
  end
18
33
  end
@@ -8,6 +8,7 @@ YARD::Templates::Engine.register_template_path File.dirname(__FILE__) + '/../tem
8
8
 
9
9
  # Define custom tags
10
10
  YARD::Tags::Library.define_tag("URL for Service", :url)
11
+ YARD::Tags::Library.define_tag("Topic for Service", :topic)
11
12
  YARD::Tags::Library.define_tag("Arguments", :argument, :with_types_and_name)
12
13
  YARD::Tags::Library.define_tag("Example Responses", :example_response)
13
14
  YARD::Tags::Library.define_tag("Response Fields", :response_field, :with_name)
Binary file
@@ -0,0 +1,8 @@
1
+ <div class="service">
2
+ <h1><span class="minor_heading">Resource: </span><%= object.tag("url").text %></h1>
3
+ <% unless object.tag("topic").nil? %>
4
+ <!-- fixme: needs style -->
5
+ <h1><span class="minor_heading">Topic: </span><%= object.tag("topic").text %></h1>
6
+ <% end %>
7
+ <%= yieldall %>
8
+ </div>
@@ -1 +1,9 @@
1
- include T('rest/module/html')
1
+ def init
2
+ sections :header, [T('docstring'), :method_details_list, [T('method_details')]]
3
+ end
4
+
5
+ def method_details_list
6
+ @meths = object.meths(:inherited => false, :included => false)
7
+ @meths = run_verifier(@meths)
8
+ erb(:method_details_list)
9
+ end
@@ -1,6 +1,8 @@
1
1
  <li><a href="<%= url_for('_index.html') %>">/</a></li>
2
2
  <% n = 1 %>
3
3
  <% @items.sort_by {|s| s.name.to_s }.each do |service| %>
4
- <li class="r<%= n %>"><%= linkify(service, service.tags("url").first.text) %></li>
5
- <% n = n == 2 ? 1 : 2 %>
4
+ <% unless service.tags("topic").first.nil? %>
5
+ <li class="r<%= n %>"><%= linkify(service, service.tags("topic").first.text) %></li>
6
+ <% end %>
7
+ <% n = n == 2 ? 1 : 2 %>
6
8
  <% end %>
@@ -1,7 +1,10 @@
1
1
  include Helpers::ModuleHelper
2
2
 
3
+
3
4
  def init
5
+ pp "--1--", options[:objects]
4
6
  options[:objects] = objects = run_verifier(options[:objects])
7
+ pp "--2--", options[:objects]
5
8
  options[:files] = ([options[:readme]] + options[:files]).compact.map {|t| t.to_s }
6
9
  options[:readme] = options[:files].first
7
10
  options[:title] ||= "Documentation by YARD #{YARD::VERSION}"
@@ -13,7 +13,7 @@
13
13
  <% end %>
14
14
  <div class="clear"></div>
15
15
 
16
- <h2>Services A-Z</h2>
16
+ <h2>Topics A-Z</h2>
17
17
  <% i = 0 %>
18
18
  <table>
19
19
  <tr>
@@ -27,9 +27,11 @@
27
27
  <li class="letter"><%= letter %></li>
28
28
  <ul>
29
29
  <% objects.each do |obj| %>
30
- <li>
31
- <%= linkify(obj, obj.tags("url").first.text) %>
32
- </li>
30
+ <% unless obj.tags("topic").first.nil? %>
31
+ <li>
32
+ <%= linkify(obj, obj.tags("topic").first.text) %>
33
+ </li>
34
+ <% end %>
33
35
  <% end %>
34
36
  </ul>
35
37
  </ul>
@@ -37,4 +39,5 @@
37
39
  </td>
38
40
  </tr>
39
41
  </table>
42
+
40
43
  </div>
@@ -26,8 +26,8 @@ end
26
26
 
27
27
  def index
28
28
  @objects_by_letter = {}
29
- objects = @objects.reject {|o| o.root? }.sort_by {|o| o.name.to_s }
30
- objects.each {|o| (@objects_by_letter[o.name.to_s[0,1].upcase] ||= []) << o }
29
+ objects = @objects.reject {|o| o.root? || o.tags('topic').empty? }.sort_by {|o| o.tags('topic').first.text }
30
+ objects.each {|o| (@objects_by_letter[o.tags('topic').first.text[0,1].upcase] ||= []) << o }
31
31
  erb(:index)
32
32
  end
33
33
 
@@ -1,9 +1,4 @@
1
1
  def init
2
- sections :header, [T('docstring'), :method_details_list, [T('method_details')]]
2
+
3
3
  end
4
4
 
5
- def method_details_list
6
- @meths = object.meths(:inherited => false, :included => false)
7
- @meths = run_verifier(@meths)
8
- erb(:method_details_list)
9
- end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{yard-rest-plugin}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aisha Fenton"]
12
- s.date = %q{2010-05-14}
12
+ s.date = %q{2010-07-16}
13
13
  s.description = %q{A plugin for Yardoc that produces API documentation for Restful web services. See README.markdown for more details}
14
14
  s.email = %q{aisha.fenton@visfleet.com}
15
15
  s.extra_rdoc_files = [
@@ -23,7 +23,10 @@ Gem::Specification.new do |s|
23
23
  "example/SampleController.rb",
24
24
  "lib/yard-rest-plugin.rb",
25
25
  "lib/yard-rest-plugin/base_helper.rb",
26
+ "pkg/yard-rest-plugin-0.1.5.gem",
26
27
  "templates/rest/.DS_Store",
28
+ "templates/rest/class/html/header.erb",
29
+ "templates/rest/class/html/method_details_list.erb",
27
30
  "templates/rest/class/html/setup.rb",
28
31
  "templates/rest/docstring/html/setup.rb",
29
32
  "templates/rest/docstring/html/text.erb",
@@ -48,8 +51,6 @@ Gem::Specification.new do |s|
48
51
  "templates/rest/method_details/html/header.erb",
49
52
  "templates/rest/method_details/html/method_signature.erb",
50
53
  "templates/rest/method_details/html/setup.rb",
51
- "templates/rest/module/html/header.erb",
52
- "templates/rest/module/html/method_details_list.erb",
53
54
  "templates/rest/module/setup.rb",
54
55
  "templates/rest/tags/html/example_response.erb",
55
56
  "templates/rest/tags/html/generic_tag.erb",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Aisha Fenton
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-14 00:00:00 +12:00
17
+ date: 2010-07-16 00:00:00 +12:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -46,7 +46,10 @@ files:
46
46
  - example/SampleController.rb
47
47
  - lib/yard-rest-plugin.rb
48
48
  - lib/yard-rest-plugin/base_helper.rb
49
+ - pkg/yard-rest-plugin-0.1.5.gem
49
50
  - templates/rest/.DS_Store
51
+ - templates/rest/class/html/header.erb
52
+ - templates/rest/class/html/method_details_list.erb
50
53
  - templates/rest/class/html/setup.rb
51
54
  - templates/rest/docstring/html/setup.rb
52
55
  - templates/rest/docstring/html/text.erb
@@ -71,8 +74,6 @@ files:
71
74
  - templates/rest/method_details/html/header.erb
72
75
  - templates/rest/method_details/html/method_signature.erb
73
76
  - templates/rest/method_details/html/setup.rb
74
- - templates/rest/module/html/header.erb
75
- - templates/rest/module/html/method_details_list.erb
76
77
  - templates/rest/module/setup.rb
77
78
  - templates/rest/tags/html/example_response.erb
78
79
  - templates/rest/tags/html/generic_tag.erb
@@ -1,4 +0,0 @@
1
- <div class="service">
2
- <h1><span class="minor_heading">Service: </span><%= object.tag("url").text %></h1>
3
- <%= yieldall %>
4
- </div>