merb_app_config 1.1 → 1.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.
- data/Rakefile +1 -1
- data/lib/application_config/config_builder.rb +7 -1
- data/lib/application_config/deep_merge.rb +3 -3
- metadata +2 -2
data/Rakefile
CHANGED
@@ -25,7 +25,13 @@ module ApplicationConfig
|
|
25
25
|
conf = {}
|
26
26
|
ConfigBuilder.load_paths.to_a.each do |path|
|
27
27
|
file_conf = YAML.load(ERB.new(IO.read(path)).result) if path and File.exists?(path)
|
28
|
-
|
28
|
+
next unless file_conf
|
29
|
+
|
30
|
+
if conf.size > 0
|
31
|
+
DeepMerge.deep_merge!(file_conf, conf, :preserve_unmergeables => false)
|
32
|
+
else
|
33
|
+
conf = file_conf
|
34
|
+
end
|
29
35
|
end
|
30
36
|
|
31
37
|
# expand the javascripts config to handle *.* paths
|
@@ -70,9 +70,9 @@ module DeepMerge
|
|
70
70
|
sort_merged_arrays = options[:sort_merged_arrays] || false
|
71
71
|
di = options[:debug_indent] || ''
|
72
72
|
# do nothing if source is nil
|
73
|
-
if
|
73
|
+
if source.nil? || (!source.is_a?(FalseClass) && source.respond_to?(:blank?) && source.blank?); return dest; end
|
74
74
|
# if dest doesn't exist, then simply copy source to it
|
75
|
-
if
|
75
|
+
if dest.nil? && overwrite_unmergeable; dest = source; return dest; end
|
76
76
|
|
77
77
|
puts "#{di}Source class: #{source.class.inspect} :: Dest class: #{dest.class.inspect}" if merge_debug
|
78
78
|
if source.kind_of?(Hash)
|
@@ -80,7 +80,7 @@ module DeepMerge
|
|
80
80
|
source.each do |src_key, src_value|
|
81
81
|
if dest.kind_of?(Hash)
|
82
82
|
puts "#{di} looping: #{src_key.inspect} => #{src_value.inspect} :: #{dest.inspect}" if merge_debug
|
83
|
-
if dest[src_key]
|
83
|
+
if !dest[src_key].nil?
|
84
84
|
puts "#{di} ==>merging: #{src_key.inspect} => #{src_value.inspect} :: #{dest[src_key].inspect}" if merge_debug
|
85
85
|
dest[src_key] = deep_merge!(src_value, dest[src_key], options.merge(:debug_indent => di + ' '))
|
86
86
|
else # dest[src_key] doesn't exist so we want to create and overwrite it (but we do this via deep_merge!)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merb_app_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "1.
|
4
|
+
version: "1.2"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacques Crocker
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-11 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|