swagger_docs_generator 0.1.2 → 0.2.0.pre.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c5734093ec6f9cbab3b957e7a2a6d90b0d780ae
4
- data.tar.gz: 96a39e44e18eadde0f0e0a530c41437d84f00e71
3
+ metadata.gz: c601e2d531717fc247480909bfb440416f0364c8
4
+ data.tar.gz: 3b131bc8788fce1976747db08288530a0ea0a2c0
5
5
  SHA512:
6
- metadata.gz: 00cf5fbd1e2fa923f38f64ef2c8ddd15f3d148682b1967b8d99aa7f6876ab395db61049e5088281b5ba192a89877f996e5a06c7c6a48c50edee01f33573f4127
7
- data.tar.gz: 4b8db2dddcc67381a419f5bf84dc54cf32e71253914b6953df2df56ba78a793471b33c926d39d267c241bf700d5e1619feadfc539a0597509871ceb9da6b1d51
6
+ metadata.gz: 1ca29dec9600509b63aa3f6c738686e715595e79a7f9c66ce313e3711c186a39841e7c7c3a037a1d6c1b8f0117435b0111f57344afb945eb950471c7173bf7b2
7
+ data.tar.gz: dc05b25092fd2a5f75d3fab0e3ac41d08f2eab1136f4ec98b349ceb19bcd4998f0f40eaa36fbf222c922fc5e868b957241f52a52cf3f678fe3fb7ad2f7bf5337
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in swagger-docs-generator.gemspec
data/README.md CHANGED
@@ -1,36 +1,68 @@
1
- # Swagger::Docs::Generator
1
+ # Swagger::Docs::Generator | [![Build Status](https://travis-ci.org/Dev-Crea/swagger-docs-generator.svg?branch=master)](https://travis-ci.org/Dev-Crea/swagger-docs-generator) [![Gem Version](https://badge.fury.io/rb/swagger_docs_generator.svg)](https://badge.fury.io/rb/swagger_docs_generator) [![Inline docs](https://inch-ci.org/github/Dev-Crea/swagger-docs-generator.svg)](https://inch-ci.org/github/Dev-Crea/swagger-docs-generator)
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/swagger/docs/generator`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Generator for Swagger Apps ([Example with theme](https://github.com/Dev-Crea/swagger-ui))
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ## Menu
6
6
 
7
- ## Installation
7
+ * [How to use](#how-to-use)
8
+ * [Installation](#installation)
9
+ * [Usage](#usage)
10
+ * [Development](#development)
11
+ * [Contributing](#contributing)
8
12
 
9
- Add this line to your application's Gemfile:
13
+
14
+ ## How to use
15
+
16
+ ### Installation
17
+
18
+ Add this line to your application's Gemfile :
10
19
 
11
20
  ```ruby
12
21
  gem 'swagger-docs-generator'
