Add API example generator via tent-apidoc
This commit is contained in:
parent
89e20162ed
commit
9b4d94cd2f
4 changed files with 138 additions and 8 deletions
5
Gemfile
5
Gemfile
|
@ -15,4 +15,7 @@ gem 'puma'
|
|||
gem 'rack-rewrite'
|
||||
gem 'pygments.rb', :git => 'git://github.com/akzhan/pygments.rb.git', :branch => 'rubypython-0.6'
|
||||
gem 'clogger'
|
||||
gem 'tent-schemas', :git => 'git@git:tent-schemas.git'
|
||||
gem 'tent-schemas', :git => 'git://github.com/tent/tent-schemas.git', :branch => 'master'
|
||||
gem 'tent-client', :git => 'git@github.com:tent/tent-client-ruby.git', :branch => 'master'
|
||||
gem 'tentd', :git => 'git@github.com:tent/tentd.git', :branch => 'master'
|
||||
gem 'tent-apidoc', :git => 'git@github.com:tent/tent-apidoc.git', :branch => 'master'
|
||||
|
|
124
Gemfile.lock
124
Gemfile.lock
|
@ -7,46 +7,153 @@ GIT
|
|||
rubypython (~> 0.6.1)
|
||||
|
||||
GIT
|
||||
remote: git@git:tent-schemas.git
|
||||
revision: 965ad389012f24ed220156f978905038d93a67e6
|
||||
remote: git://github.com/tent/tent-schemas.git
|
||||
revision: 52b7bd803759775be13b273d4456a81130c66ba6
|
||||
branch: master
|
||||
specs:
|
||||
tent-schemas (0.1.0)
|
||||
tent-schemas (0.0.1)
|
||||
json-schema
|
||||
|
||||
GIT
|
||||
remote: git@github.com:tent/tent-apidoc.git
|
||||
revision: 3894f0a84d5ca02896139da07edd321b1551887a
|
||||
branch: master
|
||||
specs:
|
||||
tent-apidoc (0.1.0)
|
||||
rack-test
|
||||
tent-client
|
||||
tentd
|
||||
|
||||
GIT
|
||||
remote: git@github.com:tent/tent-client-ruby.git
|
||||
revision: cefddd03e1d2b42dc4ccca0059d0dd7c333d06f3
|
||||
branch: master
|
||||
specs:
|
||||
tent-client (0.0.1)
|
||||
faraday (= 0.8.4)
|
||||
faraday_middleware (= 0.8.8)
|
||||
nokogiri
|
||||
|
||||
GIT
|
||||
remote: git@github.com:tent/tentd.git
|
||||
revision: 64b90e175e265f76db937dc9483e86e5ae1cc71c
|
||||
branch: master
|
||||
specs:
|
||||
tentd (0.0.1)
|
||||
data_mapper (~> 1.2.0)
|
||||
dm-ar-finders (~> 1.2.0)
|
||||
dm-constraints (~> 1.2.0)
|
||||
dm-postgres-adapter (~> 1.2.0)
|
||||
girl_friday (~> 0.10)
|
||||
hashie
|
||||
rack-mount (~> 0.8.3)
|
||||
tent-client
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
addressable (2.2.8)
|
||||
adsf (1.1.1)
|
||||
rack (>= 1.0.0)
|
||||
bcrypt-ruby (3.0.1)
|
||||
blankslate (2.1.2.4)
|
||||
builder (3.0.0)
|
||||
clogger (1.1.0)
|
||||
rack (> 0.9)
|
||||
colored (1.2)
|
||||
connection_pool (0.9.2)
|
||||
cri (2.3.0)
|
||||
colored (>= 1.2)
|
||||
data_mapper (1.2.0)
|
||||
dm-aggregates (~> 1.2.0)
|
||||
dm-constraints (~> 1.2.0)
|
||||
dm-core (~> 1.2.0)
|
||||
dm-migrations (~> 1.2.0)
|
||||
dm-serializer (~> 1.2.0)
|
||||
dm-timestamps (~> 1.2.0)
|
||||
dm-transactions (~> 1.2.0)
|
||||
dm-types (~> 1.2.0)
|
||||
dm-validations (~> 1.2.0)
|
||||
data_objects (0.10.8)
|
||||
addressable (~> 2.1)
|
||||
dm-aggregates (1.2.0)
|
||||
dm-core (~> 1.2.0)
|
||||
dm-ar-finders (1.2.0)
|
||||
dm-core (~> 1.2.0)
|
||||
dm-constraints (1.2.0)
|
||||
dm-core (~> 1.2.0)
|
||||
dm-core (1.2.0)
|
||||
addressable (~> 2.2.6)
|
||||
dm-do-adapter (1.2.0)
|
||||
data_objects (~> 0.10.6)
|
||||
dm-core (~> 1.2.0)
|
||||
dm-migrations (1.2.0)
|
||||
dm-core (~> 1.2.0)
|
||||
dm-postgres-adapter (1.2.0)
|
||||
dm-do-adapter (~> 1.2.0)
|
||||
do_postgres (~> 0.10.6)
|
||||
dm-serializer (1.2.2)
|
||||
dm-core (~> 1.2.0)
|
||||
fastercsv (~> 1.5)
|
||||
json (~> 1.6)
|
||||
json_pure (~> 1.6)
|
||||
multi_json (~> 1.0)
|
||||
dm-timestamps (1.2.0)
|
||||
dm-core (~> 1.2.0)
|
||||
dm-transactions (1.2.0)
|
||||
dm-core (~> 1.2.0)
|
||||
dm-types (1.2.2)
|
||||
bcrypt-ruby (~> 3.0)
|
||||
dm-core (~> 1.2.0)
|
||||
fastercsv (~> 1.5)
|
||||
json (~> 1.6)
|
||||
multi_json (~> 1.0)
|
||||
stringex (~> 1.4)
|
||||
uuidtools (~> 2.1)
|
||||
dm-validations (1.2.0)
|
||||
dm-core (~> 1.2.0)
|
||||
do_postgres (0.10.8)
|
||||
data_objects (= 0.10.8)
|
||||
faraday (0.8.4)
|
||||
multipart-post (~> 1.1)
|
||||
faraday_middleware (0.8.8)
|
||||
faraday (>= 0.7.4, < 0.9)
|
||||
fastercsv (1.5.5)
|
||||
ffi (1.0.11)
|
||||
girl_friday (0.10.0)
|
||||
connection_pool (~> 0.9.0)
|
||||
hashie (1.2.0)
|
||||
json (1.7.5)
|
||||
json-schema (1.0.9)
|
||||
json_pure (1.7.5)
|
||||
mime-types (1.19)
|
||||
multi_json (1.3.6)
|
||||
multipart-post (1.1.5)
|
||||
nanoc (3.4.0)
|
||||
cri (~> 2.2)
|
||||
nanoc-cachebuster (0.3.1)
|
||||
nanoc (>= 3.3.0)
|
||||
nokogiri (1.5.5)
|
||||
puma (1.6.1)
|
||||
puma (1.6.3)
|
||||
rack (~> 1.2)
|
||||
rack (1.4.1)
|
||||
rack-mount (0.8.3)
|
||||
rack (>= 1.0.0)
|
||||
rack-rewrite (1.2.1)
|
||||
rack-test (0.6.1)
|
||||
rack (>= 1.0)
|
||||
rainpress (1.0)
|
||||
redcarpet (2.1.1)
|
||||
rubypython (0.6.2)
|
||||
blankslate (>= 2.1.2.3)
|
||||
ffi (~> 1.0.7)
|
||||
slim (1.2.2)
|
||||
temple (~> 0.4.0)
|
||||
slim (1.3.0)
|
||||
temple (~> 0.4.1)
|
||||
tilt (~> 1.3.3)
|
||||
temple (0.4.0)
|
||||
stringex (1.4.0)
|
||||
temple (0.4.1)
|
||||
tilt (1.3.3)
|
||||
uuidtools (2.1.3)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
@ -66,4 +173,7 @@ DEPENDENCIES
|
|||
rainpress
|
||||
redcarpet
|
||||
slim
|
||||
tent-apidoc!
|
||||
tent-client!
|
||||
tent-schemas!
|
||||
tentd!
|
||||
|
|
1
Rules
1
Rules
|
@ -39,6 +39,7 @@ compile '*' do
|
|||
filter :slim
|
||||
when 'md'
|
||||
filter :schema_table
|
||||
filter :api_example
|
||||
filter :redcarpet, renderer: MarkdownHTML, options: {
|
||||
fenced_code_blocks: true,
|
||||
no_intra_emphasis: true,
|
||||
|
|
16
lib/api_example.rb
Normal file
16
lib/api_example.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
require 'tent-apidoc'
|
||||
|
||||
class ApiExampleFilter < Nanoc::Filter
|
||||
identifier :api_example
|
||||
type :text
|
||||
|
||||
def run(content, params={})
|
||||
content.gsub(/\{(\w+) example\}/) { api_example($1) }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def api_example(id)
|
||||
TentApiDoc.examples[id.to_sym]
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue