apipie-dsl 2.2.10 → 2.3.0

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
  SHA256:
3
- metadata.gz: 990ebec629f1450a927333b32acec610e62378a52dd4d04247de392fa15376ad
4
- data.tar.gz: 15a19b903fa3a51096eda59a022ffcfaaaf1bbe82d9253a25b7696a6c04321bc
3
+ metadata.gz: d8be129129902b76525b6f6f49af8ceb5966f658cb12734725a15d7a85e44612
4
+ data.tar.gz: 538ddde32dfe9058739a350a0f641ed64fbc40d8ae529a0ce48e08ce8aa6bbb5
5
5
  SHA512:
6
- metadata.gz: 8b0a2d9ea7df944cb6b1585db1bc18bc98220ffab60e612e832e9eddbd0e19668067da1b950b342b906a36e922c4f539d35ccf4a9d70977593a5931195d16e94
7
- data.tar.gz: ab9e8070fed5ce6cb24c5da93ec3c4b297cb792fa704b5e3fcc2f74c40927deaf608e0401de6dc5eef46fc784e9a89300b9317768398a44f78805c2ccb766333
6
+ metadata.gz: 7c645ba1b449e181d24b1e4710a493056f0332b6408ee6adf51fb2e496d42c37dee53895f03f89425e2a9d10dd5151a163e9c5d1e04a1b8adea6d75dd17860ef
7
+ data.tar.gz: 3b1ae75bc8dc25968e5fc0524a66339212598abe751b9254b21715ab705b42dd9e9b29c6e06c54accb2ec1901a149eb58d1dff60bb8b0b507ba4ae7bad14eb2b
@@ -6,7 +6,7 @@ module ApipieDSL
6
6
  require 'apipie_dsl/static_dispatcher'
7
7
 
8
8
  class Engine < Rails::Engine
9
- initializer 'static assets', :before => :build_middleware_stack do |app|
9
+ initializer 'static assets', before: :build_middleware_stack do |app|
10
10
  app.middleware.use ::ApipieDSL::StaticDispatcher, "#{root}/app/public"
11
11
  end
12
12
  end
@@ -388,7 +388,6 @@ module ApipieDSL
388
388
  @extension_data ||= { methods: [] }
389
389
  end
390
390
 
391
- # rubocop:disable Metrics/AbcSize
392
391
  def self.define_validators(class_scope, method_desc)
393
392
  return if method_desc.nil? || ![true, :implicitly, :explicitly].include?(ApipieDSL.configuration.validate)
394
393
  return unless [true, :implicitly].include?(ApipieDSL.configuration.validate)
@@ -430,7 +429,6 @@ module ApipieDSL
430
429
  end
431
430
  ParameterDescription.merge(method_desc.plain_params, params)
432
431
  end
433
- # rubocop:enable Metrics/AbcSize
434
432
  end
435
433
  end
436
434
 
@@ -33,43 +33,41 @@ module ApipieDSL
33
33
  end
34
34
  end
35
35
 
36
- # rubocop:disable Metrics/ParameterLists
37
36
  def initialize(method_description, name, validator, desc_or_options = nil, options = {}, &block)
38
- if desc_or_options.is_a?(Hash)
39
- options = options.merge(desc_or_options)
40
- elsif desc_or_options.is_a?(String)
41
- options[:desc] = desc_or_options
42
- elsif !desc_or_options.nil?
43
- raise ArgumentError, 'Parameter description: expected description or options as 3rd parameter'
44
- end
37
+ if desc_or_options.is_a?(Hash)
38
+ options = options.merge(desc_or_options)
39
+ elsif desc_or_options.is_a?(String)
40
+ options[:desc] = desc_or_options
41
+ elsif !desc_or_options.nil?
42
+ raise ArgumentError, 'Parameter description: expected description or options as 3rd parameter'
43
+ end
45
44
 
46
- @options = options.transform_keys(&:to_sym)
45
+ @options = options.transform_keys(&:to_sym)
47
46
 
48
- @method_description = method_description
49
- @name = name
50
- @desc = @options[:desc]
51
- @type = @options[:type] || :required
52
- @schema = @options[:schema]
53
- @default_value = @options[:default]
54
- @parent = @options[:parent]
55
- @metadata = @options[:meta]
56
- @show = @options.key?(:show) ? @options[:show] : true
47
+ @method_description = method_description
48
+ @name = name
49
+ @desc = @options[:desc]
50
+ @type = @options[:type] || :required
51
+ @schema = @options[:schema]
52
+ @default_value = @options[:default]
53
+ @parent = @options[:parent]
54
+ @metadata = @options[:meta]
55
+ @show = @options.key?(:show) ? @options[:show] : true
57
56
 
58
- return unless validator
57
+ return unless validator
59
58
 
60
- @validator = if validator.is_a?(String)
61
- ApipieDSL::Validator::Lazy.new(self, validator, @options, block)
62
- else
63
- ApipieDSL::Validator::BaseValidator.find(self, validator, @options, block)
64
- end
65
- raise StandardError, "Validator for #{validator} not found." unless @validator
59
+ @validator = if validator.is_a?(String)
60
+ ApipieDSL::Validator::Lazy.new(self, validator, @options, block)
61
+ else
62
+ ApipieDSL::Validator::BaseValidator.find(self, validator, @options, block)
63
+ end
64
+ raise StandardError, "Validator for #{validator} not found." unless @validator
66
65
  end
