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.
Files changed (34) hide show
  1. data/.gitignore +1 -0
  2. data/Gemfile +1 -1
  3. data/LICENSE.txt +1 -1
  4. data/README.md +2 -2
  5. data/app/assets/images/grape_swagger_rails/logo_small.png +0 -0
  6. data/app/assets/images/grape_swagger_rails/throbber.gif +0 -0
  7. data/app/assets/javascripts/grape_swagger_rails/application.js +22 -0
  8. data/app/assets/javascripts/grape_swagger_rails/backbone-min.js +38 -0
  9. data/app/assets/javascripts/grape_swagger_rails/handlebars-1.0.rc.1.js +1920 -0
  10. data/app/assets/javascripts/grape_swagger_rails/highlight.7.3.pack.js +1 -0
  11. data/app/assets/javascripts/grape_swagger_rails/jquery-1.8.0.min.js +2 -0
  12. data/app/assets/javascripts/grape_swagger_rails/jquery.ba-bbq.min.js +18 -0
  13. data/app/assets/javascripts/grape_swagger_rails/jquery.slideto.min.js +1 -0
  14. data/app/assets/javascripts/grape_swagger_rails/jquery.wiggle.min.js +8 -0
  15. data/app/assets/javascripts/grape_swagger_rails/swagger-ui.js +1990 -0
  16. data/app/assets/javascripts/grape_swagger_rails/swagger-ui.min.js +1 -0
  17. data/app/assets/javascripts/grape_swagger_rails/swagger.js +765 -0
  18. data/app/assets/javascripts/grape_swagger_rails/underscore-min.js +32 -0
  19. data/app/assets/stylesheets/grape_swagger_rails/application.css +13 -0
  20. data/app/assets/stylesheets/grape_swagger_rails/hightlight.default.css +135 -0
  21. data/app/assets/stylesheets/grape_swagger_rails/screen.css +1759 -0
  22. data/app/controllers/grape_swagger_rails/application_controller.rb +8 -0
  23. data/app/views/grape_swagger_rails/application/index.html.erb +64 -0
  24. data/config/routes.rb +3 -0
  25. data/grape-swagger-rails.gemspec +9 -12
  26. data/lib/grape-swagger-rails.rb +4 -0
  27. data/lib/grape-swagger-rails/engine.rb +5 -0
  28. data/lib/grape-swagger-rails/version.rb +3 -0
  29. data/lib/script/rails +8 -0
  30. metadata +53 -15
  31. data/lib/generators/grape_swagger/install/install_generator.rb +0 -27
  32. data/lib/generators/grape_swagger/install/templates/general_api.rb +0 -10
  33. data/lib/grape/swagger/rails.rb +0 -9
  34. data/lib/grape/swagger/rails/version.rb +0 -7
@@ -0,0 +1,8 @@
1
+ module GrapeSwaggerRails
2
+ class ApplicationController < ActionController::Base
3
+ #layout :application
4
+ def index
5
+
6
+ end
7
+ end
8
+ end
@@ -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
+ &nbsp;
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
@@ -0,0 +1,3 @@
1
+ GrapeSwaggerRails::Engine.routes.draw do
2
+ root :to => "application#index"
3
+ end
@@ -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/swagger/rails/version'
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 = Grape::Swagger::Rails::VERSION
9
- spec.authors = ['Aleksandr B. Ivanov']
10
- spec.email = %w(radanisk@ya.ru)
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.add_development_dependency 'railties', '~> 3.2.13'
24
- spec.add_development_dependency 'rubyzip', '~> 0.9.9'
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
@@ -0,0 +1,4 @@
1
+ require "grape-swagger-rails/engine"
2
+
3
+ module GrapeSwaggerRails
4
+ end
@@ -0,0 +1,5 @@
1
+ module GrapeSwaggerRails
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace GrapeSwaggerRails
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module GrapeSwaggerRails
2
+ VERSION = "0.0.2"
3
+ 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.1
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-04-05 00:00:00.000000000 Z
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.13
54
- type: :development
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.13
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: :development
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
- description: grape-swagger rails integration
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/generators/grape_swagger/install/install_generator.rb
92
- - lib/generators/grape_swagger/install/templates/general_api.rb
93
- - lib/grape/swagger/rails.rb
94
- - lib/grape/swagger/rails/version.rb
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: 1209004508278927010
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: 1209004508278927010
157
+ hash: 1507627482969947901
120
158
  requirements: []
121
159
  rubyforge_project:
122
- rubygems_version: 1.8.24
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
@@ -1,10 +0,0 @@
1
- require 'grape-swagger'
2
- class GeneralAPI < Grape::API
3
- prefix 'api'
4
-
5
- rescue_from :all, :backtrace => true
6
-
7
- #mount DiscountObserverAPI::V1
8
-
9
- add_swagger_documentation api_version: 'v1'
10
- end
@@ -1,9 +0,0 @@
1
- require "grape/swagger/rails/version"
2
-
3
- module Grape
4
- module Swagger
5
- module Rails
6
- # Your code goes here...
7
- end
8
- end
9
- end
@@ -1,7 +0,0 @@
1
- module Grape
2
- module Swagger
3
- module Rails
4
- VERSION = "0.0.1"
5
- end
6
- end
7
- end