dynamic_configuration 0.1.2 → 0.1.3
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.
- data/VERSION +1 -1
- data/dynamic_configuration.gemspec +1 -1
- data/lib/dynamic_configuration.rb +13 -7
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -9,15 +9,12 @@ module DynamicConfiguration
|
|
9
9
|
|
10
10
|
class ConfigFactory
|
11
11
|
def create_config(const_name, config_file_name)
|
12
|
-
|
13
|
-
|
14
|
-
config = setup_config(const_name, config_file_name)
|
12
|
+
setup_config(const_name, config_file_name)
|
15
13
|
load_main_configuration_files
|
16
14
|
load_per_environment_configuration_files if @rails_loaded
|
17
15
|
load_local_configuration_files
|
18
|
-
|
19
|
-
|
20
|
-
return @config
|
16
|
+
finalize_config
|
17
|
+
@config
|
21
18
|
end
|
22
19
|
|
23
20
|
private
|
@@ -34,7 +31,7 @@ module DynamicConfiguration
|
|
34
31
|
@config_path.entries.each do |mod_file|
|
35
32
|
next if ["..", "."].include?(mod_file.basename.to_s)
|
36
33
|
mod_file = @config_path + mod_file
|
37
|
-
next unless mod_file.file?
|
34
|
+
next unless mod_file.file? && mod_file.basename.to_s != "#{@const_name.to_s.downcase}.rb"
|
38
35
|
@config.load_module(mod_file)
|
39
36
|
end
|
40
37
|
end
|
@@ -66,6 +63,15 @@ module DynamicConfiguration
|
|
66
63
|
@config.load_module(mod_file)
|
67
64
|
end
|
68
65
|
end
|
66
|
+
|
67
|
+
def finalize_config
|
68
|
+
@config.freeze
|
69
|
+
|
70
|
+
if Object.instance_eval { const_defined?(:Rails) }
|
71
|
+
::ActiveSupport::Dependencies.autoload_paths << @config_path.to_s
|
72
|
+
::ActiveSupport::Dependencies.explicitly_unloadable_constants << @const_name.to_s
|
73
|
+
end
|
74
|
+
end
|
69
75
|
end
|
70
76
|
|
71
77
|
class Config < ::BlankSlate
|