markbates-configatron 2.3.2.20090731134515 → 2.4.0.20090826115559
Sign up to get free protection for your applications and to get access to all the features.
- data/generators/configatron_generator.rb +20 -0
- data/generators/templates/configatron/cucumber.rb +4 -0
- data/generators/templates/configatron/defaults.rb +7 -0
- data/generators/templates/configatron/development.rb +4 -0
- data/generators/templates/configatron/production.rb +4 -0
- data/generators/templates/configatron/test.rb +4 -0
- data/generators/templates/initializers/configatron.rb +2 -0
- data/lib/configatron.rb +2 -1
- data/lib/configatron/configatron.rb +7 -3
- data/lib/configatron/rails.rb +44 -0
- data/lib/configatron/store.rb +5 -1
- metadata +11 -4
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rails_generator'
|
2
|
+
class ConfigatronGenerator < Rails::Generator::Base # :nodoc:
|
3
|
+
|
4
|
+
def manifest
|
5
|
+
record do |m|
|
6
|
+
m.directory 'config/configatron'
|
7
|
+
m.directory 'config/configatron/development'
|
8
|
+
m.directory 'config/configatron/test'
|
9
|
+
m.directory 'config/configatron/production'
|
10
|
+
m.directory 'config/configatron/cucumber'
|
11
|
+
m.file 'initializers/configatron.rb', 'config/initializers/configatron.rb'
|
12
|
+
m.file 'configatron/development.rb', 'config/configatron/development.rb'
|
13
|
+
m.file 'configatron/production.rb', 'config/configatron/production.rb'
|
14
|
+
m.file 'configatron/test.rb', 'config/configatron/test.rb'
|
15
|
+
m.file 'configatron/cucumber.rb', 'config/configatron/cucumber.rb'
|
16
|
+
m.file 'configatron/defaults.rb', 'config/configatron/defaults.rb'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end # ConfigatronGenerator
|
data/lib/configatron.rb
CHANGED
@@ -6,4 +6,5 @@ require File.join(base, 'errors')
|
|
6
6
|
require File.join(base, 'core_ext', 'kernel')
|
7
7
|
require File.join(base, 'core_ext', 'object')
|
8
8
|
require File.join(base, 'core_ext', 'string')
|
9
|
-
require File.join(base, 'core_ext', 'class')
|
9
|
+
require File.join(base, 'core_ext', 'class')
|
10
|
+
require File.join(base, 'rails')
|
@@ -48,8 +48,12 @@ class Configatron
|
|
48
48
|
@_store.delete(@_namespace.pop)
|
49
49
|
end
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
begin
|
52
|
+
undef :inspect # :nodoc:
|
53
|
+
undef :nil? # :nodoc:
|
54
|
+
undef :test # :nodoc:
|
55
|
+
rescue Exception => e
|
56
|
+
end
|
57
|
+
|
54
58
|
|
55
59
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class Configatron
|
2
|
+
# Helpful for making using configatron with Rails even easier!
|
3
|
+
#
|
4
|
+
# To get started you can use the generator to generate
|
5
|
+
# the necessary stub files.
|
6
|
+
#
|
7
|
+
# $ ruby script/generate configatron
|
8
|
+
module Rails
|
9
|
+
|
10
|
+
# Loads configatron files in the following order:
|
11
|
+
#
|
12
|
+
# Example:
|
13
|
+
# <RAILS_ROOT>/config/configatron/defaults.rb
|
14
|
+
# <RAILS_ROOT>/config/configatron/<RAILS_ENV>.rb
|
15
|
+
# # optional:
|
16
|
+
# <RAILS_ROOT>/config/configatron/<RAILS_ENV>/defaults.rb
|
17
|
+
# <RAILS_ROOT>/config/configatron/<RAILS_ENV>/bar.rb
|
18
|
+
# <RAILS_ROOT>/config/configatron/<RAILS_ENV>/foo.rb
|
19
|
+
def self.init
|
20
|
+
config_files = []
|
21
|
+
|
22
|
+
base_dir = File.expand_path(File.join(RAILS_ROOT, 'config', 'configatron'))
|
23
|
+
config_files << File.join(base_dir, 'defaults.rb')
|
24
|
+
config_files << File.join(base_dir, "#{RAILS_ENV}.rb")
|
25
|
+
|
26
|
+
env_dir = File.join(base_dir, RAILS_ENV)
|
27
|
+
config_files << File.join(env_dir, 'defaults.rb')
|
28
|
+
|
29
|
+
Dir.glob(File.join(env_dir, '*.rb')).sort.each do |f|
|
30
|
+
config_files << f
|
31
|
+
end
|
32
|
+
|
33
|
+
config_files.collect! {|config| File.expand_path(config)}.uniq!
|
34
|
+
|
35
|
+
config_files.each do |config|
|
36
|
+
if File.exists?(config)
|
37
|
+
# puts "Configuration: #{config}"
|
38
|
+
require config
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end # Rails
|
44
|
+
end # Configatron
|
data/lib/configatron/store.rb
CHANGED
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
|
+
version: 2.4.0.20090826115559
|
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-08-26 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -38,13 +38,20 @@ files:
|
|
38
38
|
- lib/configatron/core_ext/object.rb
|
39
39
|
- lib/configatron/core_ext/string.rb
|
40
40
|
- lib/configatron/errors.rb
|
41
|
+
- lib/configatron/rails.rb
|
41
42
|
- lib/configatron/store.rb
|
42
43
|
- lib/configatron.rb
|
43
44
|
- README
|
44
45
|
- LICENSE
|
46
|
+
- generators/configatron_generator.rb
|
47
|
+
- generators/templates/configatron/cucumber.rb
|
48
|
+
- generators/templates/configatron/defaults.rb
|
49
|
+
- generators/templates/configatron/development.rb
|
50
|
+
- generators/templates/configatron/production.rb
|
51
|
+
- generators/templates/configatron/test.rb
|
52
|
+
- generators/templates/initializers/configatron.rb
|
45
53
|
has_rdoc: false
|
46
54
|
homepage: http://www.metabates.com
|
47
|
-
licenses:
|
48
55
|
post_install_message:
|
49
56
|
rdoc_options: []
|
50
57
|
|
@@ -65,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
72
|
requirements: []
|
66
73
|
|
67
74
|
rubyforge_project: magrathea
|
68
|
-
rubygems_version: 1.
|
75
|
+
rubygems_version: 1.2.0
|
69
76
|
signing_key:
|
70
77
|
specification_version: 3
|
71
78
|
summary: A powerful Ruby configuration system.
|