elasticonf 1.1.2 → 1.1.3
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Gemfile.lock +10 -8
- data/elasticonf.gemspec +1 -1
- data/lib/elasticonf.rb +7 -0
- data/lib/elasticonf/version.rb +1 -1
- data/spec/lib/elasticonf_spec.rb +29 -0
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa70ead7bcaae31e24429db8b9054eb62aaef07a
|
4
|
+
data.tar.gz: 5a0e3c812f8b3e9454d05ce74ac06a2fff6cc408
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b36e15f8901a3aaee7a635550ea462e29d08d64d14634a2f4907ff89764796a0865275f9918c896adea09bddb693c706a2150a7336f251f0f5dd0dd6047df384
|
7
|
+
data.tar.gz: 1aadce5ac6ce226e40c2de0dfb176275d6e9e2873534fa6b1f5c40f5cb2d5f4f2a9fb78279e990e6daccb9af7e37b9bb7f73d02d8f468174dc8b4225c0fef361
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
elasticonf (1.1.
|
5
|
-
hashie (
|
4
|
+
elasticonf (1.1.3)
|
5
|
+
hashie (>= 2.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
coveralls (0.7.
|
10
|
+
coveralls (0.7.1)
|
11
11
|
multi_json (~> 1.3)
|
12
12
|
rest-client
|
13
13
|
simplecov (>= 0.7)
|
@@ -15,12 +15,14 @@ GEM
|
|
15
15
|
thor
|
16
16
|
diff-lcs (1.2.5)
|
17
17
|
docile (1.1.5)
|
18
|
-
hashie (3.1
|
18
|
+
hashie (3.3.1)
|
19
19
|
mime-types (2.3)
|
20
20
|
multi_json (1.10.1)
|
21
|
+
netrc (0.7.7)
|
21
22
|
rake (10.3.2)
|
22
|
-
rest-client (1.
|
23
|
-
mime-types (>= 1.16)
|
23
|
+
rest-client (1.7.2)
|
24
|
+
mime-types (>= 1.16, < 3.0)
|
25
|
+
netrc (~> 0.7)
|
24
26
|
rspec (2.14.1)
|
25
27
|
rspec-core (~> 2.14.0)
|
26
28
|
rspec-expectations (~> 2.14.0)
|
@@ -29,7 +31,7 @@ GEM
|
|
29
31
|
rspec-expectations (2.14.5)
|
30
32
|
diff-lcs (>= 1.1.3, < 2.0)
|
31
33
|
rspec-mocks (2.14.6)
|
32
|
-
simplecov (0.
|
34
|
+
simplecov (0.9.0)
|
33
35
|
docile (~> 1.1.0)
|
34
36
|
multi_json
|
35
37
|
simplecov-html (~> 0.8.0)
|
@@ -37,7 +39,7 @@ GEM
|
|
37
39
|
term-ansicolor (1.3.0)
|
38
40
|
tins (~> 1.0)
|
39
41
|
thor (0.19.1)
|
40
|
-
tins (1.3.
|
42
|
+
tins (1.3.2)
|
41
43
|
yard (0.8.7.4)
|
42
44
|
|
43
45
|
PLATFORMS
|
data/elasticonf.gemspec
CHANGED
data/lib/elasticonf.rb
CHANGED
@@ -49,6 +49,13 @@ module Elasticonf
|
|
49
49
|
Kernel.const_set config.const_name, loader
|
50
50
|
end
|
51
51
|
|
52
|
+
def reload!
|
53
|
+
if Kernel.const_defined?(config.const_name)
|
54
|
+
Kernel.send :remove_const, config.const_name
|
55
|
+
end
|
56
|
+
load!
|
57
|
+
end
|
58
|
+
|
52
59
|
def configure_and_load!
|
53
60
|
configure { |config| yield(config) }
|
54
61
|
load!
|
data/lib/elasticonf/version.rb
CHANGED
data/spec/lib/elasticonf_spec.rb
CHANGED
@@ -186,6 +186,35 @@ describe Elasticonf do
|
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
189
|
+
describe '#reload!' do
|
190
|
+
let(:config_file) { subject.config.config_root.join('application.yml') }
|
191
|
+
let(:bak_file) { subject.config.config_root.join('application.bak') }
|
192
|
+
|
193
|
+
before do
|
194
|
+
subject.configure do |config|
|
195
|
+
config.config_root = subject.root.join('spec', 'fixtures')
|
196
|
+
config.config_file = 'application'
|
197
|
+
config.const_name = 'AppSettings'
|
198
|
+
end
|
199
|
+
|
200
|
+
subject.load!
|
201
|
+
|
202
|
+
# Assume that our configuration has been changed since we have already
|
203
|
+
# loaded it
|
204
|
+
YAML::load_file(config_file).tap do |config|
|
205
|
+
FileUtils.mv config_file, bak_file
|
206
|
+
config['some_config']['int_key'] = 2
|
207
|
+
File.open(config_file, 'w') { |f| f.write config.to_yaml }
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
after { FileUtils.mv(bak_file, config_file) }
|
212
|
+
|
213
|
+
it 'should reload configuration' do
|
214
|
+
expect { subject.reload! }.to change { AppSettings.some_config.int_key }.from(1).to(2)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
189
218
|
describe '#configure_and_load!' do
|
190
219
|
before { Elasticonf.stub(:load!).and_return(true) }
|
191
220
|
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticonf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Rezvanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 2.14.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 2.14.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: yard
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0.8'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.8'
|
69
69
|
description: Powerfull and flexible application config solution worked in any ruby
|
@@ -74,10 +74,10 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- .gitignore
|
78
|
-
- .rspec
|
79
|
-
- .travis.yml
|
80
|
-
- .yardopts
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- ".yardopts"
|
81
81
|
- Gemfile
|
82
82
|
- Gemfile.lock
|
83
83
|
- LICENSE
|
@@ -112,12 +112,12 @@ require_paths:
|
|
112
112
|
- lib
|
113
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '1.9'
|
118
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- -
|
120
|
+
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|