configurability 3.1.1 → 3.1.2

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
2
  SHA1:
3
- metadata.gz: e32883ba03aa78f84c42fddecf239f302dfd459e
4
- data.tar.gz: 4b23dd3fae36d67b931995c1676a506a8edc847f
3
+ metadata.gz: 7c45a9143a15707d91401576cb803aceedd10855
4
+ data.tar.gz: 73ccce66fcded9ec68e40913f17a9524cdb1c88b
5
5
  SHA512:
6
- metadata.gz: 5ceaf6f368433e60377b72fe0d4aac4adbf12362a04938230fd981cd7114cddecc542fd8f2a2e65d9a8f62910e9bd35c941c7958cc0c983177b791a0c4d2c57b
7
- data.tar.gz: ab7973670f49baa4528113fc96e0548ab5e4c40e2493d14c1ba1747653cf9855e678ddebe163524b50f64d894387d202815366bb98aa5dc38dbd77d79b913231
6
+ metadata.gz: 2429a91eacfdac2d85086a7c27df4eef69df8e9829305cb305beb406c47e130028a0e0e6de015c032524e3a793e504857de5c64033fe129935db1c596e4a15bf
7
+ data.tar.gz: a167625e37fd5e66f1416d3c68751dc1ab7bfa2c7fdc0690dc102f5a86d7f291851d27491a51f154f146c98b1d9fe2cc5aafba4e7faaedeaa09edceaf0802c8a
Binary file
data.tar.gz.sig CHANGED
Binary file
data/History.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## v3.1.2 [2017-01-16] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Bugfix:
4
+
5
+ - Always use the pre-processor block for defaults.
6
+
7
+
1
8
  ## v3.1.1 [2017-01-03] Michael Granger <ged@FaerieMUD.org>
2
9
 
3
10
  Bugfix:
@@ -13,10 +13,10 @@ module Configurability
13
13
 
14
14
 
15
15
  # Library version constant
16
- VERSION = '3.1.1'
16
+ VERSION = '3.1.2'
17
17
 
18
18
  # Version-control revision constant
19
- REVISION = %q$Revision: d6721e4b2dd5 $
19
+ REVISION = %q$Revision: d4831719cb5d $
20
20
 
21
21
  require 'configurability/deferred_config'
22
22
 
@@ -55,7 +55,7 @@ class Configurability::SettingInstaller
55
55
  def add_default( name, options )
56
56
  default_value = options[ :default ]
57
57
 
58
- self.target.instance_variable_set( "@#{name}", default_value )
58
+ self.target.send( "#{name}=", default_value )
59
59
  if self.target.respond_to?( :const_defined? )
60
60
  defaults = if self.target.const_defined?( :CONFIG_DEFAULTS, false )
61
61
  self.target.const_get( :CONFIG_DEFAULTS, false )
@@ -613,7 +613,7 @@ describe Configurability do
613
613
  end
614
614
 
615
615
 
616
- it "installs the current config after its done if it's already been loaded" do
616
+ it "installs the current config after it's done if it's already loaded" do
617
617
  config = OpenStruct.new( testconfig: {
618
618
  environment: 'production',
619
619
  apikey: 'jofRtkw&QzCoukGwAWDMjyTkQzWnCXhhgEs'
@@ -633,11 +633,11 @@ describe Configurability do
633
633
 
634
634
  it "can declare settings with a block to do writer pre-processing" do
635
635
  mod.configurability( :testconfig ) do
636
- setting :data_dir do |dir|
636
+ setting :data_dir, default: '/tmp/data' do |dir|
637
637
  Pathname( dir )
638
638
  end
639
639
  setting :apikey do |key|
640
- raise "Invalid API key!" unless key.to_s =~ /\A\p{Xdigit}{32}\z/
640
+ raise "Invalid API key!" unless key.nil? || key.to_s =~ /\A\p{Xdigit}{32}\z/
641
641
  key
642
642
  end
643
643
  end
@@ -651,6 +651,17 @@ describe Configurability do
651
651
  end
652
652
 
653
653
 
654
+ it "uses the setting block for setting up the initial defaults" do
655
+ mod.configurability( :testconfig ) do
656
+ setting :data_dir, default: 'this/that' do |dir|
657
+ Pathname( dir )
658
+ end
659
+ end
660
+
661
+ expect( mod.data_dir ).to be_a( Pathname )
662
+ end
663
+
664
+
654
665
  it "supports inheritance of defaults" do
655
666
  parent_class = Class.new
656
667
  parent_class.extend( Configurability )
@@ -672,6 +683,7 @@ describe Configurability do
672
683
  )
673
684
  end
674
685
 
686
+
675
687
  end
676
688
 
677
689
  end
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.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
@@ -36,7 +36,7 @@ cert_chain:
36
36
  w8aNA5re5+Rt/Vvjxj5AcEnZnZiz5x959NaddQocX32Z1unHw44pzRNUur1GInfW
37
37
  p4vpx2kUSFSAGjtCbDGTNV2AH8w9OU4xEmNz8c5lyoA=
38
38
  -----END CERTIFICATE-----
39
- date: 2017-01-04 00:00:00.000000000 Z
39
+ date: 2017-01-16 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: loggability
metadata.gz.sig CHANGED
Binary file