configurability 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/ChangeLog +13 -1
- data/History.md +8 -0
- data/Rakefile +1 -1
- data/bin/configurability +7 -0
- data/lib/configurability.rb +2 -2
- data/lib/configurability/config.rb +1 -1
- data/lib/configurability/setting_installer.rb +9 -1
- data/spec/configurability/config_spec.rb +3 -3
- data/spec/configurability_spec.rb +5 -5
- data/spec/helpers.rb +2 -0
- metadata +20 -20
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 16a729acbe5d059681f8a971a92bb4aff1928d6f6c3f62e5abdfb58ed860fbe7
|
4
|
+
data.tar.gz: f4aec87e5e323a5867ac2ca4dd898c9a8803a2b563b431b51e5e701d3d143626
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f59c67a1291be6d46da72404be01fc1e4074c3784f63002452b0f36b035021ad763a64516276722386d85928c3485d9a77e2240eed82a00575c95ec07c8a317a
|
7
|
+
data.tar.gz: 93f0b06f7cfa0e48578700ea41e6c3b27dce0dc3ab5dd3183c67d0cb4af9ffb7ade5b3b785b5787afbcb53123416ac69863a0919d874dba02bfe9a63378252b6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/ChangeLog
CHANGED
@@ -1,8 +1,20 @@
|
|
1
|
+
2018-06-12 Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
* certs/ged.pem:
|
4
|
+
Update my gem-signing cert
|
5
|
+
[1612a72e6636] [tip]
|
6
|
+
|
7
|
+
2018-04-03 Mahlon E. Smith <mahlon@martini.nu>
|
8
|
+
|
9
|
+
* .ruby-version, Rakefile, bin/configurability:
|
10
|
+
Add a 'defaults' dumper to the configurability executable.
|
11
|
+
[6eb89a9c81e9]
|
12
|
+
|
1
13
|
2017-04-17 Michael Granger <ged@FaerieMUD.org>
|
2
14
|
|
3
15
|
* .hgtags:
|
4
16
|
Added tag v3.2.0 for changeset f29a2ec77509
|
5
|
-
[a21b6f09e76c]
|
17
|
+
[a21b6f09e76c]
|
6
18
|
|
7
19
|
* .hgsigs:
|
8
20
|
Added signature for changeset c1a8ffc3266f
|
data/History.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## v3.3.0 [2018-09-12] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
Enhancements:
|
4
|
+
|
5
|
+
- Declare the class/class-instance variable when declaring a setting
|
6
|
+
- Add a 'defaults' subcommand to the configurability executable
|
7
|
+
|
8
|
+
|
1
9
|
## v3.2.0 [2017-04-17] Michael Granger <ged@FaerieMUD.org>
|
2
10
|
|
3
11
|
Enhancements:
|
data/Rakefile
CHANGED
@@ -31,7 +31,7 @@ hoespec = Hoe.spec 'configurability' do |spec|
|
|
31
31
|
spec.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
32
32
|
spec.developer 'Mahlon E. Smith', 'mahlon@martini.nu'
|
33
33
|
|
34
|
-
spec.dependency 'loggability', '~> 0.
|
34
|
+
spec.dependency 'loggability', '~> 0.14'
|
35
35
|
|
36
36
|
spec.dependency 'hoe-deveiate', '~> 0.8', :developer
|
37
37
|
spec.dependency 'simplecov', '~> 0.12', :developer
|
data/bin/configurability
CHANGED
@@ -289,6 +289,13 @@ class Configurability::Command
|
|
289
289
|
help :version, "Prints the Configurability version."
|
290
290
|
|
291
291
|
|
292
|
+
### The 'defaults' command
|
293
|
+
def defaults_command( *args )
|
294
|
+
$stdout.puts Configurability.default_config.dump
|
295
|
+
end
|
296
|
+
help :defaults, "Display configuration defaults for loaded libraries"
|
297
|
+
|
298
|
+
|
292
299
|
#
|
293
300
|
# Helper methods
|
294
301
|
#
|
data/lib/configurability.rb
CHANGED
@@ -13,10 +13,10 @@ module Configurability
|
|
13
13
|
|
14
14
|
|
15
15
|
# Library version constant
|
16
|
-
VERSION = '3.
|
16
|
+
VERSION = '3.3.0'
|
17
17
|
|
18
18
|
# Version-control revision constant
|
19
|
-
REVISION = %q$Revision:
|
19
|
+
REVISION = %q$Revision: 29114ac9dc2b $
|
20
20
|
|
21
21
|
require 'configurability/deferred_config'
|
22
22
|
|
@@ -84,7 +84,7 @@ class Configurability::Config
|
|
84
84
|
|
85
85
|
# Make a deep copy of the defaults before loading so we don't modify
|
86
86
|
# the argument
|
87
|
-
@defaults = Marshal.load( Marshal.dump(defaults) )
|
87
|
+
@defaults = defaults ? Marshal.load( Marshal.dump(defaults) ) : nil
|
88
88
|
@time_created = Time.now
|
89
89
|
@path = path
|
90
90
|
|
@@ -39,6 +39,12 @@ class Configurability::SettingInstaller
|
|
39
39
|
|
40
40
|
### Add accessors with the specified +name+ to the target.
|
41
41
|
def add_setting_accessors( name, options, &writer_hook )
|
42
|
+
if options[:use_class_vars]
|
43
|
+
self.target.class_variable_set( "@@#{name}", nil )
|
44
|
+
else
|
45
|
+
self.target.instance_variable_set( "@#{name}", nil )
|
46
|
+
end
|
47
|
+
|
42
48
|
reader = self.make_setting_reader( name, options )
|
43
49
|
writer = self.make_setting_writer( name, options, &writer_hook )
|
44
50
|
|
@@ -56,7 +62,9 @@ class Configurability::SettingInstaller
|
|
56
62
|
self.class_variable_get("@@#{name}")
|
57
63
|
end
|
58
64
|
else
|
59
|
-
return lambda {
|
65
|
+
return lambda {
|
66
|
+
self.instance_variable_get("@#{name}")
|
67
|
+
}
|
60
68
|
end
|
61
69
|
end
|
62
70
|
|
@@ -255,7 +255,7 @@ describe Configurability::Config do
|
|
255
255
|
# loading from a file
|
256
256
|
context " loaded from a file" do
|
257
257
|
before( :all ) do
|
258
|
-
filename = Dir::Tmpname.
|
258
|
+
filename = Dir::Tmpname.create( ['./test', '.conf'] ) {}
|
259
259
|
@tmpfile = Pathname( filename )
|
260
260
|
@tmpfile.open( 'w', 0644 ) {|io| io.print(TEST_CONFIG) }
|
261
261
|
end
|
@@ -284,7 +284,7 @@ describe Configurability::Config do
|
|
284
284
|
|
285
285
|
it "can be written to a different file" do
|
286
286
|
begin
|
287
|
-
path = Dir::Tmpname.
|
287
|
+
path = Dir::Tmpname.create( ['./another-', '.config'] ) {}
|
288
288
|
|
289
289
|
config.write( path )
|
290
290
|
expect( File.read(path) ).to match( /section: ?\n subsection/ )
|
@@ -333,7 +333,7 @@ describe Configurability::Config do
|
|
333
333
|
context " whose file changes after loading" do
|
334
334
|
|
335
335
|
before( :all ) do
|
336
|
-
filename = Dir::Tmpname.
|
336
|
+
filename = Dir::Tmpname.create( ['./test', '.conf'] ) {}
|
337
337
|
@tmpfile = Pathname( filename )
|
338
338
|
@tmpfile.open( 'w', 0644 ) {|io| io.print(TEST_CONFIG) }
|
339
339
|
end
|
@@ -404,21 +404,22 @@ describe Configurability do
|
|
404
404
|
defaults = Configurability.gather_defaults
|
405
405
|
|
406
406
|
expect( defaults ).to eq({ testconfig: { sect1: {sect2: { one: 1, two: 2 }} } })
|
407
|
+
expect( klass.config_key ).to eq( :testconfig__sect1__sect2 )
|
407
408
|
end
|
408
409
|
|
409
410
|
|
410
411
|
it "can return a Configurability::Config object with defaults, too" do
|
411
|
-
|
412
|
+
_klass1 = Class.new do
|
412
413
|
extend Configurability
|
413
414
|
config_key :testconfig
|
414
415
|
self::CONFIG_DEFAULTS = { :one => 1, :types => {:one => true} }
|
415
416
|
end
|
416
|
-
|
417
|
+
_klass2 = Class.new do
|
417
418
|
extend Configurability
|
418
419
|
config_key :testconfig
|
419
420
|
self::DEFAULT_CONFIG = { :two => 2, :types => {:two => true} }
|
420
421
|
end
|
421
|
-
|
422
|
+
_klass3 = Class.new do
|
422
423
|
extend Configurability
|
423
424
|
config_key :otherconfig
|
424
425
|
def self::defaults; { :other => true }; end
|
@@ -442,7 +443,7 @@ describe Configurability do
|
|
442
443
|
self::CONFIG_DEFAULTS = { :one => 1, :types => {:one => true} }
|
443
444
|
Configurability.log.debug "Defaults: %p" % [ self.defaults ]
|
444
445
|
end
|
445
|
-
|
446
|
+
_subclass = Class.new( klass ) do
|
446
447
|
config_key :spanishconfig
|
447
448
|
self::CONFIG_DEFAULTS = { :uno => 1 }
|
448
449
|
end
|
@@ -670,7 +671,6 @@ describe Configurability do
|
|
670
671
|
end
|
671
672
|
|
672
673
|
child_class = Class.new( parent_class )
|
673
|
-
child_class..extend( Configurability )
|
674
674
|
child_class.configurability( :testconfig ) do
|
675
675
|
setting :environment, default: :staging
|
676
676
|
setting :apikey, default: 'foom'
|
data/spec/helpers.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configurability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -11,9 +11,9 @@ bindir: bin
|
|
11
11
|
cert_chain:
|
12
12
|
- |
|
13
13
|
-----BEGIN CERTIFICATE-----
|
14
|
-
|
14
|
+
MIIEbDCCAtSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MQwwCgYDVQQDDANnZWQx
|
15
15
|
GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
|
16
|
-
|
16
|
+
HhcNMTcwOTI3MDAzMDQ0WhcNMTgwOTI3MDAzMDQ0WjA+MQwwCgYDVQQDDANnZWQx
|
17
17
|
GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
|
18
18
|
ggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC/JWGRHO+USzR97vXjkFgt
|
19
19
|
83qeNf2KHkcvrRTSnR64i6um/ziin0I0oX23H7VYrDJC9A/uoUa5nGRJS5Zw/+wW
|
@@ -26,17 +26,17 @@ cert_chain:
|
|
26
26
|
/D+K9JW9DDs3Yjgv9k4h7YMhW5gftosd+NkNC/+Y2CkCAwEAAaN1MHMwCQYDVR0T
|
27
27
|
BAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFHKN/nkRusdqCJEuq3lgB3fJvyTg
|
28
28
|
MBwGA1UdEQQVMBOBEWdlZEBGYWVyaWVNVUQub3JnMBwGA1UdEgQVMBOBEWdlZEBG
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
29
|
+
YWVyaWVNVUQub3JnMA0GCSqGSIb3DQEBBQUAA4IBgQB/qyi5pCjK8ceoKalfVAjS
|
30
|
+
vG64FEnLnD1bm39T5UaFIRmo+abZtfpg2QhwKvPbPjOicau2+m+MDQ2Cc3tgyaC3
|
31
|
+
dZxcP6w8APFg4AId09uWAZKf0xajvBMS2aOz8Bbmag6fwqRRkTMqsNYnmqcF7aRT
|
32
|
+
DuEzbEMfaOUYjU9RuB48vr4q8yRft0ww+3jq5iwNkrX1buL2pwBbyvgms6D/BV41
|
33
|
+
MaTVMjsHqJUwU2xVfhGtxGAWAer5S1HGYHkbio6mGVtiie0uWjmnzi7ppIlMr48a
|
34
|
+
7BNTsoZ+/JRk3iQWmmNsyFT7xfqBKye7cH11BX8V8P4MeGB5YWlMI+Myj5DZY3fQ
|
35
|
+
st2AGD4rb1l0ia7PfubcBThSIdz61eCb8gRi/RiZZwb3/7+eyEncLJzt2Ob9fGSF
|
36
|
+
X0qdrKi+2aZZ0NGuFj9AItBsVmAvkBGIpX4TEKQp5haEbPpmaqO5nIIhV26PXmyT
|
37
|
+
OMKv6pWsoS81vw5KAGBmfX8nht/Py90DQrbRvakATGI=
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date:
|
39
|
+
date: 2018-09-12 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: loggability
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.14'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.14'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: hoe-mercurial
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.9'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.9'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: hoe-highline
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '3.
|
145
|
+
version: '3.16'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '3.
|
152
|
+
version: '3.16'
|
153
153
|
description: |-
|
154
154
|
Configurability is a unified, non-intrusive, assume-nothing configuration system
|
155
155
|
for Ruby. It lets you keep the configuration for multiple objects in a single
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
version: '0'
|
209
209
|
requirements: []
|
210
210
|
rubyforge_project:
|
211
|
-
rubygems_version: 2.6
|
211
|
+
rubygems_version: 2.7.6
|
212
212
|
signing_key:
|
213
213
|
specification_version: 4
|
214
214
|
summary: Configurability is a unified, non-intrusive, assume-nothing configuration
|
metadata.gz.sig
CHANGED
Binary file
|