dpn_swagger_engine 2.0.0.rc

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.travis.yml +5 -0
  4. data/Gemfile +14 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +123 -0
  7. data/Rakefile +37 -0
  8. data/app/assets/fonts/swagger_engine/DroidSans-Bold.ttf +0 -0
  9. data/app/assets/fonts/swagger_engine/DroidSans.ttf +0 -0
  10. data/app/assets/images/swagger_engine/collapse.gif +0 -0
  11. data/app/assets/images/swagger_engine/expand.gif +0 -0
  12. data/app/assets/images/swagger_engine/explorer_icons.png +0 -0
  13. data/app/assets/images/swagger_engine/favicon-16x16.png +0 -0
  14. data/app/assets/images/swagger_engine/favicon-32x32.png +0 -0
  15. data/app/assets/images/swagger_engine/favicon.ico +0 -0
  16. data/app/assets/images/swagger_engine/logo_small.png +0 -0
  17. data/app/assets/images/swagger_engine/pet_store_api.png +0 -0
  18. data/app/assets/images/swagger_engine/throbber.gif +0 -0
  19. data/app/assets/images/swagger_engine/wordnik_api.png +0 -0
  20. data/app/assets/javascripts/swagger_engine/application.js +24 -0
  21. data/app/assets/javascripts/swagger_engine/lang/ca.js +53 -0
  22. data/app/assets/javascripts/swagger_engine/lang/en.js +56 -0
  23. data/app/assets/javascripts/swagger_engine/lang/es.js +53 -0
  24. data/app/assets/javascripts/swagger_engine/lang/fr.js +54 -0
  25. data/app/assets/javascripts/swagger_engine/lang/geo.js +56 -0
  26. data/app/assets/javascripts/swagger_engine/lang/it.js +52 -0
  27. data/app/assets/javascripts/swagger_engine/lang/ja.js +53 -0
  28. data/app/assets/javascripts/swagger_engine/lang/ko-kr.js +53 -0
  29. data/app/assets/javascripts/swagger_engine/lang/pl.js +53 -0
  30. data/app/assets/javascripts/swagger_engine/lang/pt.js +53 -0
  31. data/app/assets/javascripts/swagger_engine/lang/ru.js +56 -0
  32. data/app/assets/javascripts/swagger_engine/lang/tr.js +53 -0
  33. data/app/assets/javascripts/swagger_engine/lang/translator.js +39 -0
  34. data/app/assets/javascripts/swagger_engine/lang/zh-cn.js +53 -0
  35. data/app/assets/javascripts/swagger_engine/lib/backbone-min.js +15 -0
  36. data/app/assets/javascripts/swagger_engine/lib/es5-shim.js +2065 -0
  37. data/app/assets/javascripts/swagger_engine/lib/handlebars-4.0.5.js +4608 -0
  38. data/app/assets/javascripts/swagger_engine/lib/highlight.9.1.0.pack.js +2 -0
  39. data/app/assets/javascripts/swagger_engine/lib/highlight.9.1.0.pack_extended.js +34 -0
  40. data/app/assets/javascripts/swagger_engine/lib/jquery-1.8.0.min.js +2 -0
  41. data/app/assets/javascripts/swagger_engine/lib/jquery.ba-bbq.min.js +18 -0
  42. data/app/assets/javascripts/swagger_engine/lib/jquery.slideto.min.js +1 -0
  43. data/app/assets/javascripts/swagger_engine/lib/jquery.wiggle.min.js +8 -0
  44. data/app/assets/javascripts/swagger_engine/lib/js-yaml.min.js +3 -0
  45. data/app/assets/javascripts/swagger_engine/lib/jsoneditor.min.js +11 -0
  46. data/app/assets/javascripts/swagger_engine/lib/lodash.min.js +102 -0
  47. data/app/assets/javascripts/swagger_engine/lib/marked.js +1272 -0
  48. data/app/assets/javascripts/swagger_engine/lib/object-assign-pollyfill.js +23 -0
  49. data/app/assets/javascripts/swagger_engine/lib/sanitize-html.min.js +6 -0
  50. data/app/assets/javascripts/swagger_engine/lib/swagger-oauth.js +347 -0
  51. data/app/assets/javascripts/swagger_engine/o2c.html +20 -0
  52. data/app/assets/javascripts/swagger_engine/swagger-ui.js +24753 -0
  53. data/app/assets/javascripts/swagger_engine/swagger-ui.min.js +14 -0
  54. data/app/assets/javascripts/swagger_engine/swagger.json +18 -0
  55. data/app/assets/stylesheets/swagger_engine/application.css +12 -0
  56. data/app/assets/stylesheets/swagger_engine/print.css +1367 -0
  57. data/app/assets/stylesheets/swagger_engine/reset.css +125 -0
  58. data/app/assets/stylesheets/swagger_engine/screen.css +1494 -0
  59. data/app/assets/stylesheets/swagger_engine/style.css +250 -0
  60. data/app/assets/stylesheets/swagger_engine/typography.css +14 -0
  61. data/app/controllers/swagger_engine/application_controller.rb +16 -0
  62. data/app/controllers/swagger_engine/swaggers_controller.rb +29 -0
  63. data/app/helpers/swagger_engine/application_helper.rb +4 -0
  64. data/app/helpers/swagger_engine/swagger_helper.rb +4 -0
  65. data/app/views/layouts/swagger_engine/application.html.erb +14 -0
  66. data/app/views/swagger_engine/swaggers/index.html.erb +7 -0
  67. data/app/views/swagger_engine/swaggers/o2c.html +20 -0
  68. data/app/views/swagger_engine/swaggers/show.html.erb +121 -0
  69. data/bin/rails +12 -0
  70. data/bin/setup +8 -0
  71. data/config/routes.rb +4 -0
  72. data/dpn_swagger_engine.gemspec +36 -0
  73. data/lib/swagger_engine/engine.rb +37 -0
  74. data/lib/swagger_engine/version.rb +4 -0
  75. data/lib/swagger_engine.rb +7 -0
  76. data/lib/tasks/swagger_engine_tasks.rake +4 -0
  77. metadata +233 -0