67
- # rubocop:enable Metrics/ParameterLists
68
66
 
69
67
  def validator
70
- return @validator unless @validator.is_a?(ApipieDSL::Validator::Lazy)
68
+ return @validator unless @validator.is_a?(ApipieDSL::Validator::Lazy)
71
69
 
72
- @validator = @validator.build
70
+ @validator = @validator.build
73
71
  end
74
72
 
75
73
  def validate(value)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ApipieDSL
2
4
  module Routing
3
5
  module MapperExtensions
@@ -8,6 +8,9 @@ namespace :apipie_dsl do
8
8
  task :cache, [:include_json] => :environment do |_task, args|
9
9
  args.with_defaults(include_json: false)
10
10
  include_json = %w[1 true].include?(args[:include_json])
11
+ cache_part = ENV['cache_part']
12
+ generate_index = (cache_part == 'classes' ? false : true)
13
+ generate_classes = (cache_part == 'index' ? false : true)
11
14
  time_start = Time.now
12
15
  puts "#{time_start} | Started"
13
16
  ApipieDSL::TasksUtils.with_loaded_documentation do
@@ -24,12 +27,16 @@ namespace :apipie_dsl do
24
27
  ApipieDSL.url_prefix = "../../#{subdir}"
25
28
  doc = ApipieDSL.docs(version, nil, nil, lang, section)
26
29
  doc[:docs][:link_extension] = "#{ApipieDSL::TasksUtils.lang_ext(lang)}.html"
27
- ApipieDSL::TasksUtils.generate_index_page(file_base_version, doc, include_json, true, lang, section)
28
- ApipieDSL.url_prefix = "../../../#{subdir}"
29
- section_out = "#{file_base_version}/#{section}"
30
- ApipieDSL::TasksUtils.generate_class_pages(version, section_out, doc, include_json, lang, section)
31
- ApipieDSL.url_prefix = "../../../../#{subdir}"
32
- ApipieDSL::TasksUtils.generate_method_pages(version, section_out, doc, include_json, lang, section)
30
+ if generate_index
31
+ ApipieDSL::TasksUtils.generate_index_page(file_base_version, doc, include_json, true, lang, section)
32
+ end
33
+ if generate_classes
34
+ ApipieDSL.url_prefix = "../../../#{subdir}"
35
+ section_out = "#{file_base_version}/#{section}"
36
+ ApipieDSL::TasksUtils.generate_class_pages(version, section_out, doc, include_json, lang, section)
37
+ ApipieDSL.url_prefix = "../../../../#{subdir}"
38
+ ApipieDSL::TasksUtils.generate_method_pages(version, section_out, doc, include_json, lang, section)
39
+ end
33
40
  end
34
41
  ApipieDSL.url_prefix = "../../#{subdir}"
35
42
  doc = ApipieDSL.docs(version, nil, nil, lang)
@@ -61,12 +68,16 @@ namespace :apipie_dsl do
61
68
  ApipieDSL.url_prefix = "../../#{subdir}"
62
69
  doc = ApipieDSL.docs(version, nil, nil, lang, section)
63
70
  doc[:docs][:link_extension] = "#{ApipieDSL::TasksUtils.lang_ext(lang)}.html"
64
- ApipieDSL::TasksUtils.generate_index_page(file_base_version, doc, include_json, true, lang, section)
65
- ApipieDSL.url_prefix = "../../../#{subdir}"
66
- section_out = "#{file_base_version}/#{section}"
67
- ApipieDSL::TasksUtils.generate_class_pages(version, section_out, doc, include_json, lang, section)
68
- ApipieDSL.url_prefix = "../../../../#{subdir}"
69
- ApipieDSL::TasksUtils.generate_method_pages(version, section_out, doc, include_json, lang, section)
71
+ if generate_index
72
+ ApipieDSL::TasksUtils.generate_index_page(file_base_version, doc, include_json, true, lang, section)
73
+ end
74
+ if generate_classes
75
+ ApipieDSL.url_prefix = "../../../#{subdir}"
76
+ section_out = "#{file_base_version}/#{section}"
77
+ ApipieDSL::TasksUtils.generate_class_pages(version, section_out, doc, include_json, lang, section)
78
+ ApipieDSL.url_prefix = "../../../../#{subdir}"
79
+ ApipieDSL::TasksUtils.generate_method_pages(version, section_out, doc, include_json, lang, section)
80
+ end
70
81
  end
71
82
  ApipieDSL.url_prefix = "../../#{subdir}"
72
83
  doc = ApipieDSL.docs(version, nil, nil, lang)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ApipieDSL
4
- VERSION = '2.2.10'
4
+ VERSION = '2.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apipie-dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.10
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleh Fedorenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-27 00:00:00.000000000 Z
11
+ date: 2020-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler