kanpachi 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +4 -2
- data/lib/kanpachi/documentation/config.rb +27 -16
- data/lib/kanpachi/documentation/source/errors/index.html.slim +39 -0
- data/lib/kanpachi/documentation/source/index.html.slim +1 -1
- data/lib/kanpachi/documentation/source/layouts/layout.slim +15 -12
- data/lib/kanpachi/documentation/source/resource.html.slim +3 -3
- data/lib/kanpachi/templates/documentation/config.rb +22 -0
- data/lib/kanpachi/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b32fca8beebd8f5825ae812e10da8afcc954e1e
|
4
|
+
data.tar.gz: e9b1afcb5063c31d7a34a00df982df90b2018444
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13b00d7801dcaa54c0a1ecb266cbfce68ee90f453b72c4d4fc502eb65ad4e701436906ea1e5e8dd773c14095798732484b749968aaef02b7c333d9b8052c902b
|
7
|
+
data.tar.gz: c522f30028ccaf62e7161b622090fb318d3df0ae86a9ae6a2c0623f44ab8558722b1e00dbca5466a7263c512f37910f2bba3b0825911f91edb4fff63499315a9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Kanpachi Changelog
|
2
2
|
|
3
|
+
## 0.0.2
|
4
|
+
|
5
|
+
* Add error codes and responses documentation page.
|
6
|
+
* Add ability to customize the middleman config for your project.
|
7
|
+
* Replace invalid url resource paths for documentation links.
|
8
|
+
* Fix naviation link paths.
|
9
|
+
* Remove About and Contact sections from the generated documentation navigation.
|
10
|
+
|
3
11
|
## 0.0.1
|
4
12
|
|
5
13
|
* First version.
|
data/README.md
CHANGED
@@ -11,7 +11,9 @@ their [wiki](https://github.com/cypriss/mutations/wiki/Filtering-Input) to find
|
|
11
11
|
Response representations are defined as [Roar](https://github.com/apotonick/roar) representers. You can check out the
|
12
12
|
[representable docs](https://github.com/apotonick/representable) to figure out how to customize your responses.
|
13
13
|
|
14
|
-
To
|
14
|
+
To demo an example API project, checkout [kanpachi-example](https://github.com/kamui/kanpachi-example). If you want to see what the html documentation looks like it's available at <http://kamui.github.io/kanpachi-example>.
|
15
|
+
|
16
|
+
This project was inspired by [@mattetti](https://github.com/mattetti/)'s [Weasel-Diesel](https://github.com/mattetti/Weasel-Diesel) project, of which I am also a contributor. I created Kanpachi as a way of experimenting and leaning how to create a DSL in ruby.
|
15
17
|
|
16
18
|
## Example
|
17
19
|
|
@@ -51,7 +53,7 @@ This method can only return up to 800 tweets.
|
|
51
53
|
|
52
54
|
See [__Working with Timelines__](https://dev.twitter.com/docs/working-with-timelines) for instructions on traversing timelines.
|
53
55
|
TEXT
|
54
|
-
versions '1.1'
|
56
|
+
versions '1.1'
|
55
57
|
ssl true
|
56
58
|
formats :json
|
57
59
|
|
@@ -39,7 +39,7 @@ set :api, Kanpachi::APIList.all.first
|
|
39
39
|
# :which_fake_page => "Rendering a fake page with a local variable" }
|
40
40
|
|
41
41
|
api.resources.all.each do |resource|
|
42
|
-
proxy "/#{resource.http_verb}#{resource.url}",
|
42
|
+
proxy "/#{resource.http_verb}#{resource.url.gsub(/[.:]/, '_')}/index.html", 'resource.html', locals: { resource: resource }, ignore: true
|
43
43
|
end
|
44
44
|
|
45
45
|
###
|
@@ -49,8 +49,8 @@ end
|
|
49
49
|
# Automatic image dimensions on image_tag helper
|
50
50
|
# activate :automatic_image_sizes
|
51
51
|
|
52
|
-
#
|
53
|
-
activate :
|
52
|
+
# Pretty URLs
|
53
|
+
activate :directory_indexes
|
54
54
|
|
55
55
|
# Methods defined in the helpers block are available in templates
|
56
56
|
# helpers do
|
@@ -65,20 +65,31 @@ set :js_dir, 'javascripts'
|
|
65
65
|
|
66
66
|
set :images_dir, 'images'
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
project_config_file = File.join(Dir.pwd, 'documentation', 'config.rb')
|
69
|
+
if File.exist?(project_config_file)
|
70
|
+
self.instance_eval File.read(project_config_file)
|
71
|
+
puts 'Loaded documentation/config.rb'
|
72
|
+
else
|
73
|
+
puts 'No documentation/config.rb file found'
|
72
74
|
|
73
|
-
#
|
74
|
-
|
75
|
+
# Reload the browser automatically whenever files change
|
76
|
+
activate :livereload
|
75
77
|
|
76
|
-
#
|
77
|
-
|
78
|
+
# Build-specific configuration
|
79
|
+
configure :build do
|
80
|
+
# For example, change the Compass output style for deployment
|
81
|
+
activate :minify_css
|
78
82
|
|
79
|
-
|
80
|
-
|
83
|
+
# Minify Javascript on build
|
84
|
+
activate :minify_javascript
|
81
85
|
|
82
|
-
|
83
|
-
|
84
|
-
|
86
|
+
# Enable cache buster
|
87
|
+
activate :asset_hash
|
88
|
+
|
89
|
+
# Use relative URLs
|
90
|
+
# activate :relative_assets
|
91
|
+
|
92
|
+
# Or use a different image path
|
93
|
+
# set :http_prefix, "/Content/images/"
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
.container
|
2
|
+
.row
|
3
|
+
.content.col-md-12
|
4
|
+
h1 Error Codes & Responses
|
5
|
+
- api.errors.all.each do |error|
|
6
|
+
h2= Inflecto.humanize(error.name)
|
7
|
+
p= Kanpachi::Markdown.to_html(error.description)
|
8
|
+
.table-responsive
|
9
|
+
table.table.table-hover
|
10
|
+
thead
|
11
|
+
tr colspan="2"
|
12
|
+
strong Response (#{Inflecto.humanize(error.response.name)})
|
13
|
+
tr colspan="2"
|
14
|
+
Status: #{error.response.status}
|
15
|
+
br
|
16
|
+
|
17
|
+
tbody
|
18
|
+
- error.response.representation.properties.each do |k, v|
|
19
|
+
tr
|
20
|
+
td
|
21
|
+
strong= k.to_s.downcase
|
22
|
+
br
|
23
|
+
- if v[:hash]
|
24
|
+
span object
|
25
|
+
- elsif v[:collection]
|
26
|
+
span array
|
27
|
+
- else
|
28
|
+
span= v[:type].to_s.downcase
|
29
|
+
td
|
30
|
+
p= Kanpachi::Markdown.to_html(v[:doc]) if v[:doc]
|
31
|
+
- if v[:example]
|
32
|
+
strong
|
33
|
+
| Example:
|
34
|
+
| #{v[:example]}
|
35
|
+
|
36
|
+
tr
|
37
|
+
td colspan="2"
|
38
|
+
strong Example
|
39
|
+
pre= JSON.pretty_generate(error.response.representation.example)
|
@@ -20,6 +20,6 @@
|
|
20
20
|
- resource = api.resources.find(*route)
|
21
21
|
tr
|
22
22
|
td
|
23
|
-
|
23
|
+
= link_to resource.route, "#{resource.http_verb}#{resource.url.gsub(/[.:]/, '_')}"
|
24
24
|
td= Kanpachi::Markdown.to_html(resource.description)
|
25
25
|
hr
|
@@ -8,13 +8,13 @@ html
|
|
8
8
|
link href="/favicon.png" rel="shortcut icon"
|
9
9
|
title= "#{api.title} - #{api.name}"
|
10
10
|
/! Bootstrap core CSS
|
11
|
-
|
11
|
+
= stylesheet_link_tag "bootstrap.css"
|
12
12
|
/! Custom styles for this template
|
13
|
-
|
13
|
+
= stylesheet_link_tag "jumbotron.css"
|
14
14
|
/! HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
/[if lt IE 9]
|
16
|
+
= javascript_include_tag "html5shiv.js"
|
17
|
+
= javascript_include_tag "respond.min.js"
|
18
18
|
body
|
19
19
|
.navbar.navbar-inverse.navbar-fixed-top
|
20
20
|
.container
|
@@ -27,7 +27,7 @@ html
|
|
27
27
|
.navbar-collapse.collapse
|
28
28
|
ul.nav.navbar-nav
|
29
29
|
li.active
|
30
|
-
|
30
|
+
= link_to 'Home', '/index.html'
|
31
31
|
li.dropdown
|
32
32
|
a.dropdown-toggle data-toggle="dropdown" href="#"
|
33
33
|
| Sections
|
@@ -35,11 +35,14 @@ html
|
|
35
35
|
ul.dropdown-menu
|
36
36
|
- api.sections.to_hash.keys.each do |section|
|
37
37
|
li
|
38
|
-
|
39
|
-
|
40
|
-
a href="#about" About
|
38
|
+
= link_to section, "/index.html##{section.downcase}"
|
39
|
+
|
41
40
|
li
|
42
|
-
|
41
|
+
= link_to 'Errors', '/errors/index.html'
|
42
|
+
/ li
|
43
|
+
/ = link_to 'About', '/index.html#about'
|
44
|
+
/ li
|
45
|
+
/ = link_to 'Contact', '/index.html#contact'
|
43
46
|
/! /.navbar-collapse
|
44
47
|
= yield
|
45
48
|
hr
|
@@ -51,5 +54,5 @@ html
|
|
51
54
|
/! Bootstrap core JavaScript
|
52
55
|
/! ==================================================
|
53
56
|
/! Placed at the end of the document so the pages load faster
|
54
|
-
|
55
|
-
|
57
|
+
= javascript_include_tag "jquery-1.10.2.min.js"
|
58
|
+
= javascript_include_tag "bootstrap.min.js"
|
@@ -1,14 +1,14 @@
|
|
1
1
|
.container
|
2
2
|
.row
|
3
3
|
.content.col-md-12
|
4
|
-
|
4
|
+
h1= resource.route
|
5
5
|
p= Kanpachi::Markdown.to_html(resource.description)
|
6
6
|
.table-responsive
|
7
7
|
table.table.table-hover
|
8
8
|
thead
|
9
9
|
tr
|
10
10
|
td colspan="2"
|
11
|
-
|
11
|
+
h4 Parameters
|
12
12
|
tbody
|
13
13
|
- [[resource.params.input_filters.required_inputs, true], [resource.params.input_filters.optional_inputs, false]].each do |input, required|
|
14
14
|
- input.each do |k, v|
|
@@ -31,7 +31,7 @@
|
|
31
31
|
table.table.table-hover
|
32
32
|
thead
|
33
33
|
tr colspan="2"
|
34
|
-
|
34
|
+
h4 Response (#{Inflecto.humanize(response.name.to_s)})
|
35
35
|
tr colspan="2"
|
36
36
|
Status: #{response.status}
|
37
37
|
br
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Middleman extended configuration
|
2
|
+
# For options, refer to http://middlemanapp.com/advanced/configuration
|
3
|
+
|
4
|
+
# Reload the browser automatically whenever files change
|
5
|
+
activate :livereload
|
6
|
+
|
7
|
+
configure :build do
|
8
|
+
# For example, change the Compass output style for deployment
|
9
|
+
activate :minify_css
|
10
|
+
|
11
|
+
# Minify Javascript on build
|
12
|
+
activate :minify_javascript
|
13
|
+
|
14
|
+
# Enable cache buster
|
15
|
+
activate :asset_hash
|
16
|
+
|
17
|
+
# Use relative URLs
|
18
|
+
# activate :relative_assets
|
19
|
+
|
20
|
+
# Or use a different image path
|
21
|
+
# set :http_prefix, '/docs/'
|
22
|
+
end
|
data/lib/kanpachi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kanpachi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Chu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -275,6 +275,7 @@ files:
|
|
275
275
|
- lib/kanpachi/cli/doc.rb
|
276
276
|
- lib/kanpachi/commands/new.rb
|
277
277
|
- lib/kanpachi/documentation/config.rb
|
278
|
+
- lib/kanpachi/documentation/source/errors/index.html.slim
|
278
279
|
- lib/kanpachi/documentation/source/fonts/glyphicons-halflings-regular.eot
|
279
280
|
- lib/kanpachi/documentation/source/fonts/glyphicons-halflings-regular.svg
|
280
281
|
- lib/kanpachi/documentation/source/fonts/glyphicons-halflings-regular.ttf
|
@@ -317,6 +318,7 @@ files:
|
|
317
318
|
- lib/kanpachi/templates/api/errors.rb
|
318
319
|
- lib/kanpachi/templates/api/posts.rb
|
319
320
|
- lib/kanpachi/templates/api/users.rb
|
321
|
+
- lib/kanpachi/templates/documentation/config.rb
|
320
322
|
- lib/kanpachi/version.rb
|
321
323
|
- spec/api_list_spec.rb
|
322
324
|
- spec/api_spec.rb
|