yard-api 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/config/yard_api.yml +75 -43
- data/lib/yard-api/options.rb +1 -1
- data/lib/yard-api/version.rb +1 -1
- data/lib/yard-api/yardoc_task.rb +15 -7
- data/tasks/yard_api.rake +17 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d00eca05fb8b95040018871a831a81f6386b966d
|
4
|
+
data.tar.gz: 6b63e8bb9ec6a9d2ae60b9f69c09bf353a2c381d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5a622aa5b1b3ccd2f5f8b1109c9c52849a216c3635754ead6678fbd4d8f6d8b29bb95396f44c1783fc330b856636765d69032a9df4d92a38ee11e7f7cbacb5b
|
7
|
+
data.tar.gz: 2a64c4471f631d75f3c6e87e84c6fb8b512be4da427a5df0c0b2cd16ae998414cac7a2f97e3ebe05f8c2cd9a1cfcbab510f84497f99e3a85ca41f595d9d14d2a
|
data/README.md
CHANGED
@@ -40,6 +40,15 @@ Read that file to view all the available options.
|
|
40
40
|
|
41
41
|
## Changelog
|
42
42
|
|
43
|
+
**23/8/2015 [0.3.4]**
|
44
|
+
|
45
|
+
- Fixed an issue that prevented overriding the Rake task's options at runtime.
|
46
|
+
- Updated `config/yard_api.yml` to reflect the recently added options.
|
47
|
+
|
48
|
+
**17/8/2015 [0.3.3]**
|
49
|
+
|
50
|
+
- Improved the JSON format's output to be more concise and consistent.
|
51
|
+
|
43
52
|
**30/7/2015 [0.3.1]**
|
44
53
|
|
45
54
|
- Fixed a bug that was listing all the endpoints of a certain controller even if they do not have a route defined. Now, YARD-API will warn about endpoints that have an `@API` tag but could not be routed.
|
data/config/yard_api.yml
CHANGED
@@ -3,33 +3,15 @@
|
|
3
3
|
output: public/doc/api
|
4
4
|
readme: doc/api/README.md
|
5
5
|
|
6
|
-
# Title of the project. This will be displayed in the browser title bar as well
|
7
|
-
# as in the layout as the primary heading.
|
8
|
-
title: Rails API Project
|
9
|
-
|
10
6
|
url_title: my_app
|
11
7
|
url_prefix: /api
|
12
8
|
|
13
|
-
# The resource index is a mega-index page that contains all the API resources.
|
14
|
-
resource_index: true
|
15
|
-
|
16
9
|
# Generate a single page that contains all the static pages and API resources.
|
17
10
|
# The output will be a single file.
|
18
11
|
#
|
19
12
|
# Implies "resource_index" is true.
|
20
13
|
one_file: false
|
21
14
|
|
22
|
-
# YARD options passed as-is.
|
23
|
-
#
|
24
|
-
# If you want to use github-flavored markdown, use "redcparet" as a markup
|
25
|
-
# provider, and "markdown" as a markup and add the following gems to your
|
26
|
-
# Gemfile *before* yard-api:
|
27
|
-
#
|
28
|
-
# - "github-markup"
|
29
|
-
# - "redcarpet"
|
30
|
-
markup:
|
31
|
-
markup_provider:
|
32
|
-
|
33
15
|
# The API files to extract the docs from.
|
34
16
|
files:
|
35
17
|
- app/controllers/**/*.rb
|
@@ -56,19 +38,6 @@ debug: false
|
|
56
38
|
# Don't tolerate any errors such as bad asset paths, invalid tag properties, etc.
|
57
39
|
strict: false
|
58
40
|
|
59
|
-
# Each API endpoint details can provide a link to the source code of the
|
60
|
-
# controller method if it's available on GitHub.
|
61
|
-
#
|
62
|
-
# Just specify the url to your repository and the branch the documentation has
|
63
|
-
# been generated for and things "should work".
|
64
|
-
#
|
65
|
-
# Example: https://github.com/amireh/yard-api
|
66
|
-
github_url:
|
67
|
-
github_branch: master
|
68
|
-
|
69
|
-
# Set to true if you want @argument tags to show up in a table instead of a list.
|
70
|
-
tabular_arguments: false
|
71
|
-
|
72
41
|
# When this option is set, all @argument tags that do not explicitly specify
|
73
42
|
# whether they are required or optional will be marked as required. Examples:
|
74
43
|
#
|
@@ -80,17 +49,6 @@ tabular_arguments: false
|
|
80
49
|
# optional.
|
81
50
|
strict_arguments: true
|
82
51
|
|
83
|
-
# Width of the sidebar, in pixels.
|
84
|
-
sidebar_width: 240
|
85
|
-
|
86
|
-
# Width of the content box in pixels, or "fluid" for maximum screen space.
|
87
|
-
#
|
88
|
-
# Content will never overlap with the sidebar.
|
89
|
-
content_width: "fluid"
|
90
|
-
|
91
|
-
# Whitespace between the Sidebar and the content, in pixels.
|
92
|
-
spacer: 20
|
93
|
-
|
94
52
|
# Compatibility option.
|
95
53
|
#
|
96
54
|
# If your project (mis)uses the @argument tag to specify the name before the
|
@@ -105,8 +63,82 @@ spacer: 20
|
|
105
63
|
# But that may not be viable in very large, existing projects.
|
106
64
|
leading_argument_name_fix: false
|
107
65
|
|
66
|
+
# ------------------------------------------------------------------------------
|
67
|
+
# HTML-only options.
|
68
|
+
# ------------------------------------------------------------------------------
|
69
|
+
|
70
|
+
# Title of the project. This will be displayed in the browser title bar as well
|
71
|
+
# as in the layout's sidebar as the primary heading.
|
72
|
+
title: Rails API Project
|
73
|
+
|
74
|
+
# If this is set, it will override @title in the browser's page title, but not
|
75
|
+
# the link in the sidebar.
|
76
|
+
window_title:
|
77
|
+
|
78
|
+
# The resource index is a mega-index page that contains all the API resources.
|
79
|
+
resource_index: true
|
80
|
+
|
81
|
+
# YARD options passed as-is.
|
82
|
+
#
|
83
|
+
# If you want to use github-flavored markdown, use "redcparet" as a markup
|
84
|
+
# provider, and "markdown" as a markup and add the following gems to your
|
85
|
+
# Gemfile *before* yard-api:
|
86
|
+
#
|
87
|
+
# - "github-markup"
|
88
|
+
# - "redcarpet"
|
89
|
+
markup:
|
90
|
+
markup_provider:
|
91
|
+
|
92
|
+
# Each API endpoint details can provide a link to the source code of the
|
93
|
+
# controller method if it's available on GitHub.
|
94
|
+
#
|
95
|
+
# Just specify the url to your repository and the branch the documentation has
|
96
|
+
# been generated for and things "should work".
|
97
|
+
#
|
98
|
+
# Example: https://github.com/amireh/yard-api
|
99
|
+
github_url:
|
100
|
+
github_branch: master
|
101
|
+
|
102
|
+
# Set to true if you want @argument tags to show up in a table instead of a list.
|
103
|
+
tabular_arguments: false
|
104
|
+
|
105
|
+
# Width of the content box in pixels, or "fluid" for maximum screen space.
|
106
|
+
#
|
107
|
+
# Content will never overlap with the sidebar.
|
108
|
+
content_width: "fluid"
|
109
|
+
|
110
|
+
# Width of the sidebar, in pixels.
|
111
|
+
sidebar_width: 240
|
112
|
+
|
113
|
+
# Whether the content box should be centered. This has no effect if
|
114
|
+
# `content_width` is set to `"fluid"`.
|
115
|
+
centered: true
|
116
|
+
|
117
|
+
# Whitespace between the Sidebar and the content, in pixels.
|
118
|
+
spacer: 20
|
119
|
+
|
120
|
+
# A small "BETA" label that will show up next to a beta endpoint's title.
|
108
121
|
use_beta_flag: true
|
122
|
+
|
123
|
+
# A blocky "BETA" banner that will be displayed before a beta endpoint's
|
124
|
+
# description body. This may attract more attention than the beta "flag"
|
125
|
+
# setting.
|
109
126
|
use_beta_banner: false
|
110
127
|
|
128
|
+
# Whether the footer should be displayed.
|
111
129
|
show_footer: true
|
112
|
-
|
130
|
+
|
131
|
+
# A copyright message to display in the top part of the footer.
|
132
|
+
footer_copyright:
|
133
|
+
|
134
|
+
# A footer message. This will be displayed below the copyright notice and the
|
135
|
+
# generation timestamp.
|
136
|
+
footer_note:
|
137
|
+
|
138
|
+
# The text to use for the link to the docs home page in the sidebar.
|
139
|
+
readme_page_title: Home
|
140
|
+
|
141
|
+
# The UI theme to use. The stock gem provides only a "Default" theme, but other
|
142
|
+
# plugins may provide more themes in which case you can tune this variable to
|
143
|
+
# activate them.
|
144
|
+
theme: Default
|
data/lib/yard-api/options.rb
CHANGED
@@ -7,9 +7,9 @@ module YARD::APIPlugin
|
|
7
7
|
default_attr :output, 'compiled/doc/api'
|
8
8
|
|
9
9
|
default_attr :title, 'Rails API Project'
|
10
|
+
default_attr :window_title, 'Rails API Project'
|
10
11
|
default_attr :url_title, 'my_app'
|
11
12
|
default_attr :url_prefix, '/api'
|
12
|
-
default_attr :window_title, 'Rails API Project Documentation'
|
13
13
|
default_attr :version, ''
|
14
14
|
default_attr :static, []
|
15
15
|
default_attr :files, []
|
data/lib/yard-api/version.rb
CHANGED
data/lib/yard-api/yardoc_task.rb
CHANGED
@@ -5,20 +5,22 @@ module YARD::APIPlugin
|
|
5
5
|
attr_reader :config
|
6
6
|
|
7
7
|
def initialize(name=:yard_api)
|
8
|
-
super(name
|
8
|
+
super(name) do |t|
|
9
|
+
yield t if block_given?
|
10
|
+
t.run
|
11
|
+
end
|
9
12
|
end
|
10
13
|
|
11
14
|
def run
|
12
15
|
YARD::APIPlugin.options.reset_defaults
|
13
16
|
|
14
|
-
@config = load_config
|
15
|
-
t = self
|
17
|
+
@config = api_options = YARD::APIPlugin.options.update(load_config)
|
16
18
|
|
17
|
-
|
19
|
+
puts "Config: #{api_options.to_json}"
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
self.verifier = YARD::APIPlugin::Verifier.new(config['verbose'])
|
22
|
+
self.before = proc { FileUtils.rm_rf(config['output']) }
|
23
|
+
self.files = config['files']
|
22
24
|
|
23
25
|
config['debug'] ||= ENV['DEBUG']
|
24
26
|
config['verbose'] ||= ENV['VERBOSE']
|
@@ -64,6 +66,10 @@ module YARD::APIPlugin
|
|
64
66
|
end
|
65
67
|
end
|
66
68
|
|
69
|
+
def configure(runtime_config)
|
70
|
+
@runtime_config = runtime_config
|
71
|
+
end
|
72
|
+
|
67
73
|
private
|
68
74
|
|
69
75
|
def load_config
|
@@ -72,6 +78,8 @@ module YARD::APIPlugin
|
|
72
78
|
# load defaults
|
73
79
|
config = YAML.load_file(File.join(YARD::APIPlugin::CONFIG_PATH, 'yard_api.yml'))
|
74
80
|
config.merge!(YAML.load_file(path)) if File.exists?(path)
|
81
|
+
config.merge! @runtime_config if @runtime_config
|
82
|
+
|
75
83
|
config
|
76
84
|
end
|
77
85
|
|
data/tasks/yard_api.rake
CHANGED
@@ -1,14 +1,21 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'yard-api/yardoc_task'
|
3
|
-
|
4
|
-
runner = YARD::APIPlugin::YardocTask.new
|
5
|
-
|
6
1
|
desc 'generate YARD API docs'
|
7
2
|
task :yard_api => :environment do |t|
|
3
|
+
require 'fileutils'
|
4
|
+
require 'yard-api/yardoc_task'
|
5
|
+
|
6
|
+
runner = YARD::APIPlugin::YardocTask.new
|
8
7
|
output = runner.config['output']
|
9
|
-
|
10
|
-
puts
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
|
9
|
+
puts case runner.config['format']
|
10
|
+
when 'html'
|
11
|
+
<<-Message
|
12
|
+
API documentation (in HTML format) was successfully generated.
|
13
|
+
Open #{output}/index.html in a browser.
|
14
|
+
Message
|
15
|
+
when 'json'
|
16
|
+
<<-Message
|
17
|
+
API documentation (in JSON format) was successfully generated.
|
18
|
+
You will find the documents in #{output}/*.json
|
19
|
+
Message
|
20
|
+
end
|
14
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ahmad Amireh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|