markbates-configatron 2.3.2.20090731134515 → 2.4.0.20090826115559

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.
@@ -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
@@ -0,0 +1,4 @@
1
+ # Override your default settings for the Cucumber environment here.
2
+
3
+ # By default load in the settings from the test environment:
4
+ require File.join(File.dirname(__FILE__), 'test')
@@ -0,0 +1,7 @@
1
+ # Put all your default configatron settings here.
2
+
3
+ # Example:
4
+ # configatron.emails.welcome.subject = 'Welcome!'
5
+ # configatron.emails.sales_reciept.subject = 'Thanks for your order'
6
+ #
7
+ # configatron.file.storage = :s3
@@ -0,0 +1,4 @@
1
+ # Override your default settings for the Development environment here.
2
+ #
3
+ # Example:
4
+ # configatron.file.storage = :local
@@ -0,0 +1,4 @@
1
+ # Override your default settings for the Production environment here.
2
+ #
3
+ # Example:
4
+ # configatron.file.storage = :s3
@@ -0,0 +1,4 @@
1
+ # Override your default settings for the Test environment here.
2
+ #
3
+ # Example:
4
+ # configatron.file.storage = :local
@@ -0,0 +1,2 @@
1
+ require 'configatron'
2
+ Configatron::Rails.init
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
- undef :inspect # :nodoc:
52
- undef :nil? # :nodoc:
53
- undef :test # :nodoc:
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
@@ -277,7 +277,11 @@ class Configatron
277
277
  end
278
278
  end
279
279
 
280
- undef :test # :nodoc:
280
+ begin
281
+ undef :test # :nodoc:
282
+ rescue Exception => e
283
+ end
284
+
281
285
 
282
286
  end # Store
283
287
  end # Configatron
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.3.2.20090731134515
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-07-31 00:00:00 -07:00
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.3.5
75
+ rubygems_version: 1.2.0
69
76
  signing_key:
70
77
  specification_version: 3
71
78
  summary: A powerful Ruby configuration system.