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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5c4862d083f144779496f5f681dc487da4791d4
4
- data.tar.gz: b681227e6222d777cdca0fbd4455ffa213a96a24
3
+ metadata.gz: fa70ead7bcaae31e24429db8b9054eb62aaef07a
4
+ data.tar.gz: 5a0e3c812f8b3e9454d05ce74ac06a2fff6cc408
5
5
  SHA512:
6
- metadata.gz: edc3baf568a4b10b755279dd56fb0106a87e23a32a647d3ad2fb2a9577834a4eab6a30325698cc9f36b44e4ed38e0c955e5f60ede9519fb69ef857d8ef659755
7
- data.tar.gz: 3efc0bfaebc2071896abe2678b68d4733f1e5577a359f6925c43f8e6c3e7eaf341757e3b4e5564363e503ba210dc86e4f23a5129e3ec3b7b6509fbe599e5e1cd
6
+ metadata.gz: b36e15f8901a3aaee7a635550ea462e29d08d64d14634a2f4907ff89764796a0865275f9918c896adea09bddb693c706a2150a7336f251f0f5dd0dd6047df384
7
+ data.tar.gz: 1aadce5ac6ce226e40c2de0dfb176275d6e9e2873534fa6b1f5c40f5cb2d5f4f2a9fb78279e990e6daccb9af7e37b9bb7f73d02d8f468174dc8b4225c0fef361
@@ -4,6 +4,7 @@ rvm:
4
4
  - ruby-head
5
5
  - jruby-head
6
6
  - rbx-head
7
+ - 2.1.2
7
8
  - 2.1.1
8
9
  - 2.1.0
9
10
  - 2.0.0
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- elasticonf (1.1.2)
5
- hashie (~> 3.1)
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.0)
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.0)
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.6.7)
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.8.2)
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.0)
42
+ tins (1.3.2)
41
43
  yard (0.8.7.4)
42
44
 
43
45
  PLATFORMS
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
 
20
20
  s.required_ruby_version = '>= 1.9'
21
21
 
22
- s.add_dependency 'hashie', '~> 3.1'
22
+ s.add_dependency 'hashie', '>= 2.0'
23
23
 
24
24
  s.add_development_dependency 'rake', '~> 10.3'
25
25
  s.add_development_dependency 'rspec', '~> 2.14.0'
@@ -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!
@@ -1,3 +1,3 @@
1
1
  module Elasticonf
2
- VERSION = '1.1.2'
2
+ VERSION = '1.1.3'
3
3
  end
@@ -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.2
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-07-08 00:00:00.000000000 Z
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: '3.1'
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: '3.1'
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: []