markbates-configatron 2.4.1.20090826153428 → 2.4.2.20090909140253
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/README +1 -1
- data/lib/configatron.rb +1 -0
- data/lib/configatron/rails.rb +13 -4
- metadata +2 -2
data/README
CHANGED
@@ -53,7 +53,7 @@ You can configure configatron from a hash as well:
|
|
53
53
|
|
54
54
|
Notice how they're all namespaced for your as well. The same holds true for YAML files:
|
55
55
|
|
56
|
-
|
56
|
+
configatron.configure_from_yaml('/path/to/file.yml')
|
57
57
|
|
58
58
|
===Namespaces
|
59
59
|
|
data/lib/configatron.rb
CHANGED
data/lib/configatron/rails.rb
CHANGED
@@ -16,14 +16,23 @@ class Configatron
|
|
16
16
|
# <RAILS_ROOT>/config/configatron/<RAILS_ENV>/defaults.rb
|
17
17
|
# <RAILS_ROOT>/config/configatron/<RAILS_ENV>/bar.rb
|
18
18
|
# <RAILS_ROOT>/config/configatron/<RAILS_ENV>/foo.rb
|
19
|
-
def self.init(root =
|
19
|
+
def self.init(root = nil, env = nil)
|
20
|
+
base_dir = root
|
21
|
+
if root.nil?
|
22
|
+
root = defined?(RAILS_ROOT) ? RAILS_ROOT : FileUtils.pwd
|
23
|
+
base_dir = File.expand_path(File.join(root, 'config', 'configatron'))
|
24
|
+
end
|
25
|
+
|
26
|
+
if env.nil?
|
27
|
+
env = defined?(RAILS_ENV) ? RAILS_ENV : 'development'
|
28
|
+
end
|
29
|
+
|
20
30
|
config_files = []
|
21
31
|
|
22
|
-
base_dir = File.expand_path(File.join(root, 'config', 'configatron'))
|
23
32
|
config_files << File.join(base_dir, 'defaults.rb')
|
24
|
-
config_files << File.join(base_dir, "#{
|
33
|
+
config_files << File.join(base_dir, "#{env}.rb")
|
25
34
|
|
26
|
-
env_dir = File.join(base_dir,
|
35
|
+
env_dir = File.join(base_dir, env)
|
27
36
|
config_files << File.join(env_dir, 'defaults.rb')
|
28
37
|
|
29
38
|
Dir.glob(File.join(env_dir, '*.rb')).sort.each do |f|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markbates-configatron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.2.20090909140253
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- markbates
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-09 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|