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 CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dynamic_configuration}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Jarosław Rzeszótko}]
@@ -9,15 +9,12 @@ module DynamicConfiguration
9
9
 
10
10
  class ConfigFactory
11
11
  def create_config(const_name, config_file_name)
12
- @rails_loaded = Object.const_defined?(:Rails)
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
- config.freeze
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic_configuration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: