anyway_config 2.3.0 → 2.3.1

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: fe4f769be22bc9cb820fd1159b88a565b2fb71e13ad617d90aaafbcb1673f995
4
- data.tar.gz: 175e468716722b43b6c7d163a97b6523801f6658118d1c56bb5a4a0255807ef9
3
+ metadata.gz: 0a5f209fc2143bc50d22a63e991a97c5cc70f29cf9a04df1910831699e186042
4
+ data.tar.gz: 43feb4ea48737e139022c848d6a4367fe6947ea24d3fc37c22292bd6b80c63c7
5
5
  SHA512:
6
- metadata.gz: 7c323f89197ca35405ca77ee1e58a8b3fbbf4b0d6b57e7ccce380311a13994d18121966428a2681cb55a5892c2eff52ec347a6e3568072ea8f85d1cf7f75aa80
7
- data.tar.gz: 25ee0b877318a2335c2019a414684d5b15e3755ceff90e51de3a0b821ee48f86a119f9753eaddac5dfb4724e38876ec5f18b68b065db7aa4b23d20b837666929
6
+ metadata.gz: a89d3edcace073fdb144022fbaf31626a4131d4beb7164bc2bb13dd9e78b9cfb8dba9c007c9ca0b423b06319c9bd197b64c82033087cbfc3fbd375a41a02baf4
7
+ data.tar.gz: 035dd8e51f7a6e5fe02a03912bb147fb9de3e9a84525925a87e36451c97a71238639c2f0e60b94ddffddd203be50808ca11264be2dea9b43759676f9003cc0bd
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 2.3.1 (2023-01-17)
6
+
7
+ - [Fixes [#110](https://github.com/palkan/anyway_config/issues/110)] Fix setting up autoloader for the same folder. ([@palkan][])
8
+
9
+ - RBS: Now `.on_load` automatically pass block context type (instance), so no need to add annotations! ([@palkan][])
10
+
11
+ Steep 1.2+ is required. Read more about the [feature](https://hackmd.io/xLrYaqUtQ1GhgTHODkYypw?view).
12
+
13
+ - Added `manifest.yml` for RBS. ([@palkan][])
14
+
5
15
  ## 2.3.0 (2022-03-11)
6
16
 
7
17
  - Add ability to load configurations under specific environments in pure Ruby apps. ([@fargelus][]).
@@ -297,7 +297,7 @@ module Anyway # :nodoc:
297
297
  # - SomeModule::Config => "some_module"
298
298
  # - SomeConfig => "some"
299
299
  unless name =~ /^(\w+)(::)?Config$/
300
- raise "Couldn't infer config name, please, specify it explicitly" \
300
+ raise "Couldn't infer config name, please, specify it explicitly " \
301
301
  "via `config_name :my_config`"
302
302
  end
303
303
 
@@ -53,13 +53,13 @@ module Anyway
53
53
  # the interface when no config file is present.
54
54
  begin
55
55
  if defined?(ERB)
56
- ::YAML.load(ERB.new(File.read(path)).result, aliases: true) || {} # rubocop:disable Security/YAMLLoad
56
+ ::YAML.load(ERB.new(File.read(path)).result, aliases: true) || {}
57
57
  else
58
58
  ::YAML.load_file(path, aliases: true) || {}
59
59
  end
60
60
  rescue ArgumentError
61
61
  if defined?(ERB)
62
- ::YAML.load(ERB.new(File.read(path)).result) || {} # rubocop:disable Security/YAMLLoad
62
+ ::YAML.load(ERB.new(File.read(path)).result) || {}
63
63
  else
64
64
  ::YAML.load_file(path) || {}
65
65
  end
@@ -44,7 +44,7 @@ module Anyway
44
44
  TYPE_TO_CLASS.fetch(type) { defaults[param] ? "Symbol" : "untyped" }
45
45
  when (Array === __m__)
46
46
  "Array[untyped]"
47
- when ((__m__.respond_to?(:deconstruct_keys) && (((__m_hash__src__ = __m__.deconstruct_keys(nil)) || true) && (Hash === __m_hash__src__ || Kernel.raise(TypeError, "#deconstruct_keys must return Hash"))) && (__m_hash__ = __m_hash__src__.dup)) && ((__m_hash__.key?(:array) && __m_hash__.key?(:type)) && (((array = __m_hash__.delete(:array)) || true) && (((type = __m_hash__.delete(:type)) || true) && __m_hash__.empty?))))
47
+ when (((array, type) = nil) || ((__m__.respond_to?(:deconstruct_keys) && (((__m_hash__src__ = __m__.deconstruct_keys(nil)) || true) && (Hash === __m_hash__src__ || Kernel.raise(TypeError, "#deconstruct_keys must return Hash"))) && (__m_hash__ = __m_hash__src__.dup)) && ((__m_hash__.key?(:array) && __m_hash__.key?(:type)) && (((array = __m_hash__.delete(:array)) || true) && (((type = __m_hash__.delete(:type)) || true) && __m_hash__.empty?)))))
48
48
  "Array[#{TYPE_TO_CLASS.fetch(type, "untyped")}]"
49
49
  when (Hash === __m__)
50
50
  "Hash[string,untyped]"
@@ -24,7 +24,7 @@ module Anyway
24
24
 
25
25
  def dig(*__rest__, &__block__)
26
26
  value.dig(*__rest__, &__block__)
27
- end
27
+ end; respond_to?(:ruby2_keywords, true) && (ruby2_keywords :dig)
28
28
 
29
29
  def record_value(val, *path, **opts)
30
30
  key = path.pop
@@ -70,7 +70,7 @@ module Anyway
70
70
  def keep_if(*__rest__, &__block__)
71
71
  raise ArgumentError, "You can only filter :trace type, and this is :#{type}" unless trace?
72
72
  value.keep_if(*__rest__, &__block__)
73
- end
73
+ end; respond_to?(:ruby2_keywords, true) && (ruby2_keywords :keep_if)
74
74
 
75
75
  def clear() ; value.clear; end
76
76
 
@@ -109,7 +109,7 @@ module Anyway
109
109
  return fallback.coerce(key, val) unless caster_config
110
110
 
111
111
  case; when ((__m__ = caster_config)) && false
112
- when ((__m__.respond_to?(:deconstruct_keys) && (((__m_hash__src__ = __m__.deconstruct_keys(nil)) || true) && (Hash === __m_hash__src__ || Kernel.raise(TypeError, "#deconstruct_keys must return Hash"))) && (__m_hash__ = __m_hash__src__.dup)) && ((__m_hash__.key?(:array) && __m_hash__.key?(:type)) && (((array = __m_hash__.delete(:array)) || true) && (((type = __m_hash__.delete(:type)) || true) && __m_hash__.empty?))))
112
+ when (((array, type) = nil) || ((__m__.respond_to?(:deconstruct_keys) && (((__m_hash__src__ = __m__.deconstruct_keys(nil)) || true) && (Hash === __m_hash__src__ || Kernel.raise(TypeError, "#deconstruct_keys must return Hash"))) && (__m_hash__ = __m_hash__src__.dup)) && ((__m_hash__.key?(:array) && __m_hash__.key?(:type)) && (((array = __m_hash__.delete(:array)) || true) && (((type = __m_hash__.delete(:type)) || true) && __m_hash__.empty?)))))
113
113
  registry.deserialize(val, type, array: array)
114
114
  when (Hash === __m__)
115
115
 
@@ -297,7 +297,7 @@ module Anyway # :nodoc:
297
297
  # - SomeModule::Config => "some_module"
298
298
  # - SomeConfig => "some"
299
299
  unless name =~ /^(\w+)(::)?Config$/
300
- raise "Couldn't infer config name, please, specify it explicitly" \
300
+ raise "Couldn't infer config name, please, specify it explicitly " \
301
301
  "via `config_name :my_config`"
302
302
  end
303
303
 
@@ -24,7 +24,7 @@ module Anyway
24
24
 
25
25
  def dig(...)
26
26
  value.dig(...)
27
- end
27
+ end; respond_to?(:ruby2_keywords, true) && (ruby2_keywords :dig)
28
28
 
29
29
  def record_value(val, *path, **opts)
30
30
  key = path.pop
@@ -70,7 +70,7 @@ module Anyway
70
70
  def keep_if(...)
71
71
  raise ArgumentError, "You can only filter :trace type, and this is :#{type}" unless trace?
72
72
  value.keep_if(...)
73
- end
73
+ end; respond_to?(:ruby2_keywords, true) && (ruby2_keywords :keep_if)
74
74
 
75
75
  def clear() ; value.clear; end
76
76
 
@@ -297,7 +297,7 @@ module Anyway # :nodoc:
297
297
  # - SomeModule::Config => "some_module"
298
298
  # - SomeConfig => "some"
299
299
  unless name =~ /^(\w+)(::)?Config$/
300
- raise "Couldn't infer config name, please, specify it explicitly" \
300
+ raise "Couldn't infer config name, please, specify it explicitly " \
301
301
  "via `config_name :my_config`"
302
302
  end
303
303
 
data/lib/anyway/config.rb CHANGED
@@ -297,7 +297,7 @@ module Anyway # :nodoc:
297
297
  # - SomeModule::Config => "some_module"
298
298
  # - SomeConfig => "some"
299
299
  unless name =~ /^(\w+)(::)?Config$/
300
- raise "Couldn't infer config name, please, specify it explicitly" \
300
+ raise "Couldn't infer config name, please, specify it explicitly " \
301
301
  "via `config_name :my_config`"
302
302
  end
303
303
 
@@ -53,13 +53,13 @@ module Anyway
53
53
  # the interface when no config file is present.
54
54
  begin
55
55
  if defined?(ERB)
56
- ::YAML.load(ERB.new(File.read(path)).result, aliases: true) || {} # rubocop:disable Security/YAMLLoad
56
+ ::YAML.load(ERB.new(File.read(path)).result, aliases: true) || {}
57
57
  else
58
58
  ::YAML.load_file(path, aliases: true) || {}
59
59
  end
60
60
  rescue ArgumentError
61
61
  if defined?(ERB)
62
- ::YAML.load(ERB.new(File.read(path)).result) || {} # rubocop:disable Security/YAMLLoad
62
+ ::YAML.load(ERB.new(File.read(path)).result) || {}
63
63
  else
64
64
  ::YAML.load_file(path) || {}
65
65
  end
@@ -18,6 +18,8 @@ module Anyway
18
18
 
19
19
  return unless ::Rails.root.join(val).exist?
20
20
 
21
+ return if val == autoload_static_config_path
22
+
21
23
  autoloader&.unload
22
24
 
23
25
  @autoload_static_config_path = val
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anyway # :nodoc:
4
- VERSION = "2.3.0"
4
+ VERSION = "2.3.1"
5
5
  end
@@ -73,7 +73,7 @@ module Anyway
73
73
  def self.config_attributes: -> Array[Symbol]?
74
74
  def self.required: (*Symbol names, ?env: envType) -> void
75
75
  def self.required_attributes: -> Array[Symbol]
76
- def self.on_load: (*Symbol callbacks) ?{ () -> void } -> void
76
+ def self.on_load: (*Symbol callbacks) ?{ () [self: instance] -> void } -> void
77
77
  def self.config_name: (?(Symbol | String) val) -> String?
78
78
  def self.env_prefix: (?(Symbol | String) val) -> String
79
79
  def self.coerce_types: (**mappingType) -> void
data/sig/manifest.yml ADDED
@@ -0,0 +1,7 @@
1
+ dependencies:
2
+ - name: optparse
3
+ - name: json
4
+ - name: pathname
5
+ - name: date
6
+ - name: time
7
+ - name: set
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anyway_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-11 00:00:00.000000000 Z
11
+ date: 2023-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-next-core
@@ -164,6 +164,7 @@ files:
164
164
  - lib/generators/anyway/install/install_generator.rb
165
165
  - lib/generators/anyway/install/templates/application_config.rb.tt
166
166
  - sig/anyway_config.rbs
167
+ - sig/manifest.yml
167
168
  homepage: http://github.com/palkan/anyway_config
168
169
  licenses:
169
170
  - MIT
@@ -188,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
189
  - !ruby/object:Gem::Version
189
190
  version: '0'
190
191
  requirements: []
191
- rubygems_version: 3.2.22
192
+ rubygems_version: 3.3.11
192
193
  signing_key:
193
194
  specification_version: 4
194
195
  summary: Configuration DSL for Ruby libraries and applications