13
22
  ```
14
23
 
15
- And then execute:
24
+ And then execute :
16
25
 
17
- $ bundle
26
+ ```linux
27
+ $ bundle
28
+ ```
18
29
 
19
- Or install it yourself as:
30
+ Or install it yourself as :
20
31
 
21
- $ gem install swagger-docs-generator
32
+ ```linux
33
+ $ gem install swagger-docs-generator
34
+ ```
22
35
 
23
- ## Usage
36
+ ### Usage
24
37
 
25
- TODO: Write usage instructions here
38
+ Create initializer :
39
+
40
+ ```linux
41
+ rails generator swagger_docs_generator:initializer
42
+ ```
43
+
44
+ Execute rake task for generated `swagger.json` :
45
+
46
+ ```linux
47
+ rake swagger:docs
48
+ ```
26
49
 
27
50
  ## Development
28
51
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
52
+ After checking out the repo, run `bin/setup` to install dependencies. Then,
53
+ run `rake spec` to run the tests. You can also run `bin/console` for an
54
+ interactive prompt that will allow you to experiment.
30
55
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
56
+ To install this gem onto your local machine, run `bundle exec rake install`.
57
+ To release a new version, update the version number in `version.rb`, and then
58
+ run `bundle exec rake release`, which will create a git tag for the version,
59
+ push git commits and tags, and push the `.gem` file to
60
+ [rubygems.org](https://rubygems.org).
32
61
 
33
62
  ## Contributing
34
63
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/swagger-docs-generator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
-
64
+ Bug reports and pull requests are welcome on GitHub at
65
+ https://github.com/Dev-Crea/swagger-docs-generator. This project is intended to
66
+ be a safe, welcoming space for collaboration, and contributors are expected to
67
+ adhere to the [Contributor Covenant](http://contributor-covenant.org)
68
+ code of conduct.
@@ -5,7 +5,7 @@ module SwaggerDocsGenerator
5
5
  # Name to gem
6
6
  GEM = 'swagger_docs_generator'
7
7
  # Version to gem
8
- VERSION = '0.1.2'
8
+ VERSION = '0.2.0'
9
9
  # Authors contributed to gem
10
10
  AUTHORS = ['VAILLANT Jeremy'].freeze
11
11
  # Email to ahuthors
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
4
+
5
+ require 'bundler/setup'
6
+ require 'swagger_docs_generator'
7
+ require 'json-schema-rspec'
8
+
9
+ RSpec.configure do |config|
10
+ # Configure RSpec
11
+ config.expect_with :rspec do |c|
12
+ c.syntax = :expect
13
+ end
14
+
15
+ # Add libraries
16
+ config.include JSON::SchemaMatchers
17
+
18
+ # Configure JSON::SchemaMatchers
19
+ Dir[File.join('spec/support/schemas/', '*.json')].count do |file|
20
+ json_file = JSON.parse(File.read(file))
21
+ json_name = File.basename(file, '.json').to_sym
22
+ config.json_schemas[json_name] = json_file
23
+ end
24
+
25
+ # Exclude request with tag broken
26
+ config.filter_run_excluding broken: true
27
+
28
+ # Customize rspec
29
+ config.color = true
30
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.shared_examples 'variable exist' do |name|
4
+ it name do
5
+ expect(variable).not_to be nil
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.shared_examples 'method' do |result|
4
+ it "return #{result}" do
5
+ expect(method).to eql(result)
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "swagger": {
5
+ "type": "string"
6
+ },
7
+ "info": {
8
+ "type": "hash"
9
+ }
10
+ },
11
+ "required": [
12
+ "swagger",
13
+ "info"
14
+ ]
15
+ }
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'support/examples/configuration'
5
+
6
+ describe SwaggerDocsGenerator::Configuration, type: :gem,
7
+ name: :configuration do
8
+ specify do
9
+ expect { |config| SwaggerDocsGenerator.configure(&config) }.to yield_control
10
+ end
11
+
12
+ let(:conf) { SwaggerDocsGenerator.configure }
13
+ let(:variable) { conf.swagger }
14
+ it_behaves_like 'variable exist', 'swagger'
15
+ end
16
+
17
+ describe SwaggerDocsGenerator::ConfigurationInfo, type: :gem,
18
+ name: :configuration_info do
19
+ let(:conf) { SwaggerDocsGenerator.configure_info }
20
+ let(:variable) { conf.title }
21
+ it_behaves_like 'variable exist', 'title'
22
+ let(:variable) { conf.version }
23
+ it_behaves_like 'variable exist', 'version'
24
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe SwaggerDocsGenerator, type: :gem,
6
+ name: :constant do
7
+ it 'has a gem name' do
8
+ expect(SwaggerDocsGenerator::GEM).not_to be nil
9
+ end
10
+
11
+ it 'has a version number' do
12
+ expect(SwaggerDocsGenerator::VERSION).not_to be nil
13
+ end
14
+
15
+ it 'has a author' do
16
+ expect(SwaggerDocsGenerator::AUTHORS).not_to be nil
17
+ end
18
+
19
+ it 'has a email' do
20
+ expect(SwaggerDocsGenerator::EMAILS).not_to be nil
21
+ end
22
+
23
+ it 'has a summary' do
24
+ expect(SwaggerDocsGenerator::SUMMARY).not_to be nil
25
+ end
26
+
27
+ it 'has a dscription' do
28
+ expect(SwaggerDocsGenerator::DESCRIPTION).not_to be nil
29
+ end
30
+
31
+ it 'has a homepage' do
32
+ expect(SwaggerDocsGenerator::HOMEPAGE).not_to be nil
33
+ end
34
+
35
+ it 'has a license' do
36
+ expect(SwaggerDocsGenerator::LICENSE).not_to be nil
37
+ end
38
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'support/examples/generator'
5
+
6
+ describe SwaggerDocsGenerator::Generator, type: :gem,
7
+ name: :generator, broken: true do
8
+ before(:context) do
9
+ @swag = SwaggerDocsGenerator::Generator.new
10
+ @swagger_file = @swag.swagger_file
11
+ end
12
+
13
+ context 'File exist' do
14
+ before(:context) do
15
+ @swag.generate_swagger_file
16
+ end
17
+
18
+ describe '#generate_swagger_file' do
19
+ let(:method) { @swag.generate_swagger_file }
20
+ it_behaves_like 'method', nil
21
+ end
22
+
23
+ it { expect(File.exist?(@swagger_file)).to eql(true) }
24
+ it { expect(@swagger_file).to match_json_schema(:swagger) }
25
+
26
+ after(:context) { File.delete(@swagger_file) }
27
+ end
28
+
29
+ context "File doesn't exist" do
30
+ it { expect(File.exist?(@swagger_file)).to eql(false) }
31
+ end
32
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swagger_docs_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0.pre.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - VAILLANT Jeremy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-09 00:00:00.000000000 Z
11
+ date: 2017-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.12'
19
+ version: '1.13'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.12'
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rspec
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -129,19 +143,65 @@ dependencies:
129
143
  - !ruby/object:Gem::Version
130
144
  version: 0.0.4
131
145
  - !ruby/object:Gem::Dependency
132
- name: rake
146
+ name: travis
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '1.8'
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: 1.8.4
155
+ type: :development
156
+ prerelease: false
157
+ version_requirements: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - "~>"
160
+ - !ruby/object:Gem::Version
161
+ version: '1.8'
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ version: 1.8.4
165
+ - !ruby/object:Gem::Dependency
166
+ name: rails
167
+ requirement: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - "~>"
170
+ - !ruby/object:Gem::Version
171
+ version: '4.2'
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: 4.2.8
175
+ type: :development
176
+ prerelease: false
177
+ version_requirements: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - "~>"
180
+ - !ruby/object:Gem::Version
181
+ version: '4.2'
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: 4.2.8
185
+ - !ruby/object:Gem::Dependency
186
+ name: faker
133
187
  requirement: !ruby/object:Gem::Requirement
134
188
  requirements:
135
189
  - - "~>"
136
190
  - !ruby/object:Gem::Version
137
- version: '12.0'
138
- type: :runtime
191
+ version: '1.7'
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: 1.7.3
195
+ type: :development
139
196
  prerelease: false
140
197
  version_requirements: !ruby/object:Gem::Requirement
141
198
  requirements:
142
199
  - - "~>"
143
200
  - !ruby/object:Gem::Version
144
- version: '12.0'
201
+ version: '1.7'
202
+ - - ">="
203
+ - !ruby/object:Gem::Version
204
+ version: 1.7.3
145
205
  description: Generates swagger-ui json file for rails-api
146
206
  email:
147
207
  - jeremy@dazzl.tv
@@ -185,6 +245,13 @@ files:
185
245
  - lib/swagger_docs_generator/parser/parser.rb
186
246
  - lib/swagger_docs_generator/railtie.rb
187
247
  - lib/tasks/swagger.rake
248
+ - spec/spec_helper.rb
249
+ - spec/support/examples/configuration.rb
250
+ - spec/support/examples/generator.rb
251
+ - spec/support/schemas/swagger.json
252
+ - spec/swagger_docs_generator/configuration_spec.rb
253
+ - spec/swagger_docs_generator/gem_spec.rb
254
+ - spec/swagger_docs_generator/generator_spec.rb
188
255
  homepage: https://github.com/Dev-Crea/swagger-docs-generator
189
256
  licenses:
190
257
  - MIT
@@ -200,12 +267,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
200
267
  version: '0'
201
268
  required_rubygems_version: !ruby/object:Gem::Requirement
202
269
  requirements:
203
- - - ">="
270
+ - - ">"
204
271
  - !ruby/object:Gem::Version
205
- version: '0'
272
+ version: 1.3.1
206
273
  requirements: []
207
274
  rubyforge_project:
208
- rubygems_version: 2.5.1
275
+ rubygems_version: 2.4.5
209
276
  signing_key:
210
277
  specification_version: 4
211
278
  summary: Swagger UI json file