jekyll-ramler 0.0.10 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -47
- data/README.md +9 -0
- data/jekyll-ramler.gemspec +2 -2
- data/lib/raml-generate.rb +58 -25
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5de4b422758205cd5f099f15a65a1e73f060347f
|
4
|
+
data.tar.gz: 69481e98d6f6c4877d94d536f3c496362b62493c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ba166fd3dd5724ec148bbe053dbdae1d64d8fdf19db8253af9fef9a7fca7d5afcb0b38dac6b773aa0733d24b8022d92ee7c43b1918472938ed9b3cadd9620f7
|
7
|
+
data.tar.gz: d74a6090861d19edda05ab1e5cf7fd78e82b114821f3a01832cb4bbda3c80e01c19b364635410597319204e7cd8c1acb2b9bf39bfeb9720044645e50a99fb8e7
|
data/Gemfile.lock
CHANGED
@@ -1,75 +1,46 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jekyll-ramler (0.0.
|
4
|
+
jekyll-ramler (0.0.11)
|
5
5
|
jekyll
|
6
6
|
ruby_deep_clone
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
blankslate (2.1.2.4)
|
12
|
-
celluloid (0.16.0)
|
13
|
-
timers (~> 4.0.0)
|
14
|
-
classifier-reborn (2.0.3)
|
15
|
-
fast-stemmer (~> 1.0)
|
16
11
|
coderay (1.1.0)
|
17
|
-
coffee-script (2.3.0)
|
18
|
-
coffee-script-source
|
19
|
-
execjs
|
20
|
-
coffee-script-source (1.9.0)
|
21
12
|
colorator (0.1)
|
22
13
|
diff-lcs (1.2.5)
|
23
|
-
execjs (2.3.0)
|
24
14
|
fakefs (0.6.5)
|
25
|
-
|
26
|
-
|
27
|
-
hitimes (1.2.2)
|
28
|
-
jekyll (2.5.3)
|
29
|
-
classifier-reborn (~> 2.0)
|
15
|
+
ffi (1.9.10)
|
16
|
+
jekyll (3.0.1)
|
30
17
|
colorator (~> 0.1)
|
31
|
-
jekyll-coffeescript (~> 1.0)
|
32
|
-
jekyll-gist (~> 1.0)
|
33
|
-
jekyll-paginate (~> 1.0)
|
34
18
|
jekyll-sass-converter (~> 1.0)
|
35
19
|
jekyll-watch (~> 1.1)
|
36
20
|
kramdown (~> 1.3)
|
37
|
-
liquid (~>
|
21
|
+
liquid (~> 3.0)
|
38
22
|
mercenary (~> 0.3.3)
|
39
|
-
|
40
|
-
redcarpet (~> 3.1)
|
23
|
+
rouge (~> 1.7)
|
41
24
|
safe_yaml (~> 1.0)
|
42
|
-
toml (~> 0.1.0)
|
43
|
-
jekyll-coffeescript (1.0.1)
|
44
|
-
coffee-script (~> 2.2)
|
45
|
-
jekyll-gist (1.1.0)
|
46
|
-
jekyll-paginate (1.1.0)
|
47
25
|
jekyll-sass-converter (1.3.0)
|
48
26
|
sass (~> 3.2)
|
49
|
-
jekyll-watch (1.
|
50
|
-
listen (~>
|
51
|
-
kramdown (1.
|
52
|
-
liquid (
|
53
|
-
listen (
|
54
|
-
celluloid (>= 0.15.2)
|
27
|
+
jekyll-watch (1.3.0)
|
28
|
+
listen (~> 3.0)
|
29
|
+
kramdown (1.9.0)
|
30
|
+
liquid (3.0.6)
|
31
|
+
listen (3.0.5)
|
55
32
|
rb-fsevent (>= 0.9.3)
|
56
33
|
rb-inotify (>= 0.9)
|
57
34
|
mercenary (0.3.5)
|
58
35
|
method_source (0.8.2)
|
59
|
-
parslet (1.5.0)
|
60
|
-
blankslate (~> 2.0)
|
61
|
-
posix-spawn (0.3.9)
|
62
36
|
pry (0.10.1)
|
63
37
|
coderay (~> 1.1.0)
|
64
38
|
method_source (~> 0.8.1)
|
65
39
|
slop (~> 3.4)
|
66
|
-
|
67
|
-
posix-spawn (~> 0.3.6)
|
68
|
-
yajl-ruby (~> 1.2.0)
|
69
|
-
rb-fsevent (0.9.4)
|
40
|
+
rb-fsevent (0.9.6)
|
70
41
|
rb-inotify (0.9.5)
|
71
42
|
ffi (>= 0.5.0)
|
72
|
-
|
43
|
+
rouge (1.10.1)
|
73
44
|
rspec (3.2.0)
|
74
45
|
rspec-core (~> 3.2.0)
|
75
46
|
rspec-expectations (~> 3.2.0)
|
@@ -85,13 +56,8 @@ GEM
|
|
85
56
|
rspec-support (3.2.1)
|
86
57
|
ruby_deep_clone (0.6.0)
|
87
58
|
safe_yaml (1.0.4)
|
88
|
-
sass (3.4.
|
59
|
+
sass (3.4.19)
|
89
60
|
slop (3.6.0)
|
90
|
-
timers (4.0.1)
|
91
|
-
hitimes
|
92
|
-
toml (0.1.2)
|
93
|
-
parslet (~> 1.5.0)
|
94
|
-
yajl-ruby (1.2.1)
|
95
61
|
|
96
62
|
PLATFORMS
|
97
63
|
ruby
|
@@ -102,3 +68,6 @@ DEPENDENCIES
|
|
102
68
|
pry
|
103
69
|
rspec
|
104
70
|
rspec-mocks
|
71
|
+
|
72
|
+
BUNDLED WITH
|
73
|
+
1.10.6
|
data/README.md
CHANGED
@@ -18,6 +18,15 @@ specificed in a RAML file.
|
|
18
18
|
- Supports Raw and Table based displays of JSON Schema included in your RAMLs
|
19
19
|
- Automatic insertion of inherited JSON Schema (via `$ref` and `allOf`)
|
20
20
|
|
21
|
+
## Example
|
22
|
+
|
23
|
+
GovDelivery's developer documentation site, <http://developer.govdelivery.com>,
|
24
|
+
is built on jekyll-ramler, [jekyll-code-example-tag](https://github.com/govdelivery/jekyll-code-example-tag),
|
25
|
+
and [jekyll-nested-menu-generator](https://github.com/govdelivery/jekyll-nested-menu-generator).
|
26
|
+
|
27
|
+
For an example of the output generated by jekyll-ramler, please visit
|
28
|
+
GovDelivery's TMS API documentation at <http://developer.govdelivery.com/api/tms/>.
|
29
|
+
|
21
30
|
## Installation
|
22
31
|
|
23
32
|
### Dependencies
|
data/jekyll-ramler.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'jekyll-ramler'
|
3
|
-
s.version = '0.0.
|
4
|
-
s.date = '2015-
|
3
|
+
s.version = '0.0.12'
|
4
|
+
s.date = '2015-11-23'
|
5
5
|
s.authors = ['GovDelivery']
|
6
6
|
s.email = 'support@govdelivery.com'
|
7
7
|
s.homepage = 'https://github.com/govdelivery/jekyll-ramler'
|
data/lib/raml-generate.rb
CHANGED
@@ -40,8 +40,8 @@ module Jekyll
|
|
40
40
|
def transform_md(output)
|
41
41
|
# Use the existing Jekyll Markdown converters
|
42
42
|
md_converters = site.converters.select{|c| c.matches('.md')}
|
43
|
-
md_converters.reduce(output) do |
|
44
|
-
converter.convert
|
43
|
+
md_converters.reduce(output) do |output_to_convert, converter|
|
44
|
+
converter.convert output_to_convert
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -52,14 +52,14 @@ module Jekyll
|
|
52
52
|
|
53
53
|
default = {"values" => {}} if default.nil?
|
54
54
|
|
55
|
-
|
55
|
+
default['values'].fetch('layout', 'default')
|
56
56
|
end
|
57
57
|
|
58
58
|
end
|
59
59
|
|
60
60
|
class SecuritySchemePage<GeneratedPage
|
61
61
|
def initialize(site, base, web_root, dir, securityScheme)
|
62
|
-
super(site, base, web_root, dir, securityScheme,
|
62
|
+
super(site, base, web_root, dir, securityScheme, get_layout("#{web_root}resource", site))
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -163,10 +163,10 @@ module Jekyll
|
|
163
163
|
when 'application/json'
|
164
164
|
obj['schema_hash'] = JSON.parse(obj['schema'])
|
165
165
|
|
166
|
-
refactor_object = lambda do |
|
167
|
-
|
166
|
+
refactor_object = lambda do |lam_obj|
|
167
|
+
lam_obj['properties'].each do |name, param|
|
168
168
|
param['displayName'] = name
|
169
|
-
param['required'] = true if
|
169
|
+
param['required'] = true if lam_obj.fetch('required', []).include?(name)
|
170
170
|
|
171
171
|
if param.include?('example') and ['object', 'array'].include?(param['type'])
|
172
172
|
param['example'] = JSON.pretty_generate(JSON.parse(param['example']))
|
@@ -176,9 +176,9 @@ module Jekyll
|
|
176
176
|
param['items'] = JSON.pretty_generate(param['items'])
|
177
177
|
end
|
178
178
|
|
179
|
-
|
179
|
+
lam_obj['properties'][name] = param
|
180
180
|
end
|
181
|
-
|
181
|
+
lam_obj
|
182
182
|
end
|
183
183
|
|
184
184
|
if obj['schema_hash'].include?('properties')
|
@@ -248,7 +248,37 @@ module Jekyll
|
|
248
248
|
@site.pages << DocumentationPage.new(@site, @site.source, @web_root, documentation_dir, documentation)
|
249
249
|
end
|
250
250
|
|
251
|
+
generate_downloadable_descriptors(raml_hash, raml_path)
|
252
|
+
end
|
253
|
+
|
254
|
+
private
|
255
|
+
def generate_resource_pages(resources, parent_dir=nil)
|
256
|
+
|
257
|
+
if parent_dir
|
258
|
+
dir = parent_dir
|
259
|
+
else
|
260
|
+
dir = Jekyll::get_dir('resource', @site.config)
|
261
|
+
end
|
262
|
+
|
263
|
+
resources.each do |resource|
|
264
|
+
resource_name = resource["relativeUri"]
|
265
|
+
resource_dir = File.join(dir, resource_name)
|
266
|
+
@site.pages << ResourcePage.new(@site, @site.source, @web_root, resource_dir, resource, @traits, @securitySchemes)
|
267
|
+
generate_resource_pages(resource['resources'], resource_dir) if resource.has_key?('resources')
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
def generate_downloadable_descriptors(raml_hash, raml_path)
|
251
272
|
# Allow users to download descriptor as RAML and JSON, which may be modified since it was read
|
273
|
+
raml_hash = DeepClone.clone raml_hash
|
274
|
+
|
275
|
+
# Get rid of 'title' attribute added to security schemes
|
276
|
+
# securitySchemes will be an array of hashes containing one key (Name) value (a hash of properties) pairing
|
277
|
+
raml_hash.fetch('securitySchemes', []).each {|el| el.each_value { |scheme| scheme.delete('title') }}
|
278
|
+
|
279
|
+
# replace "resources" with the associated "relativeUri" of each resource
|
280
|
+
fix_resources(raml_hash)
|
281
|
+
|
252
282
|
download_basename = @site.config.fetch('ramler_downloadable_descriptor_basenames', {}).fetch(raml_path, 'api')
|
253
283
|
raml_download_filename = download_basename + '.raml'
|
254
284
|
json_download_filename = download_basename + '.json'
|
@@ -261,24 +291,27 @@ module Jekyll
|
|
261
291
|
@site.static_files << RawFile.new(@site, @site.source, @web_root, json_download_filename, raml_json)
|
262
292
|
end
|
263
293
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
dir = Jekyll::get_dir('resource', @site.config)
|
271
|
-
end
|
272
|
-
|
273
|
-
resources.each do |resource|
|
274
|
-
resource_name = resource["relativeUri"]
|
275
|
-
resource_dir = File.join(dir, resource_name)
|
276
|
-
@site.pages << ResourcePage.new(@site, @site.source, @web_root, resource_dir, resource, @traits, @securitySchemes)
|
277
|
-
if resource.has_key?('resources')
|
278
|
-
generate_resource_pages(resource['resources'], resource_dir)
|
279
|
-
end
|
294
|
+
def fix_resources(raml_hash)
|
295
|
+
# DFS FTW
|
296
|
+
raml_hash.fetch('resources', []).each do |resource_hash|
|
297
|
+
raml_hash[resource_hash.delete('relativeUri')] = resource_hash
|
298
|
+
fix_resources(resource_hash)
|
299
|
+
end
|
280
300
|
|
301
|
+
raml_hash.fetch('methods', []).each do |method_hash|
|
302
|
+
raml_hash[method_hash.delete('method')] = method_hash
|
303
|
+
fix_body(method_hash)
|
281
304
|
end
|
305
|
+
raml_hash.delete('methods')
|
306
|
+
raml_hash.delete('schema_hash')
|
307
|
+
raml_hash.delete('relativeUriPathSegments')
|
308
|
+
raml_hash.delete('resources')
|
309
|
+
raml_hash
|
310
|
+
end
|
311
|
+
|
312
|
+
def fix_body(method_hash)
|
313
|
+
method_hash.fetch('body', {}).each {|content_type, definition| definition.delete('schema_hash')}
|
314
|
+
method_hash.fetch('responses', {}).each {|response_code, response_hash| fix_body(response_hash) if response_hash}
|
282
315
|
end
|
283
316
|
end
|
284
317
|
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-ramler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GovDelivery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ruby_deep_clone
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: "Generates Jekyll pages for overview, security, and \n resource
|
@@ -45,7 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .travis.yml
|
48
|
+
- ".travis.yml"
|
49
49
|
- CHANGELOG
|
50
50
|
- Gemfile
|
51
51
|
- Gemfile.lock
|
@@ -75,17 +75,17 @@ require_paths:
|
|
75
75
|
- lib
|
76
76
|
required_ruby_version: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- -
|
78
|
+
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
requirements: []
|
87
87
|
rubyforge_project:
|
88
|
-
rubygems_version: 2.
|
88
|
+
rubygems_version: 2.4.5
|
89
89
|
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: Jekyll plugin that generates API documentation pages based on RAML
|