grape-swagger-rails 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +2 -2
- data/app/assets/images/grape_swagger_rails/logo_small.png +0 -0
- data/app/assets/images/grape_swagger_rails/throbber.gif +0 -0
- data/app/assets/javascripts/grape_swagger_rails/application.js +22 -0
- data/app/assets/javascripts/grape_swagger_rails/backbone-min.js +38 -0
- data/app/assets/javascripts/grape_swagger_rails/handlebars-1.0.rc.1.js +1920 -0
- data/app/assets/javascripts/grape_swagger_rails/highlight.7.3.pack.js +1 -0
- data/app/assets/javascripts/grape_swagger_rails/jquery-1.8.0.min.js +2 -0
- data/app/assets/javascripts/grape_swagger_rails/jquery.ba-bbq.min.js +18 -0
- data/app/assets/javascripts/grape_swagger_rails/jquery.slideto.min.js +1 -0
- data/app/assets/javascripts/grape_swagger_rails/jquery.wiggle.min.js +8 -0
- data/app/assets/javascripts/grape_swagger_rails/swagger-ui.js +1990 -0
- data/app/assets/javascripts/grape_swagger_rails/swagger-ui.min.js +1 -0
- data/app/assets/javascripts/grape_swagger_rails/swagger.js +765 -0
- data/app/assets/javascripts/grape_swagger_rails/underscore-min.js +32 -0
- data/app/assets/stylesheets/grape_swagger_rails/application.css +13 -0
- data/app/assets/stylesheets/grape_swagger_rails/hightlight.default.css +135 -0
- data/app/assets/stylesheets/grape_swagger_rails/screen.css +1759 -0
- data/app/controllers/grape_swagger_rails/application_controller.rb +8 -0
- data/app/views/grape_swagger_rails/application/index.html.erb +64 -0
- data/config/routes.rb +3 -0
- data/grape-swagger-rails.gemspec +9 -12
- data/lib/grape-swagger-rails.rb +4 -0
- data/lib/grape-swagger-rails/engine.rb +5 -0
- data/lib/grape-swagger-rails/version.rb +3 -0
- data/lib/script/rails +8 -0
- metadata +53 -15
- data/lib/generators/grape_swagger/install/install_generator.rb +0 -27
- data/lib/generators/grape_swagger/install/templates/general_api.rb +0 -10
- data/lib/grape/swagger/rails.rb +0 -9
- data/lib/grape/swagger/rails/version.rb +0 -7
@@ -0,0 +1,64 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Swagger UI</title>
|
5
|
+
<link href='//fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
|
6
|
+
<%= stylesheet_link_tag 'grape_swagger_rails/application.css' %>
|
7
|
+
<%= javascript_include_tag 'grape_swagger_rails/application.js' %>
|
8
|
+
<script type="text/javascript">
|
9
|
+
$(function () {
|
10
|
+
window.swaggerUi = new SwaggerUi({
|
11
|
+
discoveryUrl:"/api/swagger_doc.json",
|
12
|
+
apiKey:"special-key",
|
13
|
+
dom_id:"swagger-ui-container",
|
14
|
+
supportHeaderParams: true,
|
15
|
+
supportedSubmitMethods: ['get', 'post', 'put'],
|
16
|
+
onComplete: function(swaggerApi, swaggerUi){
|
17
|
+
if(console) {
|
18
|
+
console.log("Loaded SwaggerUI")
|
19
|
+
console.log(swaggerApi);
|
20
|
+
console.log(swaggerUi);
|
21
|
+
}
|
22
|
+
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
|
23
|
+
},
|
24
|
+
onFailure: function(data) {
|
25
|
+
if(console) {
|
26
|
+
console.log("Unable to Load SwaggerUI");
|
27
|
+
console.log(data);
|
28
|
+
}
|
29
|
+
},
|
30
|
+
docExpansion: "none"
|
31
|
+
});
|
32
|
+
|
33
|
+
window.swaggerUi.load();
|
34
|
+
});
|
35
|
+
|
36
|
+
</script>
|
37
|
+
</head>
|
38
|
+
|
39
|
+
<body>
|
40
|
+
<div id='header'>
|
41
|
+
<div class="swagger-ui-wrap">
|
42
|
+
<a id="logo" href="http://swagger.wordnik.com">swagger</a>
|
43
|
+
|
44
|
+
<form id='api_selector'>
|
45
|
+
|
46
|
+
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl"
|
47
|
+
type="text"/></div>
|
48
|
+
<div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div>
|
49
|
+
<div class='input'><a id="explore" href="#">Explore</a></div>
|
50
|
+
</form>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
<div id="message-bar" class="swagger-ui-wrap">
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<div id="swagger-ui-container" class="swagger-ui-wrap">
|
59
|
+
|
60
|
+
</div>
|
61
|
+
|
62
|
+
</body>
|
63
|
+
|
64
|
+
</html>
|
data/config/routes.rb
ADDED
data/grape-swagger-rails.gemspec
CHANGED
@@ -1,25 +1,22 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'grape
|
4
|
+
require 'grape-swagger-rails/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'grape-swagger-rails'
|
8
|
-
spec.version =
|
9
|
-
spec.authors = ['Aleksandr B. Ivanov']
|
10
|
-
spec.email =
|
11
|
-
spec.description = %q{grape-swagger rails integration}
|
12
|
-
spec.summary = %q{grape-swagger rails integration}
|
8
|
+
spec.version = GrapeSwaggerRails::VERSION
|
9
|
+
spec.authors = ['Aleksandr B. Ivanov', 'Alexander Logunov']
|
10
|
+
spec.email = ['radanisk@ya.ru', 'unlovedru@gmail.com']
|
11
|
+
spec.description = %q{grape grape-swagger swagger-ui rails integration}
|
12
|
+
spec.summary = %q{grape grape-swagger swagger-ui rails integration}
|
13
13
|
spec.homepage = ''
|
14
14
|
spec.license = 'MIT'
|
15
|
-
|
16
15
|
spec.files = `git ls-files`.split($/)
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = %w(lib)
|
20
16
|
|
21
17
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
18
|
spec.add_development_dependency 'rake'
|
23
|
-
spec.
|
24
|
-
spec.
|
19
|
+
spec.add_dependency 'railties', '~> 3.2.12'
|
20
|
+
spec.add_dependency 'rubyzip', '~> 0.9.9'
|
21
|
+
spec.add_dependency 'grape-swagger', '~> 0.5.0'
|
25
22
|
end
|
data/lib/script/rails
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
5
|
+
ENGINE_PATH = File.expand_path('../../lib/grape-swagger-rails/engine', __FILE__)
|
6
|
+
|
7
|
+
require 'rails/all'
|
8
|
+
require 'rails/engine/commands'
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-swagger-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Aleksandr B. Ivanov
|
9
|
+
- Alexander Logunov
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2013-
|
13
|
+
date: 2013-05-24 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: bundler
|
@@ -50,15 +51,15 @@ dependencies:
|
|
50
51
|
requirements:
|
51
52
|
- - ~>
|
52
53
|
- !ruby/object:Gem::Version
|
53
|
-
version: 3.2.
|
54
|
-
type: :
|
54
|
+
version: 3.2.12
|
55
|
+
type: :runtime
|
55
56
|
prerelease: false
|
56
57
|
version_requirements: !ruby/object:Gem::Requirement
|
57
58
|
none: false
|
58
59
|
requirements:
|
59
60
|
- - ~>
|
60
61
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.2.
|
62
|
+
version: 3.2.12
|
62
63
|
- !ruby/object:Gem::Dependency
|
63
64
|
name: rubyzip
|
64
65
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +68,7 @@ dependencies:
|
|
67
68
|
- - ~>
|
68
69
|
- !ruby/object:Gem::Version
|
69
70
|
version: 0.9.9
|
70
|
-
type: :
|
71
|
+
type: :runtime
|
71
72
|
prerelease: false
|
72
73
|
version_requirements: !ruby/object:Gem::Requirement
|
73
74
|
none: false
|
@@ -75,9 +76,26 @@ dependencies:
|
|
75
76
|
- - ~>
|
76
77
|
- !ruby/object:Gem::Version
|
77
78
|
version: 0.9.9
|
78
|
-
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: grape-swagger
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ~>
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 0.5.0
|
87
|
+
type: :runtime
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ~>
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 0.5.0
|
95
|
+
description: grape grape-swagger swagger-ui rails integration
|
79
96
|
email:
|
80
97
|
- radanisk@ya.ru
|
98
|
+
- unlovedru@gmail.com
|
81
99
|
executables: []
|
82
100
|
extensions: []
|
83
101
|
extra_rdoc_files: []
|
@@ -87,11 +105,31 @@ files:
|
|
87
105
|
- LICENSE.txt
|
88
106
|
- README.md
|
89
107
|
- Rakefile
|
108
|
+
- app/assets/images/grape_swagger_rails/logo_small.png
|
109
|
+
- app/assets/images/grape_swagger_rails/throbber.gif
|
110
|
+
- app/assets/javascripts/grape_swagger_rails/application.js
|
111
|
+
- app/assets/javascripts/grape_swagger_rails/backbone-min.js
|
112
|
+
- app/assets/javascripts/grape_swagger_rails/handlebars-1.0.rc.1.js
|
113
|
+
- app/assets/javascripts/grape_swagger_rails/highlight.7.3.pack.js
|
114
|
+
- app/assets/javascripts/grape_swagger_rails/jquery-1.8.0.min.js
|
115
|
+
- app/assets/javascripts/grape_swagger_rails/jquery.ba-bbq.min.js
|
116
|
+
- app/assets/javascripts/grape_swagger_rails/jquery.slideto.min.js
|
117
|
+
- app/assets/javascripts/grape_swagger_rails/jquery.wiggle.min.js
|
118
|
+
- app/assets/javascripts/grape_swagger_rails/swagger-ui.js
|
119
|
+
- app/assets/javascripts/grape_swagger_rails/swagger-ui.min.js
|
120
|
+
- app/assets/javascripts/grape_swagger_rails/swagger.js
|
121
|
+
- app/assets/javascripts/grape_swagger_rails/underscore-min.js
|
122
|
+
- app/assets/stylesheets/grape_swagger_rails/application.css
|
123
|
+
- app/assets/stylesheets/grape_swagger_rails/hightlight.default.css
|
124
|
+
- app/assets/stylesheets/grape_swagger_rails/screen.css
|
125
|
+
- app/controllers/grape_swagger_rails/application_controller.rb
|
126
|
+
- app/views/grape_swagger_rails/application/index.html.erb
|
127
|
+
- config/routes.rb
|
90
128
|
- grape-swagger-rails.gemspec
|
91
|
-
- lib/
|
92
|
-
- lib/
|
93
|
-
- lib/grape
|
94
|
-
- lib/
|
129
|
+
- lib/grape-swagger-rails.rb
|
130
|
+
- lib/grape-swagger-rails/engine.rb
|
131
|
+
- lib/grape-swagger-rails/version.rb
|
132
|
+
- lib/script/rails
|
95
133
|
homepage: ''
|
96
134
|
licenses:
|
97
135
|
- MIT
|
@@ -107,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
145
|
version: '0'
|
108
146
|
segments:
|
109
147
|
- 0
|
110
|
-
hash:
|
148
|
+
hash: 1507627482969947901
|
111
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
150
|
none: false
|
113
151
|
requirements:
|
@@ -116,11 +154,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
154
|
version: '0'
|
117
155
|
segments:
|
118
156
|
- 0
|
119
|
-
hash:
|
157
|
+
hash: 1507627482969947901
|
120
158
|
requirements: []
|
121
159
|
rubyforge_project:
|
122
|
-
rubygems_version: 1.8.
|
160
|
+
rubygems_version: 1.8.25
|
123
161
|
signing_key:
|
124
162
|
specification_version: 3
|
125
|
-
summary: grape-swagger rails integration
|
163
|
+
summary: grape grape-swagger swagger-ui rails integration
|
126
164
|
test_files: []
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'rails/generators/named_base'
|
2
|
-
require 'zip/zip'
|
3
|
-
|
4
|
-
module GrapeSwagger
|
5
|
-
module Generators
|
6
|
-
class InstallGenerator < ::Rails::Generators::Base
|
7
|
-
def self.source_root
|
8
|
-
@_grape_swagger_source_root ||= File.expand_path("../templates", __FILE__)
|
9
|
-
end
|
10
|
-
|
11
|
-
def install
|
12
|
-
Zip::ZipFile.foreach(open('https://github.com/wordnik/swagger-ui/archive/master.zip')) do |zip_entry|
|
13
|
-
zip_entry.extract(zip_entry.to_s.gsub('swagger-ui-master/dist/', 'public/apidoc/')) if zip_entry.to_s =~ /\/dist\//
|
14
|
-
end
|
15
|
-
|
16
|
-
file_name = 'public/apidoc/index.html'
|
17
|
-
text = File.read(file_name)
|
18
|
-
new_text = text.gsub('css/', '/apidoc/css/').gsub('lib/', '/apidoc/lib/').gsub('swagger-ui.js', '/apidoc/swagger-ui.js').gsub('images/', '/apidoc/images/').gsub('supportHeaderParams: false', 'supportHeaderParams: true').gsub('http://petstore.swagger.wordnik.com/api/api-docs.json', '/api/swagger_doc.json')
|
19
|
-
File.open(file_name, 'w') { |file| file.puts new_text }
|
20
|
-
|
21
|
-
template 'general_api.rb', 'app/api/general_api.rb'
|
22
|
-
|
23
|
-
route "mount GeneralAPI => '/'"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/lib/grape/swagger/rails.rb
DELETED