app_conf 0.4.0 → 0.4.1
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/Guardfile +5 -0
- data/README.markdown +4 -4
- data/Rakefile +0 -1
- data/app_conf.gemspec +1 -1
- data/spec/app_conf_spec.rb +10 -7
- data/spec/minitest_fakefs_patch.rb +11 -0
- metadata +15 -6
data/Guardfile
ADDED
data/README.markdown
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
AppConf
|
2
2
|
----------------------------------
|
3
|
-
YAML Backed Application Wide Configuration with a few extras (
|
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
|
-
*
|
10
|
-
*
|
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 =
|
35
|
+
$conf = AppConf.new
|
36
36
|
|
37
37
|
$conf.load('config.yml', 'other.yml')
|
38
38
|
$conf.fullname -> 'Joe Blogs'
|
data/Rakefile
CHANGED
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.4.
|
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)'
|
data/spec/app_conf_spec.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
-
|
1
|
+
gem 'minitest'
|
2
|
+
|
2
3
|
require 'fakefs/safe'
|
3
4
|
require 'minitest/autorun'
|
4
|
-
|
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
|
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
|
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 "
|
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 "
|
81
|
+
File.read('config.yml').must_equal "---\nuser:\n name:\n first: Joe\n"
|
79
82
|
end
|
80
83
|
end
|
81
84
|
|
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.
|
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:
|
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:
|
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:
|
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:
|
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.
|
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:
|