@@ -0,0 +1,250 @@
1
+ .swagger-section #header a#logo {
2
+ font-size: 1.5em;
3
+ font-weight: bold;
4
+ text-decoration: none;
5
+ background: transparent url(../images/logo.png) no-repeat left center;
6
+ padding: 20px 0 20px 40px;
7
+ }
8
+ #text-head {
9
+ font-size: 80px;
10
+ font-family: 'Roboto', sans-serif;
11
+ color: #ffffff;
12
+ float: right;
13
+ margin-right: 20%;
14
+ }
15
+ .navbar-fixed-top .navbar-nav {
16
+ height: auto;
17
+ }
18
+ .navbar-fixed-top .navbar-brand {
19
+ height: auto;
20
+ }
21
+ .navbar-header {
22
+ height: auto;
23
+ }
24
+ .navbar-inverse {
25
+ background-color: #000;
26
+ border-color: #000;
27
+ }
28
+ #navbar-brand {
29
+ margin-left: 20%;
30
+ }
31
+ .navtext {
32
+ font-size: 10px;
33
+ }
34
+ .h1,
35
+ h1 {
36
+ font-size: 60px;
37
+ }
38
+ .navbar-default .navbar-header .navbar-brand {
39
+ color: #a2dfee;
40
+ }
41
+ /* tag titles */
42
+ .swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a {
43
+ color: #393939;
44
+ font-family: 'Arvo', serif;
45
+ font-size: 1.5em;
46
+ }
47
+ .swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover {
48
+ color: black;
49
+ }
50
+ .swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 {
51
+ color: #525252;
52
+ padding-left: 0px;
53
+ display: block;
54
+ clear: none;
55
+ float: left;
56
+ font-family: 'Arvo', serif;
57
+ font-weight: bold;
58
+ }
59
+ .navbar-default .navbar-collapse,
60
+ .navbar-default .navbar-form {
61
+ border-color: #0A0A0A;
62
+ }
63
+ .container1 {
64
+ width: 1500px;
65
+ margin: auto;
66
+ margin-top: 0;
67
+ background-image: url('../images/shield.png');
68
+ background-repeat: no-repeat;
69
+ background-position: -40px -20px;
70
+ margin-bottom: 210px;
71
+ }
72
+ .container-inner {
73
+ width: 1200px;
74
+ margin: auto;
75
+ background-color: rgba(223, 227, 228, 0.75);
76
+ padding-bottom: 40px;
77
+ padding-top: 40px;
78
+ border-radius: 15px;
79
+ }
80
+ .header-content {
81
+ padding: 0;
82
+ width: 1000px;
83
+ }
84
+ .title1 {
85
+ font-size: 80px;
86
+ font-family: 'Vollkorn', serif;
87
+ color: #404040;
88
+ text-align: center;
89
+ padding-top: 40px;
90
+ padding-bottom: 100px;
91
+ }
92
+ #icon {
93
+ margin-top: -18px;
94
+ }
95
+ .subtext {
96
+ font-size: 25px;
97
+ font-style: italic;
98
+ color: #08b;
99
+ text-align: right;
100
+ padding-right: 250px;
101
+ }
102
+ .bg-primary {
103
+ background-color: #00468b;
104
+ }
105
+ .navbar-default .nav > li > a,
106
+ .navbar-default .nav > li > a:focus {
107
+ color: #08b;
108
+ }
109
+ .navbar-default .nav > li > a,
110
+ .navbar-default .nav > li > a:hover {
111
+ color: #08b;
112
+ }
113
+ .navbar-default .nav > li > a,
114
+ .navbar-default .nav > li > a:focus:hover {
115
+ color: #08b;
116
+ }
117
+ .text-faded {
118
+ font-size: 25px;
119
+ font-family: 'Vollkorn', serif;
120
+ }
121
+ .section-heading {
122
+ font-family: 'Vollkorn', serif;
123
+ font-size: 45px;
124
+ padding-bottom: 10px;
125
+ }
126
+ hr {
127
+ border-color: #00468b;
128
+ padding-bottom: 10px;
129
+ }
130
+ .description {
131
+ margin-top: 20px;
132
+ padding-bottom: 200px;
133
+ }
134
+ .description li {
135
+ font-family: 'Vollkorn', serif;
136
+ font-size: 25px;
137
+ color: #525252;
138
+ margin-left: 28%;
139
+ padding-top: 5px;
140
+ }
141
+ .gap {
142
+ margin-top: 200px;
143
+ }
144
+ .troubleshootingtext {
145
+ color: rgba(255, 255, 255, 0.7);
146
+ padding-left: 30%;
147
+ }
148
+ .troubleshootingtext li {
149
+ list-style-type: circle;
150
+ font-size: 25px;
151
+ padding-bottom: 5px;
152
+ }
153
+ .overlay {
154
+ position: absolute;
155
+ top: 0;
156
+ left: 0;
157
+ width: 100%;
158
+ height: 100%;
159
+ z-index: 1000;
160
+ }
161
+ .block.response_body.json:hover {
162
+ cursor: pointer;
163
+ }
164
+ .backdrop {
165
+ color: blue;
166
+ }
167
+ #myModal {
168
+ height: 100%;
169
+ }
170
+ .modal-backdrop {
171
+ bottom: 0;
172
+ position: fixed;
173
+ }
174
+ .curl {
175
+ padding: 10px;
176
+ font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace;
177
+ font-size: 0.9em;
178
+ max-height: 400px;
179
+ margin-top: 5px;
180
+ overflow-y: auto;
181
+ background-color: #fcf6db;
182
+ border: 1px solid #e5e0c6;
183
+ border-radius: 4px;
184
+ }
185
+ .curl_title {
186
+ font-size: 1.1em;
187
+ margin: 0;
188
+ padding: 15px 0 5px;
189
+ font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
190
+ font-weight: 500;
191
+ line-height: 1.1;
192
+ }
193
+ .footer {
194
+ display: none;
195
+ }
196
+ .swagger-section .swagger-ui-wrap h2 {
197
+ padding: 0;
198
+ }
199
+ h2 {
200
+ margin: 0;
201
+ margin-bottom: 5px;
202
+ }
203
+ .markdown p {
204
+ font-size: 15px;
205
+ font-family: 'Arvo', serif;
206
+ }
207
+ .swagger-section .swagger-ui-wrap .code {
208
+ font-size: 15px;
209
+ font-family: 'Arvo', serif;
210
+ }
211
+ .swagger-section .swagger-ui-wrap b {
212
+ font-family: 'Arvo', serif;
213
+ }
214
+ #signin:hover {
215
+ cursor: pointer;
216
+ }
217
+ .dropdown-menu {
218
+ padding: 15px;
219
+ }
220
+ .navbar-right .dropdown-menu {
221
+ left: 0;
222
+ right: auto;
223
+ }
224
+ #signinbutton {
225
+ width: 100%;
226
+ height: 32px;
227
+ font-size: 13px;
228
+ font-weight: bold;
229
+ color: #08b;
230
+ }
231
+ .navbar-default .nav > li .details {
232
+ color: #000000;
233
+ text-transform: none;
234
+ font-size: 15px;
235
+ font-weight: normal;
236
+ font-family: 'Open Sans', sans-serif;
237
+ font-style: italic;
238
+ line-height: 20px;
239
+ top: -2px;
240
+ }
241
+ .navbar-default .nav > li .details:hover {
242
+ color: black;
243
+ }
244
+ #signout {
245
+ width: 100%;
246
+ height: 32px;
247
+ font-size: 13px;
248
+ font-weight: bold;
249
+ color: #08b;
250
+ }
@@ -0,0 +1,14 @@
1
+ /* Google Font's Droid Sans */
2
+ @font-face {
3
+ font-family: 'Droid Sans';
4
+ font-style: normal;
5
+ font-weight: 400;
6
+ src: local('Droid Sans'), local('DroidSans'), url('../fonts/DroidSans.ttf'), format('truetype');
7
+ }
8
+ /* Google Font's Droid Sans Bold */
9
+ @font-face {
10
+ font-family: 'Droid Sans';
11
+ font-style: normal;
12
+ font-weight: 700;
13
+ src: local('Droid Sans Bold'), local('DroidSans-Bold'), url('../fonts/DroidSans-Bold.ttf'), format('truetype');
14
+ }
@@ -0,0 +1,16 @@
1
+ module SwaggerEngine
2
+ class ApplicationController < ActionController::Base
3
+
4
+ before_filter :authenticate
5
+
6
+ protected
7
+ def authenticate
8
+ if SwaggerEngine.configuration.admin_username
9
+ authenticate_or_request_with_http_basic do |username, password|
10
+ username == SwaggerEngine.configuration.admin_username && password == SwaggerEngine.configuration.admin_password
11
+ end
12
+ end
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,29 @@
1
+ require_dependency "swagger_engine/application_controller"
2
+
3
+ module SwaggerEngine
4
+ class SwaggersController < ApplicationController
5
+ layout false
6
+
7
+ before_filter :load_json_files
8
+
9
+ def index
10
+ redirect_to swagger_path(@json_files.first[0]) if ( @json_files.size == 1 )
11
+ end
12
+
13
+ def show
14
+ respond_to do |format|
15
+ format.html {
16
+ @swagger_json_url = swagger_path(params[:id], format: :json)
17
+ }
18
+ format.json {
19
+ send_file @json_files[params[:id].to_sym], type: 'application/json', disposition: 'inline'
20
+ }
21
+ end
22
+ end
23
+
24
+ private
25
+ def load_json_files
26
+ @json_files ||= SwaggerEngine.configuration.json_files || { default: "#{Rails.root}/lib/swagger_engine/swagger.json" }
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,4 @@
1
+ module SwaggerEngine
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module SwaggerEngine
2
+ module SwaggerHelper
3
+ end
4
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>SwaggerEngine</title>
5
+ <%= stylesheet_link_tag "swagger_engine/application", media: "all" %>
6
+ <%= javascript_include_tag "swagger_engine/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,7 @@
1
+ <ul>
2
+ <% @json_files.each_key do |k| %>
3
+ <li>
4
+ <%= link_to k, swagger_path(k) %>
5
+ </li>
6
+ <% end %>
7
+ </ul>
@@ -0,0 +1,20 @@
1
+ <script>
2
+ var qp = null;
3
+ if(window.location.hash) {
4
+ qp = location.hash.substring(1);
5
+ }
6
+ else {
7
+ qp = location.search.substring(1);
8
+ }
9
+ qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g,'":"') + '"}',
10
+ function(key, value) {
11
+ return key===""?value:decodeURIComponent(value) }
12
+ ):{}
13
+
14
+ if (window.opener.swaggerUi.tokenUrl)
15
+ window.opener.processOAuthCode(qp);
16
+ else
17
+ window.opener.onOAuthComplete(qp);
18
+
19
+ window.close();
20
+ </script>
@@ -0,0 +1,121 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Swagger UI</title>
6
+
7
+ <!-- Content in this file is derived from swagger-ui:dist/index.html -->
8
+
9
+ <%#= favicon_link_tag 'favicon-32x32.png', rel: 'icon', type: 'image/png', sizes: '32x32' %>
10
+ <%#= favicon_link_tag 'favicon-16x16.png', rel: 'icon', type: 'image/png', sizes: '16x16' %>
11
+
12
+ <%= stylesheet_link_tag "swagger_engine/application" %>
13
+ <%= stylesheet_link_tag "swagger_engine/reset", media: "print" %>
14
+ <%= stylesheet_link_tag "swagger_engine/print", media: "print" %>
15
+
16
+ <%= javascript_include_tag "swagger_engine/application" %>
17
+
18
+ <%= csrf_meta_tags %>
19
+
20
+ <script type="text/javascript">
21
+ $(function () {
22
+ var url = window.location.search.match(/url=([^&]+)/);
23
+ if (url && url.length > 1) {
24
+ url = decodeURIComponent(url[1]);
25
+ } else {
26
+ url = '<%= @swagger_json_url %>';
27
+ }
28
+
29
+ hljs.configure({
30
+ highlightSizeThreshold: 5000
31
+ });
32
+
33
+ // Pre load translate...
34
+ if(window.SwaggerTranslator) {
35
+ window.SwaggerTranslator.translate();
36
+ }
37
+
38
+ window.swaggerUi = new SwaggerUi({
39
+ url: url,
40
+ dom_id: "swagger-ui-container",
41
+ supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
42
+ onComplete: function(swaggerApi, swaggerUi){
43
+ if(typeof initOAuth == "function") {
44
+ initOAuth({
45
+ clientId: "your-client-id",
46
+ clientSecret: "your-client-secret-if-required",
47
+ realm: "your-realms",
48
+ appName: "your-app-name",
49
+ scopeSeparator: ",",
50
+ additionalQueryStringParams: {}
51
+ });
52
+ }
53
+
54
+ if(window.SwaggerTranslator) {
55
+ window.SwaggerTranslator.translate();
56
+ }
57
+
58
+ headerTokenAuthorization();
59
+ },
60
+ onFailure: function(data) {
61
+ log("Unable to Load SwaggerUI");
62
+ },
63
+ docExpansion: "none",
64
+ jsonEditor: true,
65
+ // apisSorter: "alpha",
66
+ defaultModelRendering: 'schema',
67
+ showRequestHeaders: false
68
+ });
69
+
70
+ // Custom code for DPN authorization token
71
+ function headerTokenAuthorization(){
72
+ var token = encodeURIComponent($('#input_apiKey')[0].value);
73
+ if(token && token.trim() != "") {
74
+ var tokenAuth = new SwaggerClient.ApiKeyAuthorization("Authorization", "Token token=" + token, "header"));
75
+ window.swaggerUi.api.clientAuthorizations.add("api_key", tokenAuth);
76
+ // var tokenAuth = new ApiKeyAuthorization("Authorization", "Token token=" + token, "header"));
77
+ // window.authorizations.add("api_key", tokenAuth);
78
+ log("added token " + token);
79
+ }
80
+ }
81
+
82
+ $('#input_apiKey').change(headerTokenAuthorization);
83
+
84
+ // A DPN authorization token that should work in development
85
+ var dpnToken = "hathi_token";
86
+ $('#input_apiKey').val(dpnToken);
87
+
88
+ window.swaggerUi.load();
89
+
90
+ function log() {
91
+ if ('console' in window) {
92
+ console.log.apply(console, arguments);
93
+ }
94
+ }
95
+ });
96
+ </script>
97
+ </head>
98
+
99
+ <body class="swagger-section">
100
+ <div id='header'>
101
+ <div class="swagger-ui-wrap">
102
+ <a id="logo" href="http://swagger.io">
103
+ <img class="logo__img" alt="swagger" height="30" width="30" src="images/logo_small.png" />
104
+ <span class="logo__title">swagger</span>
105
+ </a>
106
+ <form id='api_selector'>
107
+ <div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
108
+ <!--
109
+ <div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div>
110
+ <div class='input'><a id="explore" href="#" data-sw-translate>Explore</a></div>
111
+ -->
112
+ <div id='auth_container'></div>
113
+ <div class='input'><a id="explore" class="header__btn" href="#" data-sw-translate>Explore</a></div>
114
+ </form>
115
+ </div>
116
+ </div>
117
+
118
+ <div id="message-bar" class="swagger-ui-wrap" data-sw-translate>&nbsp;</div>
119
+ <div id="swagger-ui-container" class="swagger-ui-wrap"></div>
120
+ </body>
121
+ </html>
data/bin/rails ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
3
+
4
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
+ ENGINE_PATH = File.expand_path('../../lib/swagger_engine/engine', __FILE__)
6
+
7
+ # Set up gems listed in the Gemfile.
8
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
9
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
10
+
11
+ require 'rails/all'
12
+ require 'rails/engine/commands'
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install --binstubs .binstubs --path .gems
7
+
8
+ # Do any other automated setup that you need to do here
data/config/routes.rb ADDED
@@ -0,0 +1,4 @@
1
+ SwaggerEngine::Engine.routes.draw do
2
+ resources :swaggers, only: [:index, :show]
3
+ root to: 'swaggers#index'
4
+ end
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ # Maintain your gem's version:
7
+ require 'swagger_engine/version'
8
+
9
+ # Describe your gem and declare its dependencies:
10
+ Gem::Specification.new do |spec|
11
+ spec.name = 'dpn_swagger_engine'
12
+ spec.version = SwaggerEngine::VERSION
13
+ spec.authors = ['batdevis', 'Darren Weber']
14
+ spec.email = ['batdevis@gmail.com', 'dweber.consulting@gmail.com']
15
+ spec.homepage = 'https://github.com/dpn-admin/dpn_swagger_engine'
16
+ spec.summary = 'Mount swagger-ui as rails engine.'
17
+ spec.description = 'API docs for dpn-server.'
18
+ spec.license = 'MIT'
19
+
20
+ # spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
21
+ # spec.test_files = Dir["test/**/*"]
22
+
23
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ spec.bindir = 'exe'
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ['lib']
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.12'
29
+ spec.add_development_dependency 'rake', '~> 10.0'
30
+ spec.add_development_dependency 'rspec', '~> 3.0'
31
+ spec.add_development_dependency 'pry'
32
+ spec.add_development_dependency 'pry-doc'
33
+ spec.add_development_dependency 'rubocop'
34
+ spec.add_development_dependency 'rubocop-rspec'
35
+ spec.add_development_dependency 'yard'
36
+ end
@@ -0,0 +1,37 @@
1
+ module SwaggerEngine
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace SwaggerEngine
4
+
5
+ #https://gist.github.com/parndt/11381872
6
+ =begin
7
+ initializer "swagger_engine.assets.precompile", group: :all do |app|
8
+ app.config.assets.precompile += ['swagger_engine/print.css', 'swagger_engine/reset.css']
9
+ end
10
+ =end
11
+ config.to_prepare do
12
+ Rails.application.config.assets.precompile += ['swagger_engine/print.css', 'swagger_engine/reset.css']
13
+ end
14
+
15
+ end
16
+
17
+ class Configuration
18
+ #[{ default: "swagger.json" }]
19
+ attr_accessor :json_files
20
+ attr_accessor :admin_username
21
+ attr_accessor :admin_password
22
+ end
23
+
24
+ class << self
25
+ attr_writer :configuration
26
+ end
27
+
28
+ module_function
29
+
30
+ def configuration
31
+ @configuration ||= Configuration.new
32
+ end
33
+
34
+ def configure
35
+ yield(configuration)
36
+ end
37
+ end
@@ -0,0 +1,4 @@
1
+ module SwaggerEngine
2
+ # Major version number matches DPN REST API version
3
+ VERSION = '2.0.0.rc'.freeze
4
+ end
@@ -0,0 +1,7 @@
1
+ require 'swagger_engine/engine'
2
+ require 'swagger_engine/version'
3
+
4
+ # Mount swagger-ui as a rails engine to document and explore the
5
+ # DPN REST API within the dpn-server project.
6
+ module SwaggerEngine
7
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :swagger_engine do
3
+ # # Task goes here
4
+ # end