anyway_config 2.0.1 → 2.0.2

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
  SHA256:
3
- metadata.gz: 9b9434114b530b5850b6f9210018f05b1d271072b5f29769700dd166b498c4b0
4
- data.tar.gz: a14411a20a2f549fd955c53dc5e57535207338d7a10c9b91af1dc612b06b30df
3
+ metadata.gz: 7f9746b519b5adfe5e3a9b1f8753c8bac8a0c89cac457fa52c96c482bdf77897
4
+ data.tar.gz: b105ab28f23df78e54d163487c75f43b4ec3ed69d761bd92d91d0d080ccb770b
5
5
  SHA512:
6
- metadata.gz: 97362fd7819d70b1d52700146d12457fd62a0e2eaa34bc9511da87bb362a7722d066dc87c83c5a14381467a8fa934f5f25afe545036d8a6dae6a1492daf0ccfa
7
- data.tar.gz: 2653e0fc1dfb868e0b015048c7f46567b90fb30892fcf9cd6b52d69a16f2635b91e6e409b499b7d0364635d4d755f811e2a1a63bf19831dffa7916ec9b964780
6
+ metadata.gz: f9eda4f4738f72fc3db0d35584b696f310102e4a9caaeebfdf42c991fe54b983f7ec36da7e14dc0b8fac834fd627b387000254f9fc7f43966ef45e268bdc4950
7
+ data.tar.gz: bc2abf29581fa77b0b467861a8bf4a8225690f8f258eb299d7c76b6337990ce0aa423fe7fda043dd1dcbbd6f2beaad5c227a36117f6aa018190bd42714b2cd0b
@@ -1,5 +1,11 @@
1
1
  # Change log
2
2
 
3
+ ## 2.0.2 (2020-04-24)
4
+
5
+ - Make sure configs are eager loaded in Rails when `config.eager_load = true`. ([@palkan][])
6
+
7
+ Fixes [#58](https://github.com/palkan/anyway_config/issues/58).
8
+
3
9
  ## 2.0.1 (2020-04-15)
4
10
 
5
11
  - Fix loading Railtie when application has been already initialized. ([@palkan][])
@@ -10,11 +10,9 @@ end
10
10
  module Anyway
11
11
  class Settings
12
12
  class << self
13
- attr_reader :autoload_static_config_path
13
+ attr_reader :autoload_static_config_path, :autoloader
14
14
 
15
15
  if defined?(::Zeitwerk)
16
- attr_reader :autoloader
17
-
18
16
  def autoload_static_config_path=(val)
19
17
  raise "Cannot setup autoloader after application has been initialized" if ::Rails.application.initialized?
20
18
 
@@ -40,11 +38,15 @@ module Anyway
40
38
  else
41
39
  def autoload_static_config_path=(val)
42
40
  if autoload_static_config_path
43
- ActiveSupport::Dependencies.autoload_paths.delete(::Rails.root.join(autoload_static_config_path).to_s)
41
+ old_path = ::Rails.root.join(autoload_static_config_path).to_s
42
+ ActiveSupport::Dependencies.autoload_paths.delete(old_path)
43
+ ::Rails.application.config.eager_load_paths.delete(old_path)
44
44
  end
45
45
 
46
46
  @autoload_static_config_path = val
47
- ActiveSupport::Dependencies.autoload_paths << ::Rails.root.join(val)
47
+ new_path = ::Rails.root.join(val).to_s
48
+ ActiveSupport::Dependencies.autoload_paths << new_path
49
+ ::Rails.application.config.eager_load_paths << new_path
48
50
  end
49
51
 
50
52
  def cleanup_autoload_paths
@@ -7,11 +7,15 @@ module Anyway # :nodoc:
7
7
  # Add settings to Rails config
8
8
  config.anyway_config = Anyway::Settings
9
9
 
10
- ActiveSupport.on_load(:before_configuration) do
10
+ config.before_configuration do
11
11
  next if ::Rails.application.initialized?
12
12
  config.anyway_config.autoload_static_config_path = DEFAULT_CONFIGS_PATH
13
13
  end
14
14
 
15
+ config.before_eager_load do
16
+ Anyway::Settings.autoloader&.eager_load
17
+ end
18
+
15
19
  # Remove `autoload_static_config_path` from Rails `autoload_paths`
16
20
  # since we use our own autoloading mechanism
17
21
  initializer "anyway_config.cleanup_autoload" do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anyway # :nodoc:
4
- VERSION = "2.0.1"
4
+ VERSION = "2.0.2"
5
5
  end
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.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-15 00:00:00.000000000 Z
11
+ date: 2020-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-next-core