swagger_docs_generator 0.3.3 → 0.3.4.pre.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51e4e07b5c8eccf9f6a8c98e6dfe1b26924d90a7
4
- data.tar.gz: b6d9b46fe030b988ed9655833f36b7efed9db650
3
+ metadata.gz: 9f4348afead82d0b3416fb5d619edffe13244ab9
4
+ data.tar.gz: 0777a1424f94be5989d255905a1f407de5d37afb
5
5
  SHA512:
6
- metadata.gz: 001d4ac313e390f7945ba48359b24d59eace72c31f2ab53be014c4d613ad612c6054e65110c06642df83a0eedc72d3f30bda83123f4c2cab59e371362d42d933
7
- data.tar.gz: b73acca2c364904113b1fa5fac5b7eb155ef85968665ed587fd1a11c1e61ae13f7e6191413a508991a8c08a6fac7a7de31d8e75897a9042a0fdca040d02d57ca
6
+ metadata.gz: a71b2a07ea05e5564b5ccf4d685960a37132692e5a728da56ad080e06bfe52c2687e8905f249dcef0b141ce3bc7215e3b734f9550b2e5c5a004149bd7d5980ce
7
+ data.tar.gz: 5fb002fafe33b3b32bebb6a2162d86706eefc9044fd1aaf109414912f0b9a408fd63fd8b848974be1852b1466daf96488a5df1bf1bde7c40466618098a74bec4
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :reek:NestedIterators
4
+
3
5
  module SwaggerDocsGenerator
4
6
  # # Extractor routes info
5
7
  #
@@ -11,15 +13,20 @@ module SwaggerDocsGenerator
11
13
  @routes = Rails.application.routes.routes
12
14
  end
13
15
 
16
+ # Extract verb to routes
14
17
  def verb
15
18
  router do |route|
16
19
  route.verb.source.to_s.delete('$' + '^')
17
20
  end
18
21
  end
19
22
 
23
+ # Extract path to routes and change format to parameter path
20
24
  def path
21
25
  router do |route|
22
- route.path.spec.to_s.gsub('(.:format)', '.json').gsub(':id', '{id}')
26
+ route.path.spec.to_s.gsub('(.:format)',
27
+ '.json').gsub(/:[a-z1-9_A-Z]*/) do |word|
28
+ "{#{word.delete(':')}}"
29
+ end
23
30
  end
24
31
  end
25
32
 
@@ -36,14 +36,17 @@ module SwaggerDocsGenerator
36
36
  FileUtils.rm_rf(@temp[0]) if SwaggerDocsGenerator.configure.cleanning
37
37
  end
38
38
 
39
+ # Create string with info to swagger file path
39
40
  def info_swagger_file
40
41
  "#{prefix_info} #{@swagger_file}"
41
42
  end
42
43
 
44
+ # Create string with info to path temporary file
43
45
  def info_swagger_temporary
44
46
  "#{prefix_info} #{SwaggerDocsGenerator.temporary_folder}"
45
47
  end
46
48
 
49
+ # Create string with controller parsed
47
50
  def info_controller_parser
48
51
  klasses = "#{SwaggerDocsGenerator.version_ruby}::BaseDoc".constantize
49
52
  klasses.subclasses.each do |controller|
@@ -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.3.3'
8
+ VERSION = '0.3.4'
9
9
  # Authors contributed to gem
10
10
  AUTHORS = ['VAILLANT Jeremy'].freeze
11
11
  # Email to ahuthors
@@ -54,7 +54,8 @@ module SwaggerDocsGenerator
54
54
 
55
55
  def construct_path
56
56
  element = {}
57
- element.merge!(summary: @summary) if @summary.present?
57
+ summary_text = @summary.present? ? @summary : @action.to_s.humanize
58
+ element.merge!(summary: summary_text)
58
59
  element.merge!(description: @description) if @description.present?
59
60
  element.merge!(parameters: @parameter) if @parameter.present?
60
61
  element.merge!(consumes: @consume) if @consume.present?
data/spec/spec_helper.rb CHANGED
@@ -8,6 +8,7 @@ require 'swagger_docs_generator'
8
8
  require 'json-schema-rspec'
9
9
  require 'pry'
10
10
  require 'faker'
11
+ require 'rake'
11
12
 
12
13
  Dir['spec/supporrt/**/*.rb'].each do |f|
13
14
  require File.expand_path(f)
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require 'rake'
5
+
6
+ describe 'SwaggerDocsGenerator::Rake::Docs', type: :rake,
7
+ name: :swagger_docs,
8
+ broken: true do
9
+ before do
10
+ path = File.expand_path('../../../../lib/tasks', __FILE__)
11
+ puts "FILES : #{path}"
12
+ Rake.application.rake_require("#{path}/swagger")
13
+ end
14
+
15
+ it 'Invoke task rake swagger:docs' do
16
+ Rake.application['swagger::docs'].invoke
17
+ end
18
+ 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.3.3
4
+ version: 0.3.4.pre.23
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-23 00:00:00.000000000 Z
11
+ date: 2017-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -292,6 +292,7 @@ files:
292
292
  - spec/swagger_docs_generator/parser/parameters/param_header_spec.rb
293
293
  - spec/swagger_docs_generator/parser/parameters/param_path_spec.rb
294
294
  - spec/swagger_docs_generator/parser/parameters/param_query_spec.rb
295
+ - spec/swagger_docs_generator/rake/swagger_rake_spec.rb
295
296
  homepage: https://github.com/Dev-Crea/swagger-docs-generator
296
297
  licenses:
297
298
  - MIT
@@ -324,12 +325,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
324
325
  version: '0'
325
326
  required_rubygems_version: !ruby/object:Gem::Requirement
326
327
  requirements:
327
- - - ">="
328
+ - - ">"
328
329
  - !ruby/object:Gem::Version
329
- version: '0'
330
+ version: 1.3.1
330
331
  requirements: []
331
332
  rubyforge_project:
332
- rubygems_version: 2.5.1
333
+ rubygems_version: 2.4.5
333
334
  signing_key:
334
335
  specification_version: 4
335
336
  summary: Swagger UI json file