yard-api 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -0
- data/lib/yard-api/options.rb +11 -2
- data/lib/yard-api/templates/helpers/html_helper.rb +2 -0
- data/lib/yard-api/version.rb +1 -1
- data/lib/yard-api/yardoc_task.rb +2 -0
- data/templates/api/layout/html/_dynamic_styles.erb +16 -0
- data/templates/api/layout/html/footer.erb +2 -4
- data/templates/api/layout/html/headers.erb +1 -1
- data/templates/api/layout/html/layout.erb +10 -2
- data/templates/api/layout/html/scripts.erb +8 -3
- data/templates/api/layout/html/setup.rb +8 -0
- data/templates/api/method_details/html/header.erb +3 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4a7dbe342296a08ff5f47833f80909d984d0607
|
4
|
+
data.tar.gz: 278a23bc1ba6409da13fa24b7c755b19a0a38d09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fcbd79b911d4e108f36a5dbdc8bb52457ed88b12c4324350d71da1c7c48e84e821ccc910c94297843b12004473861be20b5252418f6f80c4539399868f8a970
|
7
|
+
data.tar.gz: 2d4c8731cf3ac058083028f433113cb2b9f41ef7603506f831329cdb1f7449532d4df9fc3b13702462023df2d065297d5cf87abe8d3262ee781f87807f771187
|
data/README.md
CHANGED
@@ -8,12 +8,28 @@ TODO
|
|
8
8
|
|
9
9
|
TODO
|
10
10
|
|
11
|
+
## Configuration
|
12
|
+
|
13
|
+
`yard-api` will look for a file in `config/yard_api.yml` in the Rails root for customizations. Configuration fields not specified in that file will be filled with the default values found in [config/yard_api.yml](https://github.com/amireh/yard-api/blob/master/config/yard_api.yml).
|
14
|
+
|
15
|
+
Read that file to view all the available options.
|
16
|
+
|
11
17
|
## Notes
|
12
18
|
|
13
19
|
- can only document classes and class methods; modules, root objects, and constants are ignored
|
14
20
|
|
15
21
|
## Changelog
|
16
22
|
|
23
|
+
**15/9/2014**
|
24
|
+
|
25
|
+
- `@argument` tags can now be formatted in a table by setting the `tabular_arguments` option to true
|
26
|
+
- `@argument_scope`: a new tag that improves the formatting of endpoint arguments that are scoped by a common prefix (e.g, nested inside a json object), like `user[name]` => `name`
|
27
|
+
- `@argument` can now parse accepted values in two formats; inline within the types array, or by explicitly writing it in the tag text using any of `Accepted values: [...]`, `Accepts: [...]`, or `Possible values: [...]`
|
28
|
+
- A new option: `strict_arguments` that provides a default for the `is_required` property of `@argument` tags. This default is used if the tag does not explicitly state `Optional` or `Required` in its type specifier.
|
29
|
+
- Support for dynamic javascript and style code based on options. See `templates/layout/setup.rb#inline_{javascripts,stylesheets}`
|
30
|
+
- A new set of options for customizing layout: `content_width`, `sidebar_width` and `spacer`
|
31
|
+
- `github_url` and `github_branch` options for tuning api endpoint source links
|
32
|
+
|
17
33
|
**14/9/2014**
|
18
34
|
|
19
35
|
- Support for single-page output through the `one_file` option
|
data/lib/yard-api/options.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
module YARD::APIPlugin
|
2
|
+
# See config/yard_api.yml for documentation for the options.
|
2
3
|
class Options < YARD::Options
|
3
4
|
default_attr :title, 'Rails API Project'
|
5
|
+
default_attr :window_title, 'Rails API Project Documentation'
|
6
|
+
default_attr :version, ''
|
4
7
|
default_attr :source, 'doc/api'
|
5
8
|
default_attr :static, []
|
6
9
|
default_attr :files, []
|
7
10
|
default_attr :route_namespace, ''
|
11
|
+
default_attr :github_url, nil
|
12
|
+
default_attr :github_branch, 'master'
|
8
13
|
|
9
|
-
default_attr :footer_copyright,
|
10
|
-
default_attr :footer_note,
|
14
|
+
default_attr :footer_copyright, ''
|
15
|
+
default_attr :footer_note, ''
|
11
16
|
|
12
17
|
default_attr :one_file, false
|
13
18
|
default_attr :verbose, false
|
@@ -17,6 +22,10 @@ module YARD::APIPlugin
|
|
17
22
|
default_attr :tabular_arguments, false
|
18
23
|
default_attr :strict_arguments, false
|
19
24
|
|
25
|
+
default_attr :sidebar_width, 240
|
26
|
+
default_attr :content_width, 'fluid'
|
27
|
+
default_attr :spacer, 20
|
28
|
+
|
20
29
|
attr_accessor :readme
|
21
30
|
end
|
22
31
|
end
|
data/lib/yard-api/version.rb
CHANGED
data/lib/yard-api/yardoc_task.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
<style>
|
2
|
+
body {
|
3
|
+
padding-left: <%= api_options.sidebar_width + api_options.spacer %>px;
|
4
|
+
padding-right: <%= api_options.spacer %>px;
|
5
|
+
}
|
6
|
+
|
7
|
+
#sidebar {
|
8
|
+
width: <%= api_options.sidebar_width %>px;
|
9
|
+
}
|
10
|
+
|
11
|
+
<% if api_options.content_width.to_i > 0 %>
|
12
|
+
#content {
|
13
|
+
max-width: <%= api_options.content_width %>px;
|
14
|
+
}
|
15
|
+
<% end %>
|
16
|
+
</style>
|
@@ -1,11 +1,9 @@
|
|
1
1
|
<div id="footer">
|
2
2
|
<p>
|
3
|
-
|
4
|
-
<%= api_options['footer_copyright'] %>
|
5
|
-
<% end %>
|
3
|
+
<%= api_options.footer_copyright.to_s %>
|
6
4
|
|
7
5
|
Generated on <%= Time.now.strftime("%c") %>
|
8
6
|
</p>
|
9
7
|
|
10
|
-
<%= api_options
|
8
|
+
<%= api_options.footer_note.to_s %>
|
11
9
|
</div>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<meta name="Content-Type" content="text/html;charset=UTF-8">
|
2
2
|
<meta charset="UTF-8">
|
3
3
|
|
4
|
-
<title><%= api_options
|
4
|
+
<title><%= api_options.window_title || api_options.title %></title>
|
5
5
|
|
6
6
|
<% stylesheets.each do |stylesheet| %>
|
7
7
|
<link rel="stylesheet" href="<%= url_for(stylesheet) %>" type="text/css" charset="utf-8" />
|
@@ -2,16 +2,20 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<%= erb(:headers) %>
|
5
|
+
|
6
|
+
<% inline_stylesheets.each do |style| %>
|
7
|
+
<%= erb(style) %>
|
8
|
+
<% end %>
|
5
9
|
</head>
|
6
10
|
|
7
|
-
<body class="theme-<%= api_options.theme %>">
|
11
|
+
<body class="theme-<%= api_options.theme %> <%= 'onefile' if api_options.one_file %>">
|
8
12
|
<div id="sidebar">
|
9
13
|
<%= erb(:sidebar) %>
|
10
14
|
</div>
|
11
15
|
|
12
16
|
<% if options[:all_resources] %>
|
13
17
|
<div id="content">
|
14
|
-
<% if api_options
|
18
|
+
<% if api_options.one_file %>
|
15
19
|
<% static_pages.each do |page| %>
|
16
20
|
<%= diskfile page[:src] %>
|
17
21
|
<% end %>
|
@@ -27,5 +31,9 @@
|
|
27
31
|
|
28
32
|
<%= erb(:footer) %>
|
29
33
|
<%= erb(:scripts) %>
|
34
|
+
|
35
|
+
<% inline_javascripts.each do |script| %>
|
36
|
+
<%= erb(script) %>
|
37
|
+
<% end %>
|
30
38
|
</body>
|
31
39
|
</html>
|
@@ -20,11 +20,16 @@
|
|
20
20
|
$(function() {
|
21
21
|
var currentPage = location.pathname.match(/\/([^\/]+)$/)[1];
|
22
22
|
var $page = $('#sidebar [href="' + currentPage + '"]');
|
23
|
-
|
24
|
-
|
23
|
+
|
24
|
+
if (!currentPage) {
|
25
|
+
return;
|
25
26
|
}
|
26
27
|
|
27
|
-
$page.
|
28
|
+
// if ($page.length === 0) {
|
29
|
+
// $page = $('#sidebar a[href=""]');
|
30
|
+
// }
|
31
|
+
|
32
|
+
// $page.addClass('active');
|
28
33
|
console.log('Highlighting current page:', $page, currentPage);
|
29
34
|
});
|
30
35
|
|
@@ -24,6 +24,10 @@ def stylesheets
|
|
24
24
|
]
|
25
25
|
end
|
26
26
|
|
27
|
+
def inline_stylesheets
|
28
|
+
[ '_dynamic_styles' ]
|
29
|
+
end
|
30
|
+
|
27
31
|
def javascripts
|
28
32
|
%w[
|
29
33
|
js/jquery-1.11.1.min.js
|
@@ -31,6 +35,10 @@ def javascripts
|
|
31
35
|
]
|
32
36
|
end
|
33
37
|
|
38
|
+
def inline_javascripts
|
39
|
+
[]
|
40
|
+
end
|
41
|
+
|
34
42
|
def contents
|
35
43
|
@contents
|
36
44
|
end
|
@@ -4,8 +4,9 @@
|
|
4
4
|
<%= object.tag("API").try(:text) %>
|
5
5
|
</a>
|
6
6
|
|
7
|
-
<% if @controller_path %>
|
8
|
-
<span class='defined-in'
|
7
|
+
<% if @controller_path && !api_options.github_url.to_s.empty? %>
|
8
|
+
<span class='defined-in'>
|
9
|
+
<a href="<%= api_options.github_url %>/blob/<%= api_options.github_branch %>/<%= @controller_path %>"><%= "#{@route.requirements[:controller].camelize}Controller\##{@route.requirements[:action]}" %></a></span>
|
9
10
|
<% end %>
|
10
11
|
</h2>
|
11
12
|
<%= yieldall %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ahmad Amireh
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- templates/api/docstring/html/setup.rb
|
96
96
|
- templates/api/docstring/html/text.erb
|
97
97
|
- templates/api/fulldoc/html/setup.rb
|
98
|
+
- templates/api/layout/html/_dynamic_styles.erb
|
98
99
|
- templates/api/layout/html/footer.erb
|
99
100
|
- templates/api/layout/html/headers.erb
|
100
101
|
- templates/api/layout/html/layout.erb
|