complex_config 0.13.0 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9d1f7d933962f507ac718b852309d72585130723
4
- data.tar.gz: 91ec39308815be851342140df5a4c3f7618e2ab8
2
+ SHA256:
3
+ metadata.gz: 11714f3ba3ed9b55517d48387bd4b8a92e6eb3a8448b911b4892275adfe6d13c
4
+ data.tar.gz: ce4b19cb078404e1eb2e82805782bea3e3818e114f9e82f25b2a543dfd68ece6
5
5
  SHA512:
6
- metadata.gz: 9f05aa30b6ba2763e73b73cf9d9b27ef21ba3f8a4c68930f2c80aaeb4a9842e99f35bae7bc2a337d6444d01d66f8c83e2d0dd2aff21b440ad170848e0c48145d
7
- data.tar.gz: 9c7d6845a920b6e1099d8c7ba588361f173e8e4eeac13c07761c262c31442e1ca8402ab1b564dd3e6857998b343933bc8d769ca8218aa1af1c1d7e00f85c3ea4
6
+ metadata.gz: b5a6ae82c387a3866fc4eb4bdc834cf6c2dc87b4eee0c5df5d41632efcc5017230e13dd7d60a51997ad6318b2c3d42ab5ac314b6e873b3ab8ba282d7e8e98ef5
7
+ data.tar.gz: '079795e2114767896a3a362847b8079bc7b20fbe9f146872bba8a21af61b0ba8e698c4a00080e5013f3946c20566f222e993c26629527818d473334efe2357a7'
@@ -2,8 +2,9 @@ rvm:
2
2
  - 2.0
3
3
  - 2.1
4
4
  - 2.2
5
- - 2.3.3
6
- - 2.4.2
5
+ - 2.3
6
+ - 2.4
7
+ - 2.5
7
8
  - ruby-head
8
9
  - jruby-head
9
10
  sudo: false
data/README.md CHANGED
@@ -144,6 +144,8 @@ Here is the `ComplexConfig::Plugins::MONEY` plugin for example:
144
144
 
145
145
  ## Changes
146
146
 
147
+ * 2018-02-09 Release 0.13.1
148
+ Improve error reporting for encrypted files (missing key)
147
149
  * 2018-01-26 Release 0.13.0
148
150
  Improve `write_config` interface and more tests
149
151
  * 2017-11-17 Release 0.12.2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.13.0
1
+ 0.13.1
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: complex_config 0.13.0 ruby lib
2
+ # stub: complex_config 0.13.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "complex_config".freeze
6
- s.version = "0.13.0"
6
+ s.version = "0.13.1"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Florian Frank".freeze]
11
- s.date = "2018-01-26"
11
+ s.date = "2018-02-09"
12
12
  s.description = "This library allows you to access configuration files via a simple interface".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.extra_rdoc_files = ["README.md".freeze, "lib/complex_config.rb".freeze, "lib/complex_config/config.rb".freeze, "lib/complex_config/encryption.rb".freeze, "lib/complex_config/errors.rb".freeze, "lib/complex_config/plugins.rb".freeze, "lib/complex_config/plugins/enable.rb".freeze, "lib/complex_config/plugins/money.rb".freeze, "lib/complex_config/plugins/uri.rb".freeze, "lib/complex_config/provider.rb".freeze, "lib/complex_config/provider/shortcuts.rb".freeze, "lib/complex_config/proxy.rb".freeze, "lib/complex_config/railtie.rb".freeze, "lib/complex_config/rude.rb".freeze, "lib/complex_config/settings.rb".freeze, "lib/complex_config/shortcuts.rb".freeze, "lib/complex_config/version.rb".freeze]
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.homepage = "https://github.com/flori/complex_config".freeze
17
17
  s.licenses = ["Apache-2.0".freeze]
18
18
  s.rdoc_options = ["--title".freeze, "ComplexConfig -- configuration library".freeze, "--main".freeze, "README.md".freeze]
19
- s.rubygems_version = "2.6.14".freeze
19
+ s.rubygems_version = "2.7.3".freeze
20
20
  s.summary = "configuration library".freeze
21
21
  s.test_files = ["spec/complex_config/config_spec.rb".freeze, "spec/complex_config/encryption_spec.rb".freeze, "spec/complex_config/plugins_spec.rb".freeze, "spec/complex_config/provider_spec.rb".freeze, "spec/complex_config/settings_spec.rb".freeze, "spec/complex_config/shortcuts_spec.rb".freeze, "spec/spec_helper.rb".freeze]
22
22
 
@@ -68,13 +68,14 @@ class ComplexConfig::Provider
68
68
  datas << IO.binread(pathname)
69
69
  end
70
70
  if enc_pathname = pathname.to_s + '.enc' and
71
- File.exist?(enc_pathname) and my_key = key_as_bytes(pathname)
71
+ File.exist?(enc_pathname) and
72
+ my_key = key_as_bytes(enc_pathname)
72
73
  then
73
74
  text = IO.binread(enc_pathname)
74
75
  datas << ComplexConfig::Encryption.new(my_key).decrypt(text)
75
76
  end
76
77
  datas.empty? and raise ComplexConfig::ConfigurationFileMissing,
77
- "configuration file #{pathname.inspect} is missing"
78
+ "configuration file #{pathname.to_s.inspect} is missing"
78
79
  results = datas.map { |d| evaluate(pathname, d) }
79
80
  hashes = results.map { |r| ::YAML.load(r, pathname) }
80
81
  settings = ComplexConfig::Settings.build(name, hashes.shift)
@@ -166,10 +167,13 @@ class ComplexConfig::Provider
166
167
  ].compact[0, 1].map(&:strip).first
167
168
  end
168
169
 
169
- def key_as_bytes(pathname = nil)
170
- k = key(pathname) or
171
- raise ComplexConfig::EncryptionKeyInvalid, "encryption key is missing"
172
- key_to_bytes(k)
170
+ def key_as_bytes(pathname)
171
+ if k = key(pathname.sub(/\.enc\z/, ''))
172
+ key_to_bytes(k)
173
+ else
174
+ warn "encryption key is missing for #{pathname.to_s.inspect} => Ignoring it!"
175
+ nil
176
+ end
173
177
  end
174
178
 
175
179
  attr_writer :key
@@ -1,6 +1,6 @@
1
1
  module ComplexConfig
2
2
  # ComplexConfig version
3
- VERSION = '0.13.0'
3
+ VERSION = '0.13.1'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: complex_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-26 00:00:00.000000000 Z
11
+ date: 2018-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  version: '0'
216
216
  requirements: []
217
217
  rubyforge_project:
218
- rubygems_version: 2.6.14
218
+ rubygems_version: 2.7.3
219
219
  signing_key:
220
220
  specification_version: 4
221
221
  summary: configuration library