app_conf 0.2.5 → 0.2.6

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/app_conf.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'base64'
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'app_conf'
5
- s.version = '0.2.5'
5
+ s.version = '0.2.6'
6
6
  s.authors = 'Phil Thompson'
7
7
  s.email = Base64.decode64("cGhpbEBlbGVjdHJpY3Zpc2lvbnMuY29t\n")
8
8
  s.summary = 'Simplest YAML Backed Application Wide Configuration (AppConfig)'
data/lib/app_conf.rb CHANGED
@@ -8,7 +8,8 @@ class AppConf
8
8
 
9
9
  def self.load(*filenames)
10
10
  filenames.each do |filename|
11
- from_hash(YAML.load(File.open(filename)))
11
+ content = YAML.load_file(filename)
12
+ from_hash(content) if content
12
13
  end
13
14
  end
14
15
 
@@ -115,6 +115,11 @@ user:
115
115
  AppConf.user.name.first.must_equal 'Joe'
116
116
  end
117
117
 
118
+ it 'handles empty files' do
119
+ File.open('empty.yml', 'w') {}
120
+ AppConf.load('empty.yml')
121
+ end
122
+
118
123
  it 'allows additional keys to be set' do
119
124
  AppConf.user.name.last = 'Bloggs'
120
125
  AppConf.user.name.last.must_equal 'Bloggs'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_conf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fakefs
16
- requirement: &20417420 !ruby/object:Gem::Requirement
16
+ requirement: &22432300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *20417420
24
+ version_requirements: *22432300
25
25
  description:
26
26
  email: phil@electricvisions.com
27
27
  executables: []