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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/anyway/rails/settings.rb +7 -5
- data/lib/anyway/railtie.rb +5 -1
- data/lib/anyway/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f9746b519b5adfe5e3a9b1f8753c8bac8a0c89cac457fa52c96c482bdf77897
|
4
|
+
data.tar.gz: b105ab28f23df78e54d163487c75f43b4ec3ed69d761bd92d91d0d080ccb770b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9eda4f4738f72fc3db0d35584b696f310102e4a9caaeebfdf42c991fe54b983f7ec36da7e14dc0b8fac834fd627b387000254f9fc7f43966ef45e268bdc4950
|
7
|
+
data.tar.gz: bc2abf29581fa77b0b467861a8bf4a8225690f8f258eb299d7c76b6337990ce0aa423fe7fda043dd1dcbbd6f2beaad5c227a36117f6aa018190bd42714b2cd0b
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
data/lib/anyway/railtie.rb
CHANGED
@@ -7,11 +7,15 @@ module Anyway # :nodoc:
|
|
7
7
|
# Add settings to Rails config
|
8
8
|
config.anyway_config = Anyway::Settings
|
9
9
|
|
10
|
-
|
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
|
data/lib/anyway/version.rb
CHANGED
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.
|
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-
|
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
|