lurker 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/Gemfile +1 -0
- data/README.md +4 -1
- data/Rakefile +5 -3
- data/lib/lurker/cli.rb +33 -5
- data/lib/lurker/form_builder.rb +2 -1
- data/lib/lurker/presenters/endpoint_presenter.rb +15 -3
- data/lib/lurker/presenters/schema_presenter.rb +5 -4
- data/lib/lurker/templates/javascripts/application.js +1 -6
- data/lib/lurker/templates/javascripts/highlight.pack.js +1 -0
- data/lib/lurker/templates/javascripts/lurker.js +15 -32
- data/lib/lurker/templates/layouts/_sidemenu.html.erb +4 -4
- data/lib/lurker/templates/layouts/application.html.erb +22 -34
- data/lib/lurker/templates/lurker/rendering/_submit_form.html.erb +25 -21
- data/lib/lurker/templates/lurker/rendering/show.html.erb +29 -59
- data/lib/lurker/templates/public/application.css +1329 -1422
- data/lib/lurker/templates/public/application.js +16 -129
- data/lib/lurker/templates/stylesheets/application.css +25 -14
- data/lib/lurker/templates/stylesheets/docs.css +1454 -0
- data/lib/lurker/templates/stylesheets/github.css +124 -0
- data/lib/lurker/version.rb +1 -1
- data/lurker.gemspec +4 -0
- data/spec/spec_helper.rb +8 -1
- data/templates/generate_stuff.rb +3 -1
- data/templates/lurker_app.rb +3 -7
- metadata +47 -16
- metadata.gz.asc +7 -7
- data/lib/lurker/templates/javascripts/plugins/metisMenu/jquery.metisMenu.js +0 -45
- data/lib/lurker/templates/javascripts/prettify.js +0 -28
- data/lib/lurker/templates/javascripts/sb-admin.js +0 -18
- data/lib/lurker/templates/layouts/_navbar_right.html.erb +0 -13
- data/lib/lurker/templates/layouts/_sidesearch.html.erb +0 -12
- data/lib/lurker/templates/lurker/rendering/_breadcrumb.html.erb +0 -9
- data/lib/lurker/templates/lurker/rendering/_information_warning_li.html.erb +0 -8
- data/lib/lurker/templates/lurker/rendering/_left_menu.html.erb +0 -38
- data/lib/lurker/templates/lurker/rendering/_route_definitions.html.erb +0 -7
- data/lib/lurker/templates/lurker/rendering/_undefined_route.html.erb +0 -6
- data/lib/lurker/templates/stylesheets/font-awesome/css/font-awesome.css +0 -1331
- data/lib/lurker/templates/stylesheets/prettify-desert.css +0 -34
- data/lib/lurker/templates/stylesheets/prettify.css +0 -1
- data/lib/lurker/templates/stylesheets/sb-admin.css +0 -315
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 952b043f8da8f4b196d52d6d24fb05aa4e1a5766
|
4
|
+
data.tar.gz: 19afcf3e67b54a0536e071f36ff99a3f8b76083e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17062f274191d624db5bfd6c3cc953744abd7474d53aa8ef5355b2578eec769514618fd3f26ffceb42993d8cc419a61e280578d5976a1948cd26bc7e1b28dad8
|
7
|
+
data.tar.gz: db85104a0f2e96a7a8a781ebbd672fb7493759d6ee500eebbc6eff9216919d2b47b140dd74527db8de570a4fc558970416a1acd0ee9f9860bc96f131c12c582a
|
checksums.yaml.gz.asc
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
Version: GnuPG v1
|
3
3
|
Comment: GPGTools - http://gpgtools.org
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
=
|
5
|
+
iQEcBAABCgAGBQJTa7ALAAoJENcoxKfNVdjbmXMIAIoAFZuoZELYYnXJqf1jXdfe
|
6
|
+
7ZLYhPoI/J5TmxYoJ8D7pzJSw1IK00kmKitFsMmIRjDO5WlaOJoJJWKoQ4KFbo5K
|
7
|
+
rCmRfwdOMNyWSK1dtdwpQkJHs1l/s/VQc9qydyRocjhFeDGh0QWlWyaOOwNXw6Wd
|
8
|
+
Z5lMJRQIGF9AydjhQJxkQ8N7p675rnJanRtbZdWaO0QlYgSjDXYwmwnhmWfCHAIY
|
9
|
+
obGKYXX6vEuUDvHkVpgmn/F33VCLOrsKv4GNh0VWZFmKxgeb937u06GxJawd+m+t
|
10
|
+
XlHCtubTPwHx4quUNgo1/UARfsQqS8bMIHZgp7gADK4olz8iJY6MzMrtIdiyzbQ=
|
11
|
+
=3uqV
|
12
12
|
-----END PGP SIGNATURE-----
|
data.tar.gz.asc
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
Version: GnuPG v1
|
3
3
|
Comment: GPGTools - http://gpgtools.org
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
=
|
5
|
+
iQEcBAABCgAGBQJTa7AIAAoJENcoxKfNVdjbojcIAOHRH9llFujEsRcOVizaQ2Sb
|
6
|
+
DydmPntKMNLqRrkyR9xlLqrL5ybfDGMvd7gpHnpXLzeoKA07nnQk7MNyqUl71cps
|
7
|
+
TJ+A6o5bY+DGL4/WTyrzEpNFlkOwi9pEXUUCgYik2JOTZ+xK+2m0J72eh1zXO+fp
|
8
|
+
o4v/+g8crVqgOLMIK+VNABJCWH7rvP/7oJooRs46v2Av5u7HCgc9iQA0+uu9ry3d
|
9
|
+
HNo3sFqRq3cFiYVVz8GXngcgQAv44ageYRXi1xXKAcXMKDgK0seZ+yuLbI/OKiNx
|
10
|
+
ED1rbJavgA/mhp8mCsdhk74SwRyWDo2TvJCK96D7iSmb5FapBqByKK1JkFX3Vd4=
|
11
|
+
=dJ5L
|
12
12
|
-----END PGP SIGNATURE-----
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -60,7 +60,8 @@ Now, you can test your API on-line (for real)
|
|
60
60
|
- [Pretty submit form to test API endpoints (live) based on schemas][demo_live] (enter a name & press "Submit")
|
61
61
|
- [Handling URLs with dynamic segments][nested_controller_spec_example] (such as `api/v1/:user_id/repos`)
|
62
62
|
- [JSON-Schema partials][partial_example], also in YAML format ([demo][partial_example_demo])
|
63
|
-
-
|
63
|
+
- [Generation PDF documentation][pdf_example]
|
64
|
+
- [Multiple docs for many usecases][suffixes_example] (e.g `:lurker => '...'`)
|
64
65
|
- ERB support inside `.json.yml.erb`
|
65
66
|
- HTTP-Auth authorization for your online docs
|
66
67
|
- Separate API-services generated within one test suite
|
@@ -157,6 +158,8 @@ Also thanks to [Andrey Deryabin][aderyabin] for advice and [React.js][reactjs] f
|
|
157
158
|
[demo_app]: http://lurker-app.herokuapp.com
|
158
159
|
[demo_app2]: http://lurker.razum2um.me
|
159
160
|
[demo_live]: http://lurker.razum2um.me/lurker/api/v1/users-POST.html
|
161
|
+
[pdf_example]: http://lurker.razum2um.me/lurker/LurkerApp.pdf
|
162
|
+
[suffixes_example]: https://www.relishapp.com/razum2um/lurker/docs/request-specs/schema-suffixes
|
160
163
|
|
161
164
|
[Gem Version]: https://rubygems.org/gems/lurker
|
162
165
|
[Build Status]: https://travis-ci.org/razum2um/lurker
|
data/Rakefile
CHANGED
@@ -69,6 +69,7 @@ end
|
|
69
69
|
|
70
70
|
# testing
|
71
71
|
|
72
|
+
ENV['COVERALLS_NOISY'] = '1'
|
72
73
|
Coveralls::RakeTask.new
|
73
74
|
|
74
75
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
@@ -105,14 +106,14 @@ namespace :generate do
|
|
105
106
|
desc "generate a fresh app with rspec installed"
|
106
107
|
task :app do |t|
|
107
108
|
if needs_generation?
|
108
|
-
sh "bundle exec rails new #{EXAMPLE_APP} -d postgresql -m #{File.expand_path '../templates/lurker_app.rb', __FILE__} --skip-javascript --skip-
|
109
|
+
sh "bundle exec rails new #{EXAMPLE_APP} -d postgresql -m #{File.expand_path '../templates/lurker_app.rb', __FILE__} --skip-javascript --skip-git --skip-test-unit --skip-keeps --quiet"
|
109
110
|
end
|
110
111
|
end
|
111
112
|
|
112
113
|
desc "generate a bunch of stuff with generators"
|
113
114
|
task :stuff do
|
115
|
+
in_lurker_app "bundle install"
|
114
116
|
if ENV['BUNDLE_GEMFILE'].to_s.match(/Gemfile(32|40)\.ci$/)
|
115
|
-
in_lurker_app "bundle install"
|
116
117
|
%w[rake rspec-core spring].each do |gem|
|
117
118
|
in_lurker_app "bundle binstubs #{gem}"
|
118
119
|
end
|
@@ -163,6 +164,7 @@ task :features => [:regenerate, :cucumber]
|
|
163
164
|
desc 'convert docs for example app'
|
164
165
|
task :build_example_docs => :features do
|
165
166
|
in_lurker_app "bin/lurker convert -c #{File.expand_path('../README.md', __FILE__)}"
|
167
|
+
in_lurker_app "bin/lurker convert -f pdf -o html"
|
166
168
|
end
|
167
169
|
|
168
170
|
def ask_for_deploy(name, callback)
|
@@ -220,7 +222,7 @@ namespace :razum2um do
|
|
220
222
|
end
|
221
223
|
end
|
222
224
|
|
223
|
-
task :default => [:spec, :regenerate, :cucumber, 'coveralls:push']
|
225
|
+
task :default => ["clobber:coverage", :spec, :regenerate, :cucumber, 'coveralls:push']
|
224
226
|
|
225
227
|
desc 'commits lurker app'
|
226
228
|
task :predeploy do
|
data/lib/lurker/cli.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
require 'thor'
|
2
|
+
require 'execjs'
|
3
|
+
require 'pdfkit'
|
4
|
+
# require 'coderay'
|
2
5
|
require 'digest/sha1'
|
3
6
|
require 'lurker/service'
|
4
7
|
|
@@ -57,27 +60,41 @@ module Lurker
|
|
57
60
|
|
58
61
|
no_tasks do
|
59
62
|
def convert_to_pdf
|
60
|
-
|
63
|
+
css = File.expand_path('application.css', self.class.precompiled_static_root)
|
64
|
+
in_root do
|
65
|
+
service_presenters.each do |service_presenter|
|
66
|
+
html = "<html><body>"
|
67
|
+
service_presenter.endpoints.each do |endpoint_prefix_group|
|
68
|
+
endpoint_prefix_group.each do |endpoint_presenter|
|
69
|
+
html << endpoint_presenter.to_html(layout: false)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
html << "</body></html>"
|
73
|
+
kit = PDFKit.new(html, :page_size => 'Letter')
|
74
|
+
kit.stylesheets << css
|
75
|
+
create_file("#{service_presenter.name}.pdf", kit.to_pdf, force: true)
|
76
|
+
end
|
77
|
+
end
|
61
78
|
end
|
62
79
|
|
63
80
|
def convert_to_html
|
64
81
|
in_root do
|
65
82
|
# js, css, fonts
|
83
|
+
static = []
|
66
84
|
Dir["#{self.class.precompiled_static_root}/*"].each do |fname|
|
67
85
|
if match = fname.match(/application\.(js|css)$/)
|
68
86
|
sha1 = Digest::SHA1.hexdigest(open(fname).read)
|
69
87
|
html_options.merge! match[1] => sha1
|
70
|
-
|
88
|
+
static << (new_name = "application-#{sha1}.#{match[1]}")
|
89
|
+
to = destination.join(new_name).to_s
|
71
90
|
FileUtils.cp_r fname, to
|
72
91
|
spawn "cat #{to} | gzip -9 > #{to}.gz"
|
73
92
|
else
|
74
93
|
FileUtils.cp_r fname, destination.to_s
|
75
94
|
end
|
76
95
|
end
|
77
|
-
end
|
78
96
|
|
79
|
-
|
80
|
-
in_root do
|
97
|
+
service_presenters.each do |service_presenter|
|
81
98
|
create_file("index.html", service_presenter.to_html, force: true)
|
82
99
|
|
83
100
|
service_presenter.endpoints.each do |endpoint_prefix_group|
|
@@ -86,6 +103,17 @@ module Lurker
|
|
86
103
|
end
|
87
104
|
end
|
88
105
|
end
|
106
|
+
|
107
|
+
# cleanup
|
108
|
+
Dir.glob("*.js").each do |fname|
|
109
|
+
FileUtils.rm fname unless static.include? fname
|
110
|
+
end
|
111
|
+
Dir.glob("*.css").each do |fname|
|
112
|
+
FileUtils.rm fname unless static.include? fname
|
113
|
+
end
|
114
|
+
Dir.glob("*.gz").each do |fname|
|
115
|
+
FileUtils.rm fname unless static.include? fname.sub(/\.gz/, '')
|
116
|
+
end
|
89
117
|
end
|
90
118
|
end
|
91
119
|
|
data/lib/lurker/form_builder.rb
CHANGED
@@ -44,13 +44,14 @@ module Lurker
|
|
44
44
|
:partial => 'param_form_element',
|
45
45
|
:locals => {
|
46
46
|
:label => "#{print_labels(parent_labels)}#{label}",
|
47
|
-
:label_text => label,
|
47
|
+
:label_text => "#{print_labels(parent_labels)}#{label}",
|
48
48
|
:value => value
|
49
49
|
}
|
50
50
|
)
|
51
51
|
end
|
52
52
|
|
53
53
|
def add_legend_to_buffer(parent_labels, label)
|
54
|
+
return
|
54
55
|
@_buffer += render(
|
55
56
|
:partial => 'param_form_legend',
|
56
57
|
:locals => { :label => print_labels(parent_labels.clone << label) }
|
@@ -12,12 +12,12 @@ class Lurker::EndpointPresenter < Lurker::BasePresenter
|
|
12
12
|
@service_presenter = Lurker::ServicePresenter.new(endpoint.service)
|
13
13
|
end
|
14
14
|
|
15
|
-
def to_html
|
15
|
+
def to_html(options={})
|
16
16
|
@service_presenter = service_presenter
|
17
17
|
@endpoint_presenter = self
|
18
18
|
@url_params = endpoint.url_params
|
19
19
|
@post_params = example_request.json
|
20
|
-
render('show')
|
20
|
+
render('show', options)
|
21
21
|
end
|
22
22
|
|
23
23
|
def relative_path(extension = ".html")
|
@@ -80,8 +80,20 @@ class Lurker::EndpointPresenter < Lurker::BasePresenter
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def example_response
|
83
|
+
return @example_response if @example_response
|
83
84
|
return if endpoint.response_parameters.empty?
|
84
|
-
|
85
|
+
response = example_from_schema(endpoint.response_parameters, endpoint.schema)
|
86
|
+
@example_response = response.to_json
|
87
|
+
if defined? ExecJS
|
88
|
+
jsfile = File.expand_path('javascripts/highlight.pack.js', Lurker::Cli.source_root)
|
89
|
+
source = open(jsfile).read
|
90
|
+
context = ExecJS.compile(source)
|
91
|
+
@example_response = context.exec("return hljs.highlightAuto(JSON.stringify(#{@example_response}, null, 2)).value")
|
92
|
+
elsif defined? CodeRay
|
93
|
+
@example_response = ::CodeRay.scan(@example_response, :json).html(wrap: nil, css: :class)
|
94
|
+
#::CodeRay.scan(response.to_json, :jjson).html(wrap: nil, css: :class)
|
95
|
+
end
|
96
|
+
@example_response
|
85
97
|
end
|
86
98
|
|
87
99
|
def deprecated?
|
@@ -16,6 +16,7 @@ class Lurker::SchemaPresenter < Lurker::BasePresenter
|
|
16
16
|
)
|
17
17
|
|
18
18
|
def initialize(schema, options)
|
19
|
+
options[:nested] ||= 0
|
19
20
|
super(options)
|
20
21
|
@schema = schema
|
21
22
|
end
|
@@ -25,7 +26,7 @@ class Lurker::SchemaPresenter < Lurker::BasePresenter
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def nested?
|
28
|
-
options[:nested]
|
29
|
+
options[:nested] > 0
|
29
30
|
end
|
30
31
|
|
31
32
|
def to_html
|
@@ -115,7 +116,7 @@ class Lurker::SchemaPresenter < Lurker::BasePresenter
|
|
115
116
|
html = ""
|
116
117
|
html << '<li>Items'
|
117
118
|
|
118
|
-
sub_options = options.merge(:nested =>
|
119
|
+
sub_options = options.merge(:nested => options[:nested] + 1)
|
119
120
|
|
120
121
|
if items.kind_of? Array
|
121
122
|
item.compact.each do |item|
|
@@ -152,7 +153,7 @@ class Lurker::SchemaPresenter < Lurker::BasePresenter
|
|
152
153
|
'<tt>%s</tt>' % key,
|
153
154
|
schema_slug(key, property)
|
154
155
|
)
|
155
|
-
html << self.class.new(property, options.merge(:nested =>
|
156
|
+
html << self.class.new(property, options.merge(:nested => options[:nested] + 1)).to_html
|
156
157
|
html << '</li>'
|
157
158
|
end
|
158
159
|
|
@@ -160,6 +161,6 @@ class Lurker::SchemaPresenter < Lurker::BasePresenter
|
|
160
161
|
end
|
161
162
|
|
162
163
|
def schema_slug(key, property)
|
163
|
-
"#{key}-#{property.hash}"
|
164
|
+
"#{key}-#{options[:nested]}-#{property.hash}"
|
164
165
|
end
|
165
166
|
end
|
@@ -4,10 +4,6 @@
|
|
4
4
|
//= require jquery.remotipart
|
5
5
|
//= require bootstrap
|
6
6
|
|
7
|
-
// Committed sb-admin
|
8
|
-
//= require plugins/metisMenu/jquery.metisMenu
|
9
|
-
//= require sb-admin
|
10
|
-
|
11
7
|
// https://github.com/facebook/react/issues/945
|
12
8
|
//= require phantomjs-shims
|
13
9
|
|
@@ -16,7 +12,6 @@
|
|
16
12
|
//= require react-catalyst
|
17
13
|
|
18
14
|
// Own
|
19
|
-
//= require
|
15
|
+
//= require highlight.pack
|
20
16
|
//= require lurker
|
21
17
|
|
22
|
-
// require demo/dashboard-demo
|
@@ -0,0 +1 @@
|
|
1
|
+
var hljs=new function(){function k(v){return v.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">")}function t(v){return v.nodeName.toLowerCase()}function i(w,x){var v=w&&w.exec(x);return v&&v.index==0}function d(v){return Array.prototype.map.call(v.childNodes,function(w){if(w.nodeType==3){return b.useBR?w.nodeValue.replace(/\n/g,""):w.nodeValue}if(t(w)=="br"){return"\n"}return d(w)}).join("")}function r(w){var v=(w.className+" "+(w.parentNode?w.parentNode.className:"")).split(/\s+/);v=v.map(function(x){return x.replace(/^language-/,"")});return v.filter(function(x){return j(x)||x=="no-highlight"})[0]}function o(x,y){var v={};for(var w in x){v[w]=x[w]}if(y){for(var w in y){v[w]=y[w]}}return v}function u(x){var v=[];(function w(y,z){for(var A=y.firstChild;A;A=A.nextSibling){if(A.nodeType==3){z+=A.nodeValue.length}else{if(t(A)=="br"){z+=1}else{if(A.nodeType==1){v.push({event:"start",offset:z,node:A});z=w(A,z);v.push({event:"stop",offset:z,node:A})}}}}return z})(x,0);return v}function q(w,y,C){var x=0;var F="";var z=[];function B(){if(!w.length||!y.length){return w.length?w:y}if(w[0].offset!=y[0].offset){return(w[0].offset<y[0].offset)?w:y}return y[0].event=="start"?w:y}function A(H){function G(I){return" "+I.nodeName+'="'+k(I.value)+'"'}F+="<"+t(H)+Array.prototype.map.call(H.attributes,G).join("")+">"}function E(G){F+="</"+t(G)+">"}function v(G){(G.event=="start"?A:E)(G.node)}while(w.length||y.length){var D=B();F+=k(C.substr(x,D[0].offset-x));x=D[0].offset;if(D==w){z.reverse().forEach(E);do{v(D.splice(0,1)[0]);D=B()}while(D==w&&D.length&&D[0].offset==x);z.reverse().forEach(A)}else{if(D[0].event=="start"){z.push(D[0].node)}else{z.pop()}v(D.splice(0,1)[0])}}return F+k(C.substr(x))}function m(y){function v(z){return(z&&z.source)||z}function w(A,z){return RegExp(v(A),"m"+(y.cI?"i":"")+(z?"g":""))}function x(D,C){if(D.compiled){return}D.compiled=true;D.k=D.k||D.bK;if(D.k){var z={};function E(G,F){if(y.cI){F=F.toLowerCase()}F.split(" ").forEach(function(H){var I=H.split("|");z[I[0]]=[G,I[1]?Number(I[1]):1]})}if(typeof D.k=="string"){E("keyword",D.k)}else{Object.keys(D.k).forEach(function(F){E(F,D.k[F])})}D.k=z}D.lR=w(D.l||/\b[A-Za-z0-9_]+\b/,true);if(C){if(D.bK){D.b=D.bK.split(" ").join("|")}if(!D.b){D.b=/\B|\b/}D.bR=w(D.b);if(!D.e&&!D.eW){D.e=/\B|\b/}if(D.e){D.eR=w(D.e)}D.tE=v(D.e)||"";if(D.eW&&C.tE){D.tE+=(D.e?"|":"")+C.tE}}if(D.i){D.iR=w(D.i)}if(D.r===undefined){D.r=1}if(!D.c){D.c=[]}var B=[];D.c.forEach(function(F){if(F.v){F.v.forEach(function(G){B.push(o(F,G))})}else{B.push(F=="self"?D:F)}});D.c=B;D.c.forEach(function(F){x(F,D)});if(D.starts){x(D.starts,C)}var A=D.c.map(function(F){return F.bK?"\\.?\\b("+F.b+")\\b\\.?":F.b}).concat([D.tE]).concat([D.i]).map(v).filter(Boolean);D.t=A.length?w(A.join("|"),true):{exec:function(F){return null}};D.continuation={}}x(y)}function c(S,L,J,R){function v(U,V){for(var T=0;T<V.c.length;T++){if(i(V.c[T].bR,U)){return V.c[T]}}}function z(U,T){if(i(U.eR,T)){return U}if(U.eW){return z(U.parent,T)}}function A(T,U){return !J&&i(U.iR,T)}function E(V,T){var U=M.cI?T[0].toLowerCase():T[0];return V.k.hasOwnProperty(U)&&V.k[U]}function w(Z,X,W,V){var T=V?"":b.classPrefix,U='<span class="'+T,Y=W?"":"</span>";U+=Z+'">';return U+X+Y}function N(){var U=k(C);if(!I.k){return U}var T="";var X=0;I.lR.lastIndex=0;var V=I.lR.exec(U);while(V){T+=U.substr(X,V.index-X);var W=E(I,V);if(W){H+=W[1];T+=w(W[0],V[0])}else{T+=V[0]}X=I.lR.lastIndex;V=I.lR.exec(U)}return T+U.substr(X)}function F(){if(I.sL&&!f[I.sL]){return k(C)}var T=I.sL?c(I.sL,C,true,I.continuation.top):g(C);if(I.r>0){H+=T.r}if(I.subLanguageMode=="continuous"){I.continuation.top=T.top}return w(T.language,T.value,false,true)}function Q(){return I.sL!==undefined?F():N()}function P(V,U){var T=V.cN?w(V.cN,"",true):"";if(V.rB){D+=T;C=""}else{if(V.eB){D+=k(U)+T;C=""}else{D+=T;C=U}}I=Object.create(V,{parent:{value:I}})}function G(T,X){C+=T;if(X===undefined){D+=Q();return 0}var V=v(X,I);if(V){D+=Q();P(V,X);return V.rB?0:X.length}var W=z(I,X);if(W){var U=I;if(!(U.rE||U.eE)){C+=X}D+=Q();do{if(I.cN){D+="</span>"}H+=I.r;I=I.parent}while(I!=W.parent);if(U.eE){D+=k(X)}C="";if(W.starts){P(W.starts,"")}return U.rE?0:X.length}if(A(X,I)){throw new Error('Illegal lexeme "'+X+'" for mode "'+(I.cN||"<unnamed>")+'"')}C+=X;return X.length||1}var M=j(S);if(!M){throw new Error('Unknown language: "'+S+'"')}m(M);var I=R||M;var D="";for(var K=I;K!=M;K=K.parent){if(K.cN){D=w(K.cN,D,true)}}var C="";var H=0;try{var B,y,x=0;while(true){I.t.lastIndex=x;B=I.t.exec(L);if(!B){break}y=G(L.substr(x,B.index-x),B[0]);x=B.index+y}G(L.substr(x));for(var K=I;K.parent;K=K.parent){if(K.cN){D+="</span>"}}return{r:H,value:D,language:S,top:I}}catch(O){if(O.message.indexOf("Illegal")!=-1){return{r:0,value:k(L)}}else{throw O}}}function g(y,x){x=x||b.languages||Object.keys(f);var v={r:0,value:k(y)};var w=v;x.forEach(function(z){if(!j(z)){return}var A=c(z,y,false);A.language=z;if(A.r>w.r){w=A}if(A.r>v.r){w=v;v=A}});if(w.language){v.second_best=w}return v}function h(v){if(b.tabReplace){v=v.replace(/^((<[^>]+>|\t)+)/gm,function(w,z,y,x){return z.replace(/\t/g,b.tabReplace)})}if(b.useBR){v=v.replace(/\n/g,"<br>")}return v}function p(z){var y=d(z);var A=r(z);if(A=="no-highlight"){return}var v=A?c(A,y,true):g(y);var w=u(z);if(w.length){var x=document.createElementNS("http://www.w3.org/1999/xhtml","pre");x.innerHTML=v.value;v.value=q(w,u(x),y)}v.value=h(v.value);z.innerHTML=v.value;z.className+=" hljs "+(!A&&v.language||"");z.result={language:v.language,re:v.r};if(v.second_best){z.second_best={language:v.second_best.language,re:v.second_best.r}}}var b={classPrefix:"hljs-",tabReplace:null,useBR:false,languages:undefined};function s(v){b=o(b,v)}function l(){if(l.called){return}l.called=true;var v=document.querySelectorAll("pre code");Array.prototype.forEach.call(v,p)}function a(){addEventListener("DOMContentLoaded",l,false);addEventListener("load",l,false)}var f={};var n={};function e(v,x){var w=f[v]=x(this);if(w.aliases){w.aliases.forEach(function(y){n[y]=v})}}function j(v){return f[v]||f[n[v]]}this.highlight=c;this.highlightAuto=g;this.fixMarkup=h;this.highlightBlock=p;this.configure=s;this.initHighlighting=l;this.initHighlightingOnLoad=a;this.registerLanguage=e;this.getLanguage=j;this.inherit=o;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE]};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE]};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.REGEXP_MODE={cN:"regexp",b:/\//,e:/\/[gim]*/,i:/\n/,c:[this.BE,{b:/\[/,e:/\]/,r:0,c:[this.BE]}]};this.TM={cN:"title",b:this.IR,r:0};this.UTM={cN:"title",b:this.UIR,r:0}}();hljs.registerLanguage("avrasm",function(a){return{cI:true,k:{keyword:"adc add adiw and andi asr bclr bld brbc brbs brcc brcs break breq brge brhc brhs brid brie brlo brlt brmi brne brpl brsh brtc brts brvc brvs bset bst call cbi cbr clc clh cli cln clr cls clt clv clz com cp cpc cpi cpse dec eicall eijmp elpm eor fmul fmuls fmulsu icall ijmp in inc jmp ld ldd ldi lds lpm lsl lsr mov movw mul muls mulsu neg nop or ori out pop push rcall ret reti rjmp rol ror sbc sbr sbrc sbrs sec seh sbi sbci sbic sbis sbiw sei sen ser ses set sev sez sleep spm st std sts sub subi swap tst wdr",built_in:"r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 x|0 xh xl y|0 yh yl z|0 zh zl ucsr1c udr1 ucsr1a ucsr1b ubrr1l ubrr1h ucsr0c ubrr0h tccr3c tccr3a tccr3b tcnt3h tcnt3l ocr3ah ocr3al ocr3bh ocr3bl ocr3ch ocr3cl icr3h icr3l etimsk etifr tccr1c ocr1ch ocr1cl twcr twdr twar twsr twbr osccal xmcra xmcrb eicra spmcsr spmcr portg ddrg ping portf ddrf sreg sph spl xdiv rampz eicrb eimsk gimsk gicr eifr gifr timsk tifr mcucr mcucsr tccr0 tcnt0 ocr0 assr tccr1a tccr1b tcnt1h tcnt1l ocr1ah ocr1al ocr1bh ocr1bl icr1h icr1l tccr2 tcnt2 ocr2 ocdr wdtcr sfior eearh eearl eedr eecr porta ddra pina portb ddrb pinb portc ddrc pinc portd ddrd pind spdr spsr spcr udr0 ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf"},c:[a.CBLCLM,{cN:"comment",b:";",e:"$",r:0},a.CNM,a.BNM,{cN:"number",b:"\\b(\\$[a-zA-Z0-9]+|0o[0-7]+)"},a.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},{cN:"label",b:"^[A-Za-z0-9_.$]+:"},{cN:"preprocessor",b:"#",e:"$"},{cN:"preprocessor",b:"\\.[a-zA-Z]+"},{cN:"localvars",b:"@[0-9]+"}]}});hljs.registerLanguage("json",function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}});
|
@@ -10,14 +10,6 @@ var Lurker = {
|
|
10
10
|
$("#submit-api").attr("disabled", false);
|
11
11
|
},
|
12
12
|
|
13
|
-
disableUrlParams: function() {
|
14
|
-
$("fieldset[ref=url-params] input").prop("disabled", true);
|
15
|
-
},
|
16
|
-
|
17
|
-
enableUrlParams: function() {
|
18
|
-
$("fieldset[ref=url-params] input").prop("disabled", false);
|
19
|
-
},
|
20
|
-
|
21
13
|
detectContentType: function(response) {
|
22
14
|
var contentType = response.getResponseHeader("Content-Type");
|
23
15
|
var detectedContentType = null;
|
@@ -31,43 +23,36 @@ var Lurker = {
|
|
31
23
|
|
32
24
|
fillInInfoTab: function($tab, xhr) {
|
33
25
|
$tab.find('.status td.value').text(xhr.status + " " + xhr.statusText);
|
34
|
-
$tab.find('
|
26
|
+
$tab.find('#headers').text(xhr.getAllResponseHeaders());
|
35
27
|
|
36
28
|
var realTimeTaken = Lurker.lastRequest.endTime - Lurker.lastRequest.startTime;
|
37
29
|
$tab.find('.time td.value').text(realTimeTaken + " ms");
|
38
30
|
},
|
39
31
|
|
40
|
-
|
41
|
-
Lurker.lastRequest.endTime = Date.now();
|
42
|
-
Lurker.enableSubmitButton();
|
43
|
-
Lurker.enableUrlParams();
|
44
|
-
|
45
|
-
if ($("#show-api-response-div:visible").length === 0) {
|
46
|
-
$("#show-api-response-div").slideDown(100);
|
47
|
-
}
|
48
|
-
|
49
|
-
Lurker.fillInInfoTab(
|
50
|
-
$("#show-api-response-div").showNavTab("info"),
|
51
|
-
xhr
|
52
|
-
);
|
53
|
-
|
54
|
-
$("#show-api-response-div pre").hide();
|
32
|
+
fillInRawTab: function($tab, xhr) {
|
55
33
|
switch (Lurker.detectContentType(xhr)) {
|
56
34
|
case "json":
|
57
|
-
|
58
|
-
|
59
|
-
);
|
35
|
+
var json = JSON.stringify(JSON.parse(xhr.responseText), null, 2);
|
36
|
+
var content = hljs.highlightAuto(json).value;
|
60
37
|
break;
|
61
38
|
default:
|
62
|
-
|
39
|
+
var content = xhr.responseText;
|
63
40
|
}
|
41
|
+
$tab.html(content);
|
42
|
+
},
|
64
43
|
|
65
|
-
|
44
|
+
onComplete: function(xhr) {
|
45
|
+
Lurker.lastRequest.endTime = Date.now();
|
46
|
+
Lurker.enableSubmitButton();
|
47
|
+
|
48
|
+
$("#show-api-response-div [ref^='response']").hide();
|
49
|
+
|
50
|
+
Lurker.fillInInfoTab($("#show-api-response-div").showNavTab("info"), xhr);
|
51
|
+
Lurker.fillInRawTab($("#show-api-response-div").showNavTab("raw"), xhr);
|
66
52
|
},
|
67
53
|
|
68
54
|
onSubmit: function($form) {
|
69
55
|
Lurker.disableSubmitButton();
|
70
|
-
Lurker.disableUrlParams();
|
71
56
|
|
72
57
|
$.ajax({
|
73
58
|
url: $form.attr('action'),
|
@@ -83,8 +68,6 @@ var Lurker = {
|
|
83
68
|
};
|
84
69
|
|
85
70
|
$(function($) {
|
86
|
-
window.prettyPrint();
|
87
|
-
|
88
71
|
var activeMenuItem = $('#side-menu a[href="' + window.location.pathname + '"]');
|
89
72
|
if (activeMenuItem.length === 1) {
|
90
73
|
activeMenuItem.addClass('hovered').parents('.collapse').addClass('in').parents('.endpoint-group').addClass('active');
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<% @service_presenter.endpoints_by_prefix.each do |prefix, endpoints| %>
|
2
|
-
<li class="endpoint-group">
|
3
|
-
<a href="#"><%= prefix
|
4
|
-
<ul class="nav
|
2
|
+
<li class="endpoint-group <%= (@endpoint_presenter.nil? && 'opened') || (endpoints.map(&:url).include?(@endpoint_presenter.url) && 'active') %>">
|
3
|
+
<a href="#"><%= prefix %></a>
|
4
|
+
<ul class="nav">
|
5
5
|
<% endpoints.each do |endpoint| %>
|
6
|
-
<li>
|
6
|
+
<li class="<%= (@endpoint_presenter.nil? && 'opened') || (endpoint.url == @endpoint_presenter.url && 'active') %>">
|
7
7
|
<a href="<%= endpoint.url %>">
|
8
8
|
<span class="btn btn-<%= endpoint.verb_colorname %> btn-xs"><%= endpoint.verb %> <%= endpoint.named_path %></span>
|
9
9
|
<br>
|
@@ -25,42 +25,30 @@
|
|
25
25
|
|
26
26
|
<body>
|
27
27
|
|
28
|
-
<
|
29
|
-
|
30
|
-
<
|
31
|
-
|
32
|
-
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
|
33
|
-
<span class="sr-only">Toggle navigation</span>
|
34
|
-
<span class="icon-bar"></span>
|
35
|
-
<span class="icon-bar"></span>
|
36
|
-
<span class="icon-bar"></span>
|
37
|
-
</button>
|
38
|
-
<a class="navbar-brand" href="<%= @service_presenter.html_directory %>"><%= @service_presenter.name %></a>
|
39
|
-
</div>
|
40
|
-
<!-- /.navbar-header -->
|
41
|
-
|
42
|
-
<%#= render 'layouts/navbar_right' %>
|
43
|
-
|
44
|
-
<div class="navbar-default navbar-static-side" role="navigation">
|
45
|
-
<div class="sidebar-collapse">
|
46
|
-
<ul class="nav" id="side-menu">
|
47
|
-
<%#= render 'layouts/sidesearch' %>
|
48
|
-
<%= render 'layouts/sidemenu' %>
|
49
|
-
</ul>
|
50
|
-
<!-- /#side-menu -->
|
51
|
-
</div>
|
52
|
-
<!-- /.sidebar-collapse -->
|
53
|
-
</div>
|
54
|
-
<!-- /.navbar-static-side -->
|
55
|
-
</nav>
|
56
|
-
|
57
|
-
<div id="page-wrapper">
|
58
|
-
<%= yield %>
|
28
|
+
<header class="navbar navbar-static-top bs-docs-nav" id="top" role="banner">
|
29
|
+
<div class="container">
|
30
|
+
<div class="navbar-header">
|
31
|
+
<a class="navbar-brand" href="<%= @service_presenter.html_directory %>"><%= @service_presenter.name %></a>
|
59
32
|
</div>
|
60
|
-
|
61
|
-
|
33
|
+
</div>
|
34
|
+
</header>
|
35
|
+
|
36
|
+
<div class="container bs-docs-container">
|
37
|
+
<div class="row">
|
38
|
+
<div class="col-md-9" role="main">
|
39
|
+
<div class="bs-docs-section">
|
40
|
+
<%= yield %>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
<div class="col-md-3">
|
44
|
+
<div class="bs-docs-sidebar hidden-print" role="complementary">
|
45
|
+
<ul class="nav bs-docs-sidenav">
|
46
|
+
<%= render 'layouts/sidemenu' %>
|
47
|
+
</ul>
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
</div>
|
62
51
|
</div>
|
63
|
-
<!-- /#wrapper -->
|
64
52
|
|
65
53
|
<script src="<%= @service_presenter.html_directory %>/application-<%= @service_presenter.options['js'] %>.js"></script>
|
66
54
|
</body>
|