merb_app_config 1.1 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'merb-core'
5
5
  require 'merb-core/tasks/merb'
6
6
 
7
7
  GEM_NAME = "merb_app_config"
8
- GEM_VERSION = "1.1"
8
+ GEM_VERSION = "1.2"
9
9
  AUTHOR = "Jacques Crocker"
10
10
  EMAIL = "merbjedi@gmail.com"
11
11
  HOMEPAGE = "http://www.merbjedi.com/"
@@ -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
- DeepMerge.deep_merge!(file_conf, conf) if file_conf
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 !source || (source.respond_to?(:blank?) && source.blank?); return dest; end
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 !(dest) && overwrite_unmergeable; dest = source; return dest; end
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.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: 2009-09-27 00:00:00 -07:00
12
+ date: 2010-01-11 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency