public
Description: Provides a way to manage environment specific configuration settings.
Homepage:
Clone URL: git://github.com/UnderpantsGnome/config_reader-gem.git
fix the environment merge for real this time
Mon Dec 08 16:01:03 -0800 2008
commit  0902cb879672145e819a3fd320e2105359d61a5a
tree    50bee60cde8bf689143b6046c2b5f35e7ba13172
parent  cc2975e41a08821b1ff4e3ec44c9d80f4ce7f8f4
...
 
 
 
 
 
 
 
 
 
 
1
2
3
...
1
2
3
4
5
6
7
8
9
10
11
12
13
0
@@ -1,3 +1,13 @@
0
+== 0.0.4 2008-12-08
0
+* fix the environment merging issue, for real this time
0
+
0
+== 0.0.3 2008-12-02
0
+* fix the environment merging issue
0
+
0
+== 0.0.2 2008-09-10
0
+* have find_config return the file if it exists instead of looking in . and 
0
+./config
0
+
0
 == 0.0.1 2008-08-06
0
 
0
 * 1 major enhancement:
...
25
26
27
28
 
29
30
31
...
40
41
42
43
 
44
45
46
47
48
49
50
 
51
 
 
52
53
54
55
56
57
 
58
59
60
61
62
 
63
64
65
...
25
26
27
 
28
29
30
31
...
40
41
42
 
43
44
45
46
47
48
49
 
50
51
52
53
54
55
56
57
58
 
59
60
61
62
63
 
64
65
66
67
0
@@ -25,7 +25,7 @@ class ConfigReader
0
     def reload
0
       raise 'No config file set' unless @config_file
0
 
0
-      if defined?(ERB) 
0
+      if defined?(ERB)
0
         conf = YAML.load(ERB.new(File.open(find_config).read).result)
0
       else
0
         conf = YAML.load(File.open(find_config).read)
0
@@ -40,26 +40,28 @@ class ConfigReader
0
       end
0
 
0
       _conf = conf['defaults']
0
-      _conf.merge(conf[env]) if conf[env]
0
+      _conf.merge!(conf[env]) if conf[env]
0
       _conf
0
     end
0
 
0
     def [](key)
0
       config[key]
0
     end
0
-  
0
+
0
     def find_config
0
+      return @config_file if File.exist?(@config_file)
0
+
0
       %w( . config ).each do |dir|
0
         config_file = File.join(dir, @config_file)
0
         return config_file if File.exist?(config_file)
0
       end
0
       ''
0
-    end  
0
+    end
0
 
0
     def method_missing(key)
0
       config[key.to_s] || super
0
     end
0
-  
0
+
0
     def inspect
0
       puts config.inspect
0
     end
...
2
3
4
5
 
6
7
8
...
2
3
4
 
5
6
7
8
0
@@ -2,7 +2,7 @@ module ConfigReader
0
   module VERSION #:nodoc:
0
     MAJOR = 0
0
     MINOR = 0
0
-    TINY  = 1
0
+    TINY  = 4
0
 
0
     STRING = [MAJOR, MINOR, TINY].join('.')
0
   end

Comments