configy 1.1.3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +9 -3
- data/Gemfile.lock +9 -3
- data/HISTORY.md +4 -0
- data/configy.gemspec +7 -5
- data/gemfiles/hashie1_2.gemfile +4 -0
- data/gemfiles/hashie2_1.gemfile +4 -0
- data/lib/configy.rb +13 -2
- data/lib/configy/string_inquirer.rb +12 -0
- data/spec/section_spec.rb +15 -0
- data/spec/string_inquirer_spec.rb +30 -0
- metadata +64 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: cad3e5071362f7bf41222f295875b0f0296e1338
|
4
|
+
data.tar.gz: 27ac81e1611bfb899d557b8a112905e561278584
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f5e36fcac0aa481581b95c3fd14c400cd3b229f48e13b069c6224c3ded1405cbc37bb25818d3624c459f398abea431c622d647d36b00d2b1bc2e9e48c3565b0e
|
7
|
+
data.tar.gz: 556b19dc22b238d5dbcf6d11f636c85a738b73bf35dc51547e0e0d1491ae1b5799b5da18c3c4113ebfa1f0e88438b584caefcd8d39f73ebc0a3189e43774c495
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,13 +2,17 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
configy (1.1.3)
|
5
|
-
hashie (
|
5
|
+
hashie (>= 1.2, < 3.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
hashie (1.2
|
10
|
+
hashie (2.1.2)
|
11
|
+
json (1.8.1)
|
11
12
|
minitest (2.5.1)
|
13
|
+
rake (10.3.2)
|
14
|
+
rdoc (4.1.1)
|
15
|
+
json (~> 1.4)
|
12
16
|
|
13
17
|
PLATFORMS
|
14
18
|
ruby
|
@@ -16,4 +20,6 @@ PLATFORMS
|
|
16
20
|
DEPENDENCIES
|
17
21
|
bundler (>= 1.0.0)
|
18
22
|
configy!
|
19
|
-
minitest
|
23
|
+
minitest (= 2.5.1)
|
24
|
+
rake
|
25
|
+
rdoc
|
data/HISTORY.md
CHANGED
data/configy.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "configy"
|
3
|
-
s.version = "1.
|
3
|
+
s.version = "1.2.0"
|
4
4
|
|
5
|
-
s.authors = [ "Gabe Varela", "Ben Marini", "Chip Miller", "Bram Swenson", "Jeremy Ruppel" ]
|
6
|
-
s.date = "
|
5
|
+
s.authors = [ "Gabe Varela", "Ben Marini", "Chip Miller", "Bram Swenson", "Jeremy Ruppel", 'Eric Holmes' ]
|
6
|
+
s.date = "2014-08-04"
|
7
7
|
s.email = "bmarini@gmail.com"
|
8
8
|
s.summary = "Simple yaml driven configuration gem"
|
9
9
|
s.homepage = "http://github.com/bmarini/configy"
|
@@ -13,9 +13,11 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.require_path = 'lib'
|
14
14
|
|
15
15
|
s.required_rubygems_version = ">= 1.3.6"
|
16
|
-
s.add_runtime_dependency "hashie", "
|
16
|
+
s.add_runtime_dependency "hashie", [">= 1.2", "< 3.0"]
|
17
17
|
s.add_development_dependency "bundler", ">= 1.0.0"
|
18
|
-
s.add_development_dependency "minitest"
|
18
|
+
s.add_development_dependency "minitest", "2.5.1"
|
19
|
+
s.add_development_dependency "rake"
|
20
|
+
s.add_development_dependency "rdoc"
|
19
21
|
|
20
22
|
s.extra_rdoc_files = [
|
21
23
|
"LICENSE",
|
data/lib/configy.rb
CHANGED
@@ -2,12 +2,13 @@ module Configy
|
|
2
2
|
autoload :Base, 'configy/base'
|
3
3
|
autoload :ConfigFile, 'configy/config_file'
|
4
4
|
autoload :ConfigStore, 'configy/config_store'
|
5
|
+
autoload :StringInquirer, 'configy/string_inquirer'
|
5
6
|
|
6
7
|
class ConfigyError < StandardError; end
|
7
8
|
class ConfigParamNotFound < ConfigyError; end
|
8
9
|
|
9
10
|
class << self
|
10
|
-
attr_writer :load_path, :
|
11
|
+
attr_writer :load_path, :cache_config
|
11
12
|
|
12
13
|
def load_path
|
13
14
|
if @load_path
|
@@ -24,13 +25,23 @@ module Configy
|
|
24
25
|
end
|
25
26
|
|
26
27
|
def section
|
27
|
-
@section ||=
|
28
|
+
@section ||= Configy::StringInquirer.new(section_string)
|
29
|
+
end
|
30
|
+
|
31
|
+
def section=( value )
|
32
|
+
@section = value.is_a?(String) ? Configy::StringInquirer.new(value) : value
|
28
33
|
end
|
29
34
|
|
30
35
|
def cache_config
|
31
36
|
@cache_config = false if @cache_config.nil?
|
32
37
|
@cache_config
|
33
38
|
end
|
39
|
+
|
40
|
+
protected
|
41
|
+
|
42
|
+
def section_string
|
43
|
+
ENV["CONFIGY_ENV"] || ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
|
44
|
+
end
|
34
45
|
end
|
35
46
|
|
36
47
|
def self.camelize(phrase)
|
data/spec/section_spec.rb
CHANGED
@@ -31,4 +31,19 @@ describe "Configy.section" do
|
|
31
31
|
Configy.section = "custom"
|
32
32
|
Configy.section.must_equal "custom"
|
33
33
|
end
|
34
|
+
|
35
|
+
describe "string inquiry" do
|
36
|
+
before do
|
37
|
+
Configy.section = nil
|
38
|
+
Configy.section.must_equal "development"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should be development?" do
|
42
|
+
Configy.section.development?.must_equal true
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should not be staging?" do
|
46
|
+
Configy.section.staging?.must_equal false
|
47
|
+
end
|
48
|
+
end
|
34
49
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Configy::StringInquirer do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@subject = Configy::StringInquirer.new "foo"
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should inherit from String" do
|
10
|
+
@subject.is_a?( String ).must_equal true
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should == 'foo'" do
|
14
|
+
@subject.must_equal 'foo'
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should be foo?" do
|
18
|
+
@subject.foo?.must_equal true
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should not be bar?" do
|
22
|
+
@subject.bar?.must_equal false
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should raise NoMethodError if not predicate" do
|
26
|
+
assert_raises NoMethodError do
|
27
|
+
@subject.foo
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Gabe Varela
|
@@ -10,44 +9,88 @@ authors:
|
|
10
9
|
- Chip Miller
|
11
10
|
- Bram Swenson
|
12
11
|
- Jeremy Ruppel
|
12
|
+
- Eric Holmes
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2014-08-04 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: hashie
|
20
|
-
requirement:
|
21
|
-
none: false
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
22
21
|
requirements:
|
23
|
-
- -
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '1.2'
|
25
|
+
- - <
|
24
26
|
- !ruby/object:Gem::Version
|
25
|
-
version:
|
27
|
+
version: '3.0'
|
26
28
|
type: :runtime
|
27
29
|
prerelease: false
|
28
|
-
version_requirements:
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ! '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.2'
|
35
|
+
- - <
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.0'
|
29
38
|
- !ruby/object:Gem::Dependency
|
30
39
|
name: bundler
|
31
|
-
requirement:
|
32
|
-
none: false
|
40
|
+
requirement: !ruby/object:Gem::Requirement
|
33
41
|
requirements:
|
34
42
|
- - ! '>='
|
35
43
|
- !ruby/object:Gem::Version
|
36
44
|
version: 1.0.0
|
37
45
|
type: :development
|
38
46
|
prerelease: false
|
39
|
-
version_requirements:
|
47
|
+
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: 1.0.0
|
40
52
|
- !ruby/object:Gem::Dependency
|
41
53
|
name: minitest
|
42
|
-
requirement:
|
43
|
-
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - '='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 2.5.1
|
59
|
+
type: :development
|
60
|
+
prerelease: false
|
61
|
+
version_requirements: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - '='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 2.5.1
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: rake
|
68
|
+
requirement: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
type: :development
|
74
|
+
prerelease: false
|
75
|
+
version_requirements: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rdoc
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
44
83
|
requirements:
|
45
84
|
- - ! '>='
|
46
85
|
- !ruby/object:Gem::Version
|
47
86
|
version: '0'
|
48
87
|
type: :development
|
49
88
|
prerelease: false
|
50
|
-
version_requirements:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
51
94
|
description:
|
52
95
|
email: bmarini@gmail.com
|
53
96
|
executables: []
|
@@ -65,10 +108,13 @@ files:
|
|
65
108
|
- README.md
|
66
109
|
- Rakefile
|
67
110
|
- configy.gemspec
|
111
|
+
- gemfiles/hashie1_2.gemfile
|
112
|
+
- gemfiles/hashie2_1.gemfile
|
68
113
|
- lib/configy.rb
|
69
114
|
- lib/configy/base.rb
|
70
115
|
- lib/configy/config_file.rb
|
71
116
|
- lib/configy/config_store.rb
|
117
|
+
- lib/configy/string_inquirer.rb
|
72
118
|
- lib/generators/configy/install/install_generator.rb
|
73
119
|
- lib/generators/configy/install/templates/config/app_config.local.yml.tt
|
74
120
|
- lib/generators/configy/install/templates/config/app_config.yml.tt
|
@@ -83,29 +129,29 @@ files:
|
|
83
129
|
- spec/scratch/.gitkeep
|
84
130
|
- spec/section_spec.rb
|
85
131
|
- spec/spec_helper.rb
|
132
|
+
- spec/string_inquirer_spec.rb
|
86
133
|
homepage: http://github.com/bmarini/configy
|
87
134
|
licenses: []
|
135
|
+
metadata: {}
|
88
136
|
post_install_message:
|
89
137
|
rdoc_options:
|
90
138
|
- --charset=UTF-8
|
91
139
|
require_paths:
|
92
140
|
- lib
|
93
141
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
142
|
requirements:
|
96
143
|
- - ! '>='
|
97
144
|
- !ruby/object:Gem::Version
|
98
145
|
version: '0'
|
99
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
-
none: false
|
101
147
|
requirements:
|
102
148
|
- - ! '>='
|
103
149
|
- !ruby/object:Gem::Version
|
104
150
|
version: 1.3.6
|
105
151
|
requirements: []
|
106
152
|
rubyforge_project:
|
107
|
-
rubygems_version:
|
153
|
+
rubygems_version: 2.2.2
|
108
154
|
signing_key:
|
109
|
-
specification_version:
|
155
|
+
specification_version: 4
|
110
156
|
summary: Simple yaml driven configuration gem
|
111
157
|
test_files: []
|