configy 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.1.1 (2012-03-18)
2
+
3
+ * Allow Configy to define configs within other modules
4
+
1
5
  ## 1.1.0 (2012-03-18)
2
6
 
3
7
  * Allow nested configs to be accessible as methods, via Hashie::Mash
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "configy"
3
- s.version = "1.1.0"
3
+ s.version = "1.1.1"
4
4
 
5
5
  s.authors = [ "Gabe Varela", "Ben Marini", "Chip Miller" ]
6
6
  s.date = "2012-03-18"
@@ -52,7 +52,7 @@ module Configy
52
52
  end
53
53
 
54
54
  # The main interface for creating Configy instances
55
- def self.create(file)
56
- Object.const_set( camelize(file.to_s), Configy::Base.new(file, section, load_path, cache_config) )
55
+ def self.create(file, parent=Object)
56
+ parent.const_set( camelize(file.to_s), Configy::Base.new(file, section, load_path, cache_config) )
57
57
  end
58
58
  end
@@ -21,6 +21,15 @@ class ConfigyTest < MiniTest::Unit::TestCase
21
21
  end
22
22
  end
23
23
 
24
+ def test_should_create_a_configuration_class_based_on_a_yaml_file_within_a_parent_module
25
+ with_config_file( {'common' => {'a' => '1', 'b' => '2' }}, 'app_config' ) do |file, hash|
26
+ Object.const_set('MyApp', Module)
27
+ Configy.create('app_config', MyApp)
28
+ assert MyApp.const_defined?(:AppConfig)
29
+ assert_equal MyApp::AppConfig.b, '2'
30
+ end
31
+ end
32
+
24
33
  def test_cache_config_always_defaults_to_false
25
34
  Configy.section = 'production'
26
35
  assert_equal false, Configy.cache_config
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,7 +15,7 @@ date: 2012-03-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: hashie
18
- requirement: &70237177506340 !ruby/object:Gem::Requirement
18
+ requirement: &70109332176180 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: 1.2.0
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70237177506340
26
+ version_requirements: *70109332176180
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
- requirement: &70237177505880 !ruby/object:Gem::Requirement
29
+ requirement: &70109332175720 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: 1.0.0
35
35
  type: :development
36
36
  prerelease: false
37
- version_requirements: *70237177505880
37
+ version_requirements: *70109332175720
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: minitest
40
- requirement: &70237177505500 !ruby/object:Gem::Requirement
40
+ requirement: &70109332175340 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,7 +45,7 @@ dependencies:
45
45
  version: '0'
46
46
  type: :development
47
47
  prerelease: false
48
- version_requirements: *70237177505500
48
+ version_requirements: *70109332175340
49
49
  description:
50
50
  email: bmarini@gmail.com
51
51
  executables: []