yard-restful 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -1,9 +1,14 @@
1
1
  # Yardoc RESTful Web Service Plugin
2
-
3
2
  A plugin for [Yardoc](http://yardoc.org/) that generates documentation for RESTful web services.
4
3
 
5
4
  Previous authors: [vWorkApp](http://www.vworkapp.com), [rknLA](http://github.com/rknLA), [lsegal](http://gnuu.org/), [spape](http://github.com/spape), [DerNalia](http://github.com/DerNalia)
6
5
 
6
+ ## Main features
7
+ Plugin provides custom tags to describe resources (controllers) and resulting objects (models).
8
+
9
+ If you use an object name in description of resource parameters, it will
10
+ be linked to the object description.
11
+
7
12
  ## Install
8
13
  Bundler will reduce your headaches:
9
14
 
@@ -18,8 +23,8 @@ It also requires the Jeweler gem if you plan to use the rake build tasks.
18
23
 
19
24
  You'll probably want to add these to your .gitignore as well
20
25
 
21
- /.yardoc
22
- /public/api
26
+ .yardoc
27
+ public/api
23
28
 
24
29
  So you'll have to re-genenarte your API on every machine. This should encourage more up to dateness
25
30
 
@@ -27,7 +32,7 @@ So you'll have to re-genenarte your API on every machine. This should encourage
27
32
  It is recommended that you use a .yardopts file
28
33
 
29
34
  --title "My API Documentation"
30
- --plugin rest
35
+ --plugin restful
31
36
  --readme API_README
32
37
  --output-dir ./public/api
33
38
  app/models/**/*.rb
data/Rakefile CHANGED
@@ -31,6 +31,14 @@ end
31
31
  namespace :example do
32
32
  desc "Generate example docs"
33
33
  task :generate do
34
+ unless gem_available?('yard-restful')
35
+ puts 'Gem yard-restful is not installed. Trying to build from local version.'
36
+ Rake::Task["rebuild"].execute
37
+ puts 'Gem yard-restful should be installed.'
38
+ end
39
+ unless gem_available?('redcarpet')
40
+ puts 'Warning: gem redcarpet is not installed. Some texts may look ugly.'
41
+ end
34
42
  puts `yardoc -e ./lib/yard-restful.rb --title "Example Books API" --readme ./example/API_README.md --markup markdown ./example/*.rb`
35
43
  # `x-www-browser ./doc/index.html`
36
44
  puts 'On success open ./doc/index.html or ./doc/frames.html in your preferred browser'
@@ -43,3 +51,17 @@ namespace :example do
43
51
  puts 'Done!'
44
52
  end
45
53
  end
54
+
55
+ def gem_available?(name, requirements = nil)
56
+ Gem::Specification.find_by_name(name, requirements)
57
+ true
58
+ rescue Gem::LoadError
59
+ false
60
+ rescue
61
+ Gem.available?(name)
62
+ # Gem.source_index.find_name(name, requirements).empty?
63
+ # gem name.to_s, requirements
64
+ # return true
65
+ #rescue GEM::LoadError
66
+ # return false
67
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.2
1
+ 1.2.4
@@ -12,5 +12,12 @@ module HtmlBlocksHelper
12
12
  @counter[name].even? ? elements[0] : elements[1]
13
13
  end
14
14
 
15
+ def type_as_string(type)
16
+ if type.resource? and type.tag(:restful_api).text
17
+ "#{type.name.to_s.gsub(/Controller/, '')} [#{type.tag(:restful_api).text}]"
18
+ else
19
+ type.name.to_s
20
+ end
21
+ end
15
22
  end
16
23
 
@@ -1,7 +1,7 @@
1
1
  <div class="service">
2
2
  <h1 class="noborder title"><%= options[:title] %></h1>
3
3
  <a class="back" href="<%= url_for('index.html') %>" title="back to the overview">&laquo; back to overview</a>
4
- <h2><%= object.name.to_s.gsub(/Controller/,"") %></h2>
4
+ <h2><%= type_as_string(object) %></h2>
5
5
  <%= yieldall %>
6
6
  </div>
7
7
 
@@ -1,6 +1,5 @@
1
1
  def init
2
2
  @page_title = "#{object.name.to_s.gsub(/Controller/,"")} - #{options[:title]}"
3
- #sections :header, [T('docstring'), :method_details_list, [:fields_list], [T('method_details')]]
4
3
  sections :header, [T('docstring'), :object_details, [:fields_list], :resource_details, [:fields_list]]
5
4
  end
6
5
 
@@ -1 +1,3 @@
1
- <%= htmlify(object.docstring.strip) %>
1
+ <div class="description">
2
+ <%= htmlify(object.docstring.strip) %>
3
+ </div>
@@ -10,7 +10,12 @@ body {
10
10
  right: 0;
11
11
  position: fixed;
12
12
  top: 0;
13
- width: 230px;
13
+ width: 246px;
14
+ overflow-y: scroll;
15
+ margin-right: -16px;
16
+ }
17
+ #toc ol {
18
+ padding-bottom: 10px;
14
19
  }
15
20
  #header {
16
21
  position: fixed;
@@ -49,9 +54,8 @@ p.method_desc {
49
54
  h2 {
50
55
  margin: 2.4em 0 0.5em;
51
56
  }
52
- .service h2 + p {
57
+ .service .description p {
53
58
  font-size: 1.2em;
54
- margin-bottom: 62px;
55
59
  }
56
60
  .method {
57
61
  display: block;
@@ -1,5 +1,5 @@
1
1
  <% @items.each do |resource| %>
2
2
  <li class="<%= rotate(:r2_r1) %>">
3
- <%= linkify(resource, resource.name.to_s.gsub(/Controller/, "")) %>
3
+ <%= linkify(resource, type_as_string(resource)) %>
4
4
  </li>
5
5
  <% end %>
@@ -7,7 +7,7 @@
7
7
  <ul id="resources">
8
8
  <% unless @resources.nil? %>
9
9
  <% @resources.each do |resource| %>
10
- <li><%= linkify(resource, resource.name.to_s.gsub(/Controller/, "")) %></li>
10
+ <li><%= linkify(resource, type_as_string(resource)) %></li>
11
11
  <% end %>
12
12
  <% end %>
13
13
  </ul>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-restful
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
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: 2012-10-24 00:00:00.000000000 Z
12
+ date: 2014-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yard
@@ -82,7 +82,6 @@ requirements: []
82
82
  rubyforge_project:
83
83
  rubygems_version: 1.8.24
84
84
  signing_key:
85
- specification_version: 3
85
+ specification_version: 4
86
86
  summary: Yardoc plugin for Restful web services
87
87
  test_files: []
88
- has_rdoc: