app_conf 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ guard 'minitest' do
2
+ watch(%r|^spec/(.*)_spec\.rb|)
3
+ watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
4
+ end
5
+
@@ -1,13 +1,13 @@
1
1
  AppConf
2
2
  ----------------------------------
3
- YAML Backed Application Wide Configuration with a few extras ($config)
3
+ YAML Backed Application Wide Configuration with a few extras (AppConfig)
4
4
 
5
5
  * Supports nested key/values
6
6
  * Loading and Saving of YAML files
7
7
  * Add further key/value pairs in code
8
8
  * Use dot or bracket notation
9
- * `$conf.to_hash` outputs a hash map of $conf key/values
10
- * `$conf.from_hash` creates nested key/values from a hash
9
+ * `AppConf#to_hash` outputs a hash map of AppConf key/values
10
+ * `AppConf#from_hash` creates nested key/values from a hash
11
11
 
12
12
  Installation
13
13
  ----------------------------------
@@ -32,7 +32,7 @@ other.yml
32
32
 
33
33
  Code:
34
34
 
35
- $conf = $conf.new
35
+ $conf = AppConf.new
36
36
 
37
37
  $conf.load('config.yml', 'other.yml')
38
38
  $conf.fullname -> 'Joe Blogs'
data/Rakefile CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'rake/testtask'
2
- require './lib/app_conf'
3
2
 
4
3
  desc 'Test, build and install the gem'
5
4
  task :default => [:spec, :install]
@@ -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.4.0'
5
+ s.version = '0.4.1'
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)'
@@ -1,11 +1,14 @@
1
- $LOAD_PATH << 'lib'
1
+ gem 'minitest'
2
+
2
3
  require 'fakefs/safe'
3
4
  require 'minitest/autorun'
4
- require 'app_conf'
5
+ require_relative 'minitest_fakefs_patch'
6
+ require_relative '../lib/app_conf'
5
7
 
6
8
  describe AppConf do
7
9
  before do
8
10
  FakeFS.activate!
11
+ FakeFS::FileSystem.clear
9
12
 
10
13
  config =
11
14
  "fullname: Joe Bloggs
@@ -19,7 +22,7 @@ user:
19
22
  street: 1 Some Road
20
23
  "
21
24
  File.open('config.yml', 'w') {|f| f.write(config) }
22
- File.open('other.yml', 'w') {|f| f.write(other)}
25
+ File.open('other.yml', 'w') {|f| f.write(other) }
23
26
  $conf = AppConf.new
24
27
  $conf.load("config.yml")
25
28
  end
@@ -61,21 +64,21 @@ user:
61
64
  end
62
65
 
63
66
  it 'skips past comments' do
64
- File.open('config.yml', 'w') {|f| f.write("# comment 1\n# comment 2\n\n--- \nRest of the config")}
67
+ File.open('config.yml', 'w') {|f| f.write("# comment 1\n# comment 2\n\n---\nRest of the config")}
65
68
  $conf.save :user, 'config.yml'
66
- File.read('config.yml').must_equal "# comment 1\n# comment 2\n\n--- \nuser: \n name: \n first: Joe\n"
69
+ File.read('config.yml').must_equal "# comment 1\n# comment 2\n\n---\nuser:\n name:\n first: Joe\n"
67
70
  end
68
71
 
69
72
  it 'overwrites when no --- and single line' do
70
73
  File.open('config.yml', 'w') {|f| f.write("some config\n") }
71
74
  $conf.save :user, 'config.yml'
72
- File.read('config.yml').must_equal "--- \nuser: \n name: \n first: Joe\n"
75
+ File.read('config.yml').must_equal "---\nuser:\n name:\n first: Joe\n"
73
76
  end
74
77
 
75
78
  it 'overwrites when no --- and multiline' do
76
79
  File.open('config.yml', 'w') {|f| f.write("# Some\n# comments\n\nconfig:\n name:\n") }
77
80
  $conf.save :user, 'config.yml'
78
- File.read('config.yml').must_equal "--- \nuser: \n name: \n first: Joe\n"
81
+ File.read('config.yml').must_equal "---\nuser:\n name:\n first: Joe\n"
79
82
  end
80
83
  end
81
84
 
@@ -0,0 +1,11 @@
1
+ module MiniTest
2
+ module Assertions
3
+ alias :actual_diff :diff
4
+
5
+ def diff exp, act
6
+ FakeFS.without do
7
+ actual_diff exp, act
8
+ end
9
+ end
10
+ end
11
+ end
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.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-30 00:00:00.000000000Z
12
+ date: 2013-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fakefs
16
- requirement: &18793300 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,20 +21,28 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *18793300
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  description:
26
- email: phil@electricvisions.com
31
+ email: !binary |-
32
+ cGhpbEBlbGVjdHJpY3Zpc2lvbnMuY29t
27
33
  executables: []
28
34
  extensions: []
29
35
  extra_rdoc_files: []
30
36
  files:
31
37
  - .gitignore
38
+ - Guardfile
32
39
  - LICENSE
33
40
  - README.markdown
34
41
  - Rakefile
35
42
  - app_conf.gemspec
36
43
  - lib/app_conf.rb
37
44
  - spec/app_conf_spec.rb
45
+ - spec/minitest_fakefs_patch.rb
38
46
  homepage: https://github.com/PhilT/app_conf
39
47
  licenses: []
40
48
  post_install_message:
@@ -55,10 +63,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
63
  version: 1.3.6
56
64
  requirements: []
57
65
  rubyforge_project:
58
- rubygems_version: 1.8.10
66
+ rubygems_version: 1.8.23
59
67
  signing_key:
60
68
  specification_version: 3
61
69
  summary: Simplest YAML Backed Application Wide Configuration (AppConfig)
62
70
  test_files:
63
71
  - spec/app_conf_spec.rb
72
+ - spec/minitest_fakefs_patch.rb
64
73
  has_rdoc: