figleaf 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/CHANGELOG.md +7 -0
- data/README.md +1 -1
- data/figleaf.gemspec +1 -1
- data/lib/figleaf/settings.rb +4 -0
- data/lib/figleaf/version.rb +1 -1
- data/spec/figleaf/configuration_spec.rb +8 -8
- data/spec/figleaf/settings_spec.rb +9 -0
- data/spec/fixtures/errors/bad_file.yml +5 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 951df2c46006c5d93efc112929498b6eee98b782
|
4
|
+
data.tar.gz: 3c0717008c7398cfa244f02fc164054a32c3c7ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ebb682d19e0e914cff04a313200fb5c9d6471d97a13b77b3d790ddca890d781c3e63d2018709c468ddd57af02df31be0d380ec38d66e124e41f8c15347825dc
|
7
|
+
data.tar.gz: f3f075b639288a879ec5a787f126f60f8814c641b7550a0c77f1ad3af7a192ff9c5f19ed07ffb762636ee938aaaa273d84eb9e1ff11a79d8a78a1e124604680f
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Figleaf
|
2
|
-
[![Build Status](https://secure.travis-ci.org/
|
2
|
+
[![Build Status](https://secure.travis-ci.org/jcmuller/figleaf.png?branch=master)](http://travis-ci.org/jcmuller/figleaf)
|
3
3
|
|
4
4
|
YAML based DRY settings manager.
|
5
5
|
|
data/figleaf.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["jcmuller@gmail.com"]
|
7
7
|
gem.description = %q{YAML based DRY settings manager.}
|
8
8
|
gem.summary = %q{YAML based DRY settings manager.}
|
9
|
-
gem.homepage = "http://github.com/
|
9
|
+
gem.homepage = "http://github.com/jcmuller/figleaf"
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/lib/figleaf/settings.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Figleaf
|
2
2
|
class Settings
|
3
|
+
InvalidYAML = Class.new(RuntimeError)
|
4
|
+
|
3
5
|
class_attribute :auto_define
|
4
6
|
self.auto_define = false
|
5
7
|
|
@@ -60,6 +62,8 @@ module Figleaf
|
|
60
62
|
property = YAML.load(ERB.new(IO.read(file_path)).result)
|
61
63
|
property = property[env] if env
|
62
64
|
use_hashie_if_hash(property)
|
65
|
+
rescue Psych::SyntaxError
|
66
|
+
raise InvalidYAML, "#{file_path} has invalid YAML"
|
63
67
|
end
|
64
68
|
|
65
69
|
def root
|
data/lib/figleaf/version.rb
CHANGED
@@ -46,7 +46,7 @@ describe Figleaf::Settings do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
described_class.another_fictional_feature_mode.should eq(:admin)
|
49
|
-
described_class.enable_fictional_activity_feed.should
|
49
|
+
described_class.enable_fictional_activity_feed.should be true
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -56,8 +56,8 @@ describe Figleaf::Settings do
|
|
56
56
|
s.some_boolean = true
|
57
57
|
end
|
58
58
|
|
59
|
-
described_class.some_boolean.should
|
60
|
-
described_class.some_boolean?.should
|
59
|
+
described_class.some_boolean.should be true
|
60
|
+
described_class.some_boolean?.should be true
|
61
61
|
end
|
62
62
|
|
63
63
|
it "should define predicate methods for false value" do
|
@@ -65,8 +65,8 @@ describe Figleaf::Settings do
|
|
65
65
|
s.another_boolean = false
|
66
66
|
end
|
67
67
|
|
68
|
-
described_class.another_boolean.should
|
69
|
-
described_class.another_boolean?.should
|
68
|
+
described_class.another_boolean.should be false
|
69
|
+
described_class.another_boolean?.should be false
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should evaluate presence predicate methods for string value" do
|
@@ -74,7 +74,7 @@ describe Figleaf::Settings do
|
|
74
74
|
s.not_a_boolean = "Hello, world!"
|
75
75
|
end
|
76
76
|
|
77
|
-
described_class.not_a_boolean?.should
|
77
|
+
described_class.not_a_boolean?.should be true
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should return false for empty string" do
|
@@ -82,7 +82,7 @@ describe Figleaf::Settings do
|
|
82
82
|
s.empty_string = ""
|
83
83
|
end
|
84
84
|
|
85
|
-
described_class.empty_string?.should
|
85
|
+
described_class.empty_string?.should be false
|
86
86
|
end
|
87
87
|
|
88
88
|
it "return true for lists" do
|
@@ -90,7 +90,7 @@ describe Figleaf::Settings do
|
|
90
90
|
s.not_a_boolean = %w(1 2 3)
|
91
91
|
end
|
92
92
|
|
93
|
-
described_class.not_a_boolean?.should
|
93
|
+
described_class.not_a_boolean?.should be true
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
@@ -79,6 +79,15 @@ describe Figleaf::Settings do
|
|
79
79
|
expect { described_class.service.blah }.to raise_error NoMethodError
|
80
80
|
end
|
81
81
|
|
82
|
+
context "with bad files" do
|
83
|
+
let(:overload) { File.expand_path("../../fixtures/errors/*.yml", __FILE__) }
|
84
|
+
|
85
|
+
it "reports the file that has errors" do
|
86
|
+
expect { described_class.load_settings(overload, "test") }.
|
87
|
+
to raise_error(described_class::InvalidYAML)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
82
91
|
context "overloading settings" do
|
83
92
|
before do
|
84
93
|
overload = File.expand_path("../../fixtures/extra/*.yml", __FILE__)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: figleaf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan C. Müller
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- ".gitignore"
|
49
49
|
- ".rspec"
|
50
50
|
- ".travis.yml"
|
51
|
+
- CHANGELOG.md
|
51
52
|
- Gemfile
|
52
53
|
- Guardfile
|
53
54
|
- HISTORY.md
|
@@ -65,13 +66,14 @@ files:
|
|
65
66
|
- spec/fixtures/array.yml
|
66
67
|
- spec/fixtures/boolean.yml
|
67
68
|
- spec/fixtures/erb.yml
|
69
|
+
- spec/fixtures/errors/bad_file.yml
|
68
70
|
- spec/fixtures/extra/array.yml
|
69
71
|
- spec/fixtures/extra/boolean.yml
|
70
72
|
- spec/fixtures/extra/service.yml
|
71
73
|
- spec/fixtures/service.yml
|
72
74
|
- spec/fixtures/string.yml
|
73
75
|
- spec/spec_helper.rb
|
74
|
-
homepage: http://github.com/
|
76
|
+
homepage: http://github.com/jcmuller/figleaf
|
75
77
|
licenses: []
|
76
78
|
metadata: {}
|
77
79
|
post_install_message:
|
@@ -101,6 +103,7 @@ test_files:
|
|
101
103
|
- spec/fixtures/array.yml
|
102
104
|
- spec/fixtures/boolean.yml
|
103
105
|
- spec/fixtures/erb.yml
|
106
|
+
- spec/fixtures/errors/bad_file.yml
|
104
107
|
- spec/fixtures/extra/array.yml
|
105
108
|
- spec/fixtures/extra/boolean.yml
|
106
109
|
- spec/fixtures/extra/service.yml
|