configatron 2.4.1 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/lib/configatron.rb +1 -0
- data/lib/configatron/rails.rb +13 -4
- metadata +5 -5
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,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configatron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- root
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-09 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 0.1.0
|
24
24
|
version:
|
25
|
-
description: "configatron was developed by:
|
25
|
+
description: "configatron was developed by: root"
|
26
26
|
email: mark@markbates.com
|
27
27
|
executables: []
|
28
28
|
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
requirements: []
|
75
75
|
|
76
76
|
rubyforge_project: magrathea
|
77
|
-
rubygems_version: 1.3.
|
77
|
+
rubygems_version: 1.3.5
|
78
78
|
signing_key:
|
79
79
|
specification_version: 3
|
80
80
|
summary: A powerful Ruby configuration system.
|