configurability 2.2.2 → 2.3.0.pre20161121123955
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/Rakefile +1 -1
 - data/lib/configurability.rb +41 -27
 - data/spec/configurability/config_spec.rb +27 -0
 - data/spec/configurability/deferredconfig_spec.rb +1 -1
 - data/spec/configurability_spec.rb +91 -7
 - metadata +25 -27
 - checksums.yaml.gz.sig +0 -0
 - data.tar.gz.sig +0 -2
 - data/.gemtest +0 -0
 - data/LICENSE +0 -27
 - metadata.gz.sig +0 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 470dde9269109d507424b3459e90e86f5dca7bce
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8c3ac3e698ab18ff6783c2c0c7afe2b333de8234
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 5ba7e4bb087da76a09937c1eb655e02a41aed364c8ead62e95e6d87210143b94d23979c7636ea82c4b31e7391d0da6803093e4b8572a49ae9d6f302414f27312
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b770a6f29e6703a0c16ccc0c56896e49e34fff4fe5ebc2eacca5533dbbab04e99879c18b65af101b7045a1b891ca77acf98412499e2e3ebd7a92305ee4aeb6b0
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -71,7 +71,7 @@ file GEMSPEC => __FILE__ do |task| 
     | 
|
| 
       71 
71 
     | 
    
         
             
            	spec.files.delete( '.gemtest' )
         
     | 
| 
       72 
72 
     | 
    
         
             
            	spec.files.delete( 'LICENSE' )
         
     | 
| 
       73 
73 
     | 
    
         
             
            	spec.signing_key = nil
         
     | 
| 
       74 
     | 
    
         
            -
            	spec.version = "#{spec.version}.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
         
     | 
| 
      
 74 
     | 
    
         
            +
            	spec.version = "#{spec.version.bump}.0.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
         
     | 
| 
       75 
75 
     | 
    
         
             
            	spec.cert_chain = [ 'certs/ged.pem' ]
         
     | 
| 
       76 
76 
     | 
    
         
             
            	File.open( task.name, 'w' ) do |fh|
         
     | 
| 
       77 
77 
     | 
    
         
             
            		fh.write( spec.to_ruby )
         
     | 
    
        data/lib/configurability.rb
    CHANGED
    
    | 
         @@ -21,7 +21,7 @@ module Configurability 
     | 
|
| 
       21 
21 
     | 
    
         
             
            	VERSION = '2.2.2'
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
            	# Version-control revision constant
         
     | 
| 
       24 
     | 
    
         
            -
            	REVISION = %q$Revision:  
     | 
| 
      
 24 
     | 
    
         
            +
            	REVISION = %q$Revision: 93764baee5f8 $
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
            	require 'configurability/deferredconfig'
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
         @@ -126,38 +126,46 @@ module Configurability 
     | 
|
| 
       126 
126 
     | 
    
         | 
| 
       127 
127 
     | 
    
         
             
            	### Install the appropriate section of the +config+ into the given +object+.
         
     | 
| 
       128 
128 
     | 
    
         
             
            	def self::install_config( config, object )
         
     | 
| 
       129 
     | 
    
         
            -
            		section  
     | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
       131 
     | 
    
         
            -
            			[ object, section ]
         
     | 
| 
      
 129 
     | 
    
         
            +
            		self.log.debug "Configuring %p with the %s section of the config." %
         
     | 
| 
      
 130 
     | 
    
         
            +
            			[ object, object.config_key ]
         
     | 
| 
       132 
131 
     | 
    
         | 
| 
       133 
     | 
    
         
            -
            		 
     | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
      
 132 
     | 
    
         
            +
            		section = self.find_config_section( config, object.config_key )
         
     | 
| 
      
 133 
     | 
    
         
            +
            		configure_method = object.method( :configure )
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
            		self.log.debug "  calling %p" % [ configure_method ]
         
     | 
| 
      
 136 
     | 
    
         
            +
            		configure_method.call( section )
         
     | 
| 
      
 137 
     | 
    
         
            +
            	end
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
            	### Find the section of the specified +config+ object that corresponds to the
         
     | 
| 
      
 141 
     | 
    
         
            +
            	### given +key+.
         
     | 
| 
      
 142 
     | 
    
         
            +
            	def self::find_config_section( config, key )
         
     | 
| 
      
 143 
     | 
    
         
            +
            		return key.to_s.split( '__' ).inject( config ) do |section, subkey|
         
     | 
| 
      
 144 
     | 
    
         
            +
            			next nil if section.nil?
         
     | 
| 
      
 145 
     | 
    
         
            +
            			self.get_config_subsection( section, subkey.to_sym )
         
     | 
| 
      
 146 
     | 
    
         
            +
            		end
         
     | 
| 
      
 147 
     | 
    
         
            +
            	end
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
            	### Return the subsection of the specified +config+ that corresponds to +key+, trying
         
     | 
| 
      
 151 
     | 
    
         
            +
            	### both struct-like and hash-like interfaces.
         
     | 
| 
      
 152 
     | 
    
         
            +
            	def self::get_config_subsection( config, key )
         
     | 
| 
      
 153 
     | 
    
         
            +
            		if config.respond_to?( key )
         
     | 
| 
      
 154 
     | 
    
         
            +
            			self.log.debug "  config has a #%s method; using that" % [ key ]
         
     | 
| 
      
 155 
     | 
    
         
            +
            			return config.send( key )
         
     | 
| 
       136 
156 
     | 
    
         
             
            		elsif config.respond_to?( :[] ) && config.respond_to?( :key? )
         
     | 
| 
       137 
157 
     | 
    
         
             
            			self.log.debug "  config has a hash-ish interface..."
         
     | 
| 
       138 
     | 
    
         
            -
            			if config.key?(  
     | 
| 
       139 
     | 
    
         
            -
            				self.log.debug "    and has a % 
     | 
| 
       140 
     | 
    
         
            -
            				 
     | 
| 
      
 158 
     | 
    
         
            +
            			if config.key?( key.to_sym ) || config.key?( key.to_s )
         
     | 
| 
      
 159 
     | 
    
         
            +
            				self.log.debug "    and has a %s member; using that" % [ key ]
         
     | 
| 
      
 160 
     | 
    
         
            +
            				return config[ key.to_sym ] || config[ key.to_s ]
         
     | 
| 
       141 
161 
     | 
    
         
             
            			else
         
     | 
| 
       142 
     | 
    
         
            -
            				self.log.debug "    but no  
     | 
| 
       143 
     | 
    
         
            -
            				 
     | 
| 
      
 162 
     | 
    
         
            +
            				self.log.debug "    but no `%s` member." % [ key ]
         
     | 
| 
      
 163 
     | 
    
         
            +
            				return nil
         
     | 
| 
       144 
164 
     | 
    
         
             
            			end
         
     | 
| 
       145 
165 
     | 
    
         
             
            		else
         
     | 
| 
       146 
     | 
    
         
            -
            			self.log.debug "  no %p section in %p; configuring with nil" % [  
     | 
| 
       147 
     | 
    
         
            -
            			 
     | 
| 
       148 
     | 
    
         
            -
            		end
         
     | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
       150 
     | 
    
         
            -
            		# Figure out if the configure method has already been called with this config
         
     | 
| 
       151 
     | 
    
         
            -
            		# section before, and don't re-call it if so
         
     | 
| 
       152 
     | 
    
         
            -
            		configure_method = object.method( :configure )
         
     | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
       154 
     | 
    
         
            -
            		if self.configured[ configure_method ] == section
         
     | 
| 
       155 
     | 
    
         
            -
            			self.log.debug "  avoiding re-calling %p" % [ configure_method ]
         
     | 
| 
       156 
     | 
    
         
            -
            			return
         
     | 
| 
      
 166 
     | 
    
         
            +
            			self.log.debug "  no %p section in %p; configuring with nil" % [ key, config ]
         
     | 
| 
      
 167 
     | 
    
         
            +
            			return nil
         
     | 
| 
       157 
168 
     | 
    
         
             
            		end
         
     | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
       159 
     | 
    
         
            -
            		self.log.debug "  calling %p" % [ configure_method ]
         
     | 
| 
       160 
     | 
    
         
            -
            		configure_method.call( section )
         
     | 
| 
       161 
169 
     | 
    
         
             
            	end
         
     | 
| 
       162 
170 
     | 
    
         | 
| 
       163 
171 
     | 
    
         | 
| 
         @@ -210,7 +218,7 @@ module Configurability 
     | 
|
| 
       210 
218 
     | 
    
         
             
            	### Set the config key of the object.
         
     | 
| 
       211 
219 
     | 
    
         
             
            	def config_key=( sym )
         
     | 
| 
       212 
220 
     | 
    
         
             
            		Configurability.configurable_objects |= [ self ]
         
     | 
| 
       213 
     | 
    
         
            -
            		@config_key = sym
         
     | 
| 
      
 221 
     | 
    
         
            +
            		@config_key = normalize_config_key( sym )
         
     | 
| 
       214 
222 
     | 
    
         
             
            	end
         
     | 
| 
       215 
223 
     | 
    
         | 
| 
       216 
224 
     | 
    
         | 
| 
         @@ -220,6 +228,12 @@ module Configurability 
     | 
|
| 
       220 
228 
     | 
    
         
             
            	end
         
     | 
| 
       221 
229 
     | 
    
         | 
| 
       222 
230 
     | 
    
         | 
| 
      
 231 
     | 
    
         
            +
            	### Return the specified +key+ normalized into a valid Symbol config key.
         
     | 
| 
      
 232 
     | 
    
         
            +
            	def normalize_config_key( key )
         
     | 
| 
      
 233 
     | 
    
         
            +
            		return key.to_s.gsub( /\./, '__' ).to_sym
         
     | 
| 
      
 234 
     | 
    
         
            +
            	end
         
     | 
| 
      
 235 
     | 
    
         
            +
             
     | 
| 
      
 236 
     | 
    
         
            +
             
     | 
| 
       223 
237 
     | 
    
         
             
            	#
         
     | 
| 
       224 
238 
     | 
    
         
             
            	# :section: Configuration Defaults API
         
     | 
| 
       225 
239 
     | 
    
         
             
            	#
         
     | 
| 
         @@ -49,10 +49,12 @@ describe Configurability::Config do 
     | 
|
| 
       49 
49 
     | 
    
         
             
            		expect( described_class.new.dump.strip ).to eq( "--- {}" )
         
     | 
| 
       50 
50 
     | 
    
         
             
            	end
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
       52 
53 
     | 
    
         
             
            	it "returns nil as its change description" do
         
     | 
| 
       53 
54 
     | 
    
         
             
            		expect( described_class.new.changed_reason ).to be_nil()
         
     | 
| 
       54 
55 
     | 
    
         
             
            	end
         
     | 
| 
       55 
56 
     | 
    
         | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
       56 
58 
     | 
    
         
             
            	it "autogenerates accessors for non-existant struct members" do
         
     | 
| 
       57 
59 
     | 
    
         
             
            		config = described_class.new
         
     | 
| 
       58 
60 
     | 
    
         
             
            		config.plugins ||= {}
         
     | 
| 
         @@ -62,18 +64,21 @@ describe Configurability::Config do 
     | 
|
| 
       62 
64 
     | 
    
         
             
            		expect( config.plugins.filestore.maxsize ).to eq( 1024 )
         
     | 
| 
       63 
65 
     | 
    
         
             
            	end
         
     | 
| 
       64 
66 
     | 
    
         | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
       65 
68 
     | 
    
         
             
            	it "merges values loaded from the config with any defaults given" do
         
     | 
| 
       66 
69 
     | 
    
         
             
            		config = described_class.new( TEST_CONFIG, :defaultkey => "Oh yeah." )
         
     | 
| 
       67 
70 
     | 
    
         | 
| 
       68 
71 
     | 
    
         
             
            		expect( config.defaultkey ).to eq( "Oh yeah." )
         
     | 
| 
       69 
72 
     | 
    
         
             
            	end
         
     | 
| 
       70 
73 
     | 
    
         | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
       71 
75 
     | 
    
         
             
            	it "symbolifies keys in defaults (issue #3)" do
         
     | 
| 
       72 
76 
     | 
    
         
             
            		config = described_class.new( TEST_CONFIG, 'stringkey' => "String value." )
         
     | 
| 
       73 
77 
     | 
    
         | 
| 
       74 
78 
     | 
    
         
             
            		expect( config.stringkey ).to eq( "String value." )
         
     | 
| 
       75 
79 
     | 
    
         
             
            	end
         
     | 
| 
       76 
80 
     | 
    
         | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
       77 
82 
     | 
    
         
             
            	it "yields itself if a block is given at creation" do
         
     | 
| 
       78 
83 
     | 
    
         
             
            		yielded_self = nil
         
     | 
| 
       79 
84 
     | 
    
         
             
            		config = described_class.new { yielded_self = self }
         
     | 
| 
         @@ -81,6 +86,7 @@ describe Configurability::Config do 
     | 
|
| 
       81 
86 
     | 
    
         
             
            		expect( yielded_self ).to equal( config )
         
     | 
| 
       82 
87 
     | 
    
         
             
            	end
         
     | 
| 
       83 
88 
     | 
    
         | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
       84 
90 
     | 
    
         
             
            	it "passes itself as the block argument if a block of arity 1 is given at creation" do
         
     | 
| 
       85 
91 
     | 
    
         
             
            		arg_self = nil
         
     | 
| 
       86 
92 
     | 
    
         
             
            		yielded_self = nil
         
     | 
| 
         @@ -93,12 +99,14 @@ describe Configurability::Config do 
     | 
|
| 
       93 
99 
     | 
    
         
             
            		expect( arg_self ).to equal( config )
         
     | 
| 
       94 
100 
     | 
    
         
             
            	end
         
     | 
| 
       95 
101 
     | 
    
         | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
       96 
103 
     | 
    
         
             
            	it "supports both Symbols and Strings for Hash-like access" do
         
     | 
| 
       97 
104 
     | 
    
         
             
            		config = described_class.new( TEST_CONFIG )
         
     | 
| 
       98 
105 
     | 
    
         | 
| 
       99 
106 
     | 
    
         
             
            		expect( config[:section]['subsection'][:subsubsection] ).to eq( 'value' )
         
     | 
| 
       100 
107 
     | 
    
         
             
            	end
         
     | 
| 
       101 
108 
     | 
    
         | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
       102 
110 
     | 
    
         
             
            	it "autoloads predicates for its members" do
         
     | 
| 
       103 
111 
     | 
    
         
             
            		config = described_class.new( TEST_CONFIG )
         
     | 
| 
       104 
112 
     | 
    
         | 
| 
         @@ -110,6 +118,7 @@ describe Configurability::Config do 
     | 
|
| 
       110 
118 
     | 
    
         
             
            		expect( config.section.monkeysubsection? ).to be_falsey()
         
     | 
| 
       111 
119 
     | 
    
         
             
            	end
         
     | 
| 
       112 
120 
     | 
    
         | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
       113 
122 
     | 
    
         
             
            	it "untaints values loaded from a config" do
         
     | 
| 
       114 
123 
     | 
    
         
             
            		yaml = TEST_CONFIG.dup.taint
         
     | 
| 
       115 
124 
     | 
    
         
             
            		config = described_class.new( yaml )
         
     | 
| 
         @@ -138,6 +147,7 @@ describe Configurability::Config do 
     | 
|
| 
       138 
147 
     | 
    
         
             
            			expect( val ).to eq([ 'pattern1', 'pattern2' ])
         
     | 
| 
       139 
148 
     | 
    
         
             
            		end
         
     | 
| 
       140 
149 
     | 
    
         | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
       141 
151 
     | 
    
         
             
            		it "knows that it has a nil member" do
         
     | 
| 
       142 
152 
     | 
    
         
             
            			val = config[:trap_on]['low disk space alert']
         
     | 
| 
       143 
153 
     | 
    
         
             
            			expect( val ).to have_member( nil )
         
     | 
| 
         @@ -156,6 +166,7 @@ describe Configurability::Config do 
     | 
|
| 
       156 
166 
     | 
    
         
             
            			expect( config ).not_to respond_to( :pork_sausage )
         
     | 
| 
       157 
167 
     | 
    
         
             
            		end
         
     | 
| 
       158 
168 
     | 
    
         | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
       159 
170 
     | 
    
         
             
            		it "contains values specified in the source" do
         
     | 
| 
       160 
171 
     | 
    
         
             
            			# section:
         
     | 
| 
       161 
172 
     | 
    
         
             
            			#   subsection:
         
     | 
| 
         @@ -178,6 +189,7 @@ describe Configurability::Config do 
     | 
|
| 
       178 
189 
     | 
    
         
             
            			expect( config.textsection ).to eq("With some text as the value\n...and another line.")
         
     | 
| 
       179 
190 
     | 
    
         
             
            		end
         
     | 
| 
       180 
191 
     | 
    
         | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
       181 
193 
     | 
    
         
             
            		it "returns struct members as an Array of Symbols" do
         
     | 
| 
       182 
194 
     | 
    
         
             
            			expect( config.members ).to be_an_instance_of( Array )
         
     | 
| 
       183 
195 
     | 
    
         
             
            			expect( config.members.size ).to be >= 4
         
     | 
| 
         @@ -186,12 +198,14 @@ describe Configurability::Config do 
     | 
|
| 
       186 
198 
     | 
    
         
             
            			end
         
     | 
| 
       187 
199 
     | 
    
         
             
            		end
         
     | 
| 
       188 
200 
     | 
    
         | 
| 
      
 201 
     | 
    
         
            +
             
     | 
| 
       189 
202 
     | 
    
         
             
            		it "is able to iterate over sections" do
         
     | 
| 
       190 
203 
     | 
    
         
             
            			config.each do |key, struct|
         
     | 
| 
       191 
204 
     | 
    
         
             
            				expect( key ).to be_an_instance_of( Symbol )
         
     | 
| 
       192 
205 
     | 
    
         
             
            			end
         
     | 
| 
       193 
206 
     | 
    
         
             
            		end
         
     | 
| 
       194 
207 
     | 
    
         | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
       195 
209 
     | 
    
         
             
            		it "dumps values specified in the source" do
         
     | 
| 
       196 
210 
     | 
    
         
             
            			expect( config.dump ).to match( /^section:/ )
         
     | 
| 
       197 
211 
     | 
    
         
             
            			expect( config.dump ).to match( /^\s+subsection:/ )
         
     | 
| 
         @@ -199,6 +213,7 @@ describe Configurability::Config do 
     | 
|
| 
       199 
213 
     | 
    
         
             
            			expect( config.dump ).to match( /^- list/ )
         
     | 
| 
       200 
214 
     | 
    
         
             
            		end
         
     | 
| 
       201 
215 
     | 
    
         | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
       202 
217 
     | 
    
         
             
            		it "provides a human-readable description of itself when inspected" do
         
     | 
| 
       203 
218 
     | 
    
         
             
            			expect( config.inspect ).to match( /\d+ sections/i )
         
     | 
| 
       204 
219 
     | 
    
         
             
            			expect( config.inspect ).to match( /mergekey/ )
         
     | 
| 
         @@ -206,6 +221,7 @@ describe Configurability::Config do 
     | 
|
| 
       206 
221 
     | 
    
         
             
            			expect( config.inspect ).to match( /from memory/i )
         
     | 
| 
       207 
222 
     | 
    
         
             
            		end
         
     | 
| 
       208 
223 
     | 
    
         | 
| 
      
 224 
     | 
    
         
            +
             
     | 
| 
       209 
225 
     | 
    
         
             
            		it "raises an exception when reloaded" do
         
     | 
| 
       210 
226 
     | 
    
         
             
            			expect {
         
     | 
| 
       211 
227 
     | 
    
         
             
            				config.reload
         
     | 
| 
         @@ -228,6 +244,7 @@ describe Configurability::Config do 
     | 
|
| 
       228 
244 
     | 
    
         
             
            			expect( config.changed? ).to be_truthy()
         
     | 
| 
       229 
245 
     | 
    
         
             
            		end
         
     | 
| 
       230 
246 
     | 
    
         | 
| 
      
 247 
     | 
    
         
            +
             
     | 
| 
       231 
248 
     | 
    
         
             
            		it "should report that its internal struct was modified as the reason for the change" do
         
     | 
| 
       232 
249 
     | 
    
         
             
            			expect( config.changed_reason ).to match( /struct was modified/i )
         
     | 
| 
       233 
250 
     | 
    
         
             
            		end
         
     | 
| 
         @@ -255,6 +272,7 @@ describe Configurability::Config do 
     | 
|
| 
       255 
272 
     | 
    
         
             
            			expect( config.path ).to eq( @tmpfile.expand_path )
         
     | 
| 
       256 
273 
     | 
    
         
             
            		end
         
     | 
| 
       257 
274 
     | 
    
         | 
| 
      
 275 
     | 
    
         
            +
             
     | 
| 
       258 
276 
     | 
    
         
             
            		it "writes itself back to the same file by default" do
         
     | 
| 
       259 
277 
     | 
    
         
             
            			config.port = 114411
         
     | 
| 
       260 
278 
     | 
    
         
             
            			config.write
         
     | 
| 
         @@ -263,6 +281,7 @@ describe Configurability::Config do 
     | 
|
| 
       263 
281 
     | 
    
         
             
            			expect( otherconfig.port ).to eq( 114411 )
         
     | 
| 
       264 
282 
     | 
    
         
             
            		end
         
     | 
| 
       265 
283 
     | 
    
         | 
| 
      
 284 
     | 
    
         
            +
             
     | 
| 
       266 
285 
     | 
    
         
             
            		it "can be written to a different file" do
         
     | 
| 
       267 
286 
     | 
    
         
             
            			begin
         
     | 
| 
       268 
287 
     | 
    
         
             
            			path = Dir::Tmpname.make_tmpname( './another-', '.config' )
         
     | 
| 
         @@ -274,10 +293,12 @@ describe Configurability::Config do 
     | 
|
| 
       274 
293 
     | 
    
         
             
            			end
         
     | 
| 
       275 
294 
     | 
    
         
             
            		end
         
     | 
| 
       276 
295 
     | 
    
         | 
| 
      
 296 
     | 
    
         
            +
             
     | 
| 
       277 
297 
     | 
    
         
             
            		it "includes the name of the file in its inspect output" do
         
     | 
| 
       278 
298 
     | 
    
         
             
            			expect( config.inspect ).to include( File.basename(@tmpfile.to_s) )
         
     | 
| 
       279 
299 
     | 
    
         
             
            		end
         
     | 
| 
       280 
300 
     | 
    
         | 
| 
      
 301 
     | 
    
         
            +
             
     | 
| 
       281 
302 
     | 
    
         
             
            		it "yields itself if a block is given at load-time" do
         
     | 
| 
       282 
303 
     | 
    
         
             
            			yielded_self = nil
         
     | 
| 
       283 
304 
     | 
    
         
             
            			config = described_class.load( @tmpfile.to_s ) do
         
     | 
| 
         @@ -286,6 +307,7 @@ describe Configurability::Config do 
     | 
|
| 
       286 
307 
     | 
    
         
             
            			expect( yielded_self ).to equal( config )
         
     | 
| 
       287 
308 
     | 
    
         
             
            		end
         
     | 
| 
       288 
309 
     | 
    
         | 
| 
      
 310 
     | 
    
         
            +
             
     | 
| 
       289 
311 
     | 
    
         
             
            		it "passes itself as the block argument if a block of arity 1 is given at load-time" do
         
     | 
| 
       290 
312 
     | 
    
         
             
            			arg_self = nil
         
     | 
| 
       291 
313 
     | 
    
         
             
            			yielded_self = nil
         
     | 
| 
         @@ -298,6 +320,7 @@ describe Configurability::Config do 
     | 
|
| 
       298 
320 
     | 
    
         
             
            			expect( arg_self ).to equal( config )
         
     | 
| 
       299 
321 
     | 
    
         
             
            		end
         
     | 
| 
       300 
322 
     | 
    
         | 
| 
      
 323 
     | 
    
         
            +
             
     | 
| 
       301 
324 
     | 
    
         
             
            		it "doesn't re-read its source file if it hasn't changed" do
         
     | 
| 
       302 
325 
     | 
    
         
             
            			expect( config.path ).not_to receive( :read )
         
     | 
| 
       303 
326 
     | 
    
         
             
            			expect( Configurability ).not_to receive( :configure_objects )
         
     | 
| 
         @@ -308,6 +331,7 @@ describe Configurability::Config do 
     | 
|
| 
       308 
331 
     | 
    
         | 
| 
       309 
332 
     | 
    
         
             
            	# reload if file changes
         
     | 
| 
       310 
333 
     | 
    
         
             
            	context " whose file changes after loading" do
         
     | 
| 
      
 334 
     | 
    
         
            +
             
     | 
| 
       311 
335 
     | 
    
         
             
            		before( :all ) do
         
     | 
| 
       312 
336 
     | 
    
         
             
            			filename = Dir::Tmpname.make_tmpname( './test', '.conf' )
         
     | 
| 
       313 
337 
     | 
    
         
             
            			@tmpfile = Pathname( filename )
         
     | 
| 
         @@ -333,16 +357,19 @@ describe Configurability::Config do 
     | 
|
| 
       333 
357 
     | 
    
         
             
            			expect( @config ).to be_changed
         
     | 
| 
       334 
358 
     | 
    
         
             
            		end
         
     | 
| 
       335 
359 
     | 
    
         | 
| 
      
 360 
     | 
    
         
            +
             
     | 
| 
       336 
361 
     | 
    
         
             
            		it "reports that its source was updated as the reason for the change" do
         
     | 
| 
       337 
362 
     | 
    
         
             
            			expect( @config.changed_reason ).to match( /source.*updated/i )
         
     | 
| 
       338 
363 
     | 
    
         
             
            		end
         
     | 
| 
       339 
364 
     | 
    
         | 
| 
      
 365 
     | 
    
         
            +
             
     | 
| 
       340 
366 
     | 
    
         
             
            		it "re-reads its file when reloaded" do
         
     | 
| 
       341 
367 
     | 
    
         
             
            			expect( @config.path ).to receive( :read ).and_return( TEST_CONFIG )
         
     | 
| 
       342 
368 
     | 
    
         
             
            			expect( Configurability ).to receive( :configure_objects ).with( @config )
         
     | 
| 
       343 
369 
     | 
    
         
             
            			expect( @config.reload ).to be_truthy()
         
     | 
| 
       344 
370 
     | 
    
         
             
            		end
         
     | 
| 
       345 
371 
     | 
    
         | 
| 
      
 372 
     | 
    
         
            +
             
     | 
| 
       346 
373 
     | 
    
         
             
            		it "reapplies its defaults when reloading" do
         
     | 
| 
       347 
374 
     | 
    
         
             
            			@config = described_class.load( @tmpfile.to_s, :defaultskey => 8 )
         
     | 
| 
       348 
375 
     | 
    
         
             
            			@config.reload
         
     | 
| 
         @@ -16,12 +16,12 @@ require 'configurability/deferredconfig' 
     | 
|
| 
       16 
16 
     | 
    
         
             
            #####################################################################
         
     | 
| 
       17 
17 
     | 
    
         
             
            describe Configurability::DeferredConfig do
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
19 
     | 
    
         
             
            	after( :each ) do
         
     | 
| 
       21 
20 
     | 
    
         
             
            		Configurability.configurable_objects.clear
         
     | 
| 
       22 
21 
     | 
    
         
             
            		Configurability.reset
         
     | 
| 
       23 
22 
     | 
    
         
             
            	end
         
     | 
| 
       24 
23 
     | 
    
         | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       25 
25 
     | 
    
         
             
            	it "calls Configurability.install_config with itself when a 'configure' method is defined" do
         
     | 
| 
       26 
26 
     | 
    
         
             
            		config = { :testing => :testing_config }
         
     | 
| 
       27 
27 
     | 
    
         
             
            		Configurability.configure_objects( config )
         
     | 
| 
         @@ -34,6 +34,27 @@ describe Configurability do 
     | 
|
| 
       34 
34 
     | 
    
         
             
            		expect( klass.config_key ).to be( :testconfig )
         
     | 
| 
       35 
35 
     | 
    
         
             
            	end
         
     | 
| 
       36 
36 
     | 
    
         | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            	it "allows a config key to specify a sub-section" do
         
     | 
| 
      
 39 
     | 
    
         
            +
            		klass = Class.new do
         
     | 
| 
      
 40 
     | 
    
         
            +
            			extend Configurability
         
     | 
| 
      
 41 
     | 
    
         
            +
            			config_key :testconfig__subsection
         
     | 
| 
      
 42 
     | 
    
         
            +
            		end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            		expect( klass.config_key ).to eq( :testconfig__subsection )
         
     | 
| 
      
 45 
     | 
    
         
            +
            	end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            	it "allows a config key to specify a sub-section via a more-readable string" do
         
     | 
| 
      
 49 
     | 
    
         
            +
            		klass = Class.new do
         
     | 
| 
      
 50 
     | 
    
         
            +
            			extend Configurability
         
     | 
| 
      
 51 
     | 
    
         
            +
            			config_key "testconfig.subsection"
         
     | 
| 
      
 52 
     | 
    
         
            +
            		end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            		expect( klass.config_key ).to eq( :testconfig__subsection )
         
     | 
| 
      
 55 
     | 
    
         
            +
            	end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
       37 
58 
     | 
    
         
             
            	it "fetches config sections via a method with the config key name if the config " +
         
     | 
| 
       38 
59 
     | 
    
         
             
            	   "responds_to? it" do
         
     | 
| 
       39 
60 
     | 
    
         
             
            		klass = Class.new do
         
     | 
| 
         @@ -49,20 +70,26 @@ describe Configurability do 
     | 
|
| 
       49 
70 
     | 
    
         
             
            		Configurability.configure_objects( config )
         
     | 
| 
       50 
71 
     | 
    
         
             
            	end
         
     | 
| 
       51 
72 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
            	it "fetches config subsections via a method chain that corresponds to the config key" do
         
     | 
| 
       53 
75 
     | 
    
         
             
            		klass = Class.new do
         
     | 
| 
       54 
     | 
    
         
            -
            			 
     | 
| 
       55 
     | 
    
         
            -
            			config_key  
     | 
| 
      
 76 
     | 
    
         
            +
            			extend Configurability
         
     | 
| 
      
 77 
     | 
    
         
            +
            			config_key "testconfig.subsection"
         
     | 
| 
       56 
78 
     | 
    
         
             
            		end
         
     | 
| 
       57 
79 
     | 
    
         | 
| 
       58 
80 
     | 
    
         
             
            		config = double( "configuration object" )
         
     | 
| 
       59 
81 
     | 
    
         
             
            		expect( config ).to receive( :respond_to? ).with( :testconfig ).and_return( true )
         
     | 
| 
       60 
     | 
    
         
            -
            		expect( config ).to receive( :testconfig ).and_return( :a_config_section )
         
     | 
| 
       61 
82 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
            		 
     | 
| 
      
 83 
     | 
    
         
            +
            		section = double( "configuration section" )
         
     | 
| 
      
 84 
     | 
    
         
            +
            		expect( config ).to receive( :testconfig ).and_return( section )
         
     | 
| 
      
 85 
     | 
    
         
            +
            		expect( section ).to receive( :respond_to? ).with( :subsection ).and_return( true )
         
     | 
| 
      
 86 
     | 
    
         
            +
            		expect( section ).to receive( :subsection ).and_return( :the_config_subsection )
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
            		expect( klass ).to receive( :configure ).with( :the_config_subsection )
         
     | 
| 
       63 
89 
     | 
    
         
             
            		Configurability.configure_objects( config )
         
     | 
| 
       64 
90 
     | 
    
         
             
            	end
         
     | 
| 
       65 
91 
     | 
    
         | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
       66 
93 
     | 
    
         
             
            	it "fetches config sections via the index operator if the config doesn't respond " +
         
     | 
| 
       67 
94 
     | 
    
         
             
            	   "directly to the section name, but does to the index operator and #key?" do
         
     | 
| 
       68 
95 
     | 
    
         
             
            		klass = Class.new do
         
     | 
| 
         @@ -81,6 +108,33 @@ describe Configurability do 
     | 
|
| 
       81 
108 
     | 
    
         
             
            		Configurability.configure_objects( config )
         
     | 
| 
       82 
109 
     | 
    
         
             
            	end
         
     | 
| 
       83 
110 
     | 
    
         | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
            	it "fetches config subsections via the index operator if the config doesn't respond " +
         
     | 
| 
      
 113 
     | 
    
         
            +
            	   "directly to the section name, but does to the index operator and #key?" do
         
     | 
| 
      
 114 
     | 
    
         
            +
            		klass = Class.new do
         
     | 
| 
      
 115 
     | 
    
         
            +
            			extend Configurability
         
     | 
| 
      
 116 
     | 
    
         
            +
            			config_key :testconfig__subsection
         
     | 
| 
      
 117 
     | 
    
         
            +
            		end
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
            		config = double( "configuration object" )
         
     | 
| 
      
 120 
     | 
    
         
            +
            		expect( config ).to receive( :respond_to? ).with( :testconfig ).and_return( false )
         
     | 
| 
      
 121 
     | 
    
         
            +
            		expect( config ).to receive( :respond_to? ).with( :key? ).and_return( true )
         
     | 
| 
      
 122 
     | 
    
         
            +
            		expect( config ).to receive( :respond_to? ).with( :[] ).and_return( true )
         
     | 
| 
      
 123 
     | 
    
         
            +
            		expect( config ).to receive( :key? ).with( :testconfig ).and_return( true )
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
            		section = double( "configuration section" )
         
     | 
| 
      
 126 
     | 
    
         
            +
            		expect( config ).to receive( :[] ).with( :testconfig ).and_return( section )
         
     | 
| 
      
 127 
     | 
    
         
            +
            		expect( section ).to receive( :respond_to? ).with( :subsection ).and_return( false )
         
     | 
| 
      
 128 
     | 
    
         
            +
            		expect( section ).to receive( :respond_to? ).with( :key? ).and_return( true )
         
     | 
| 
      
 129 
     | 
    
         
            +
            		expect( section ).to receive( :respond_to? ).with( :[] ).and_return( true )
         
     | 
| 
      
 130 
     | 
    
         
            +
            		expect( section ).to receive( :key? ).with( :subsection ).and_return( true )
         
     | 
| 
      
 131 
     | 
    
         
            +
            		expect( section ).to receive( :[] ).with( :subsection ).and_return( :the_config_subsection )
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
            		expect( klass ).to receive( :configure ).with( :the_config_subsection )
         
     | 
| 
      
 134 
     | 
    
         
            +
            		Configurability.configure_objects( config )
         
     | 
| 
      
 135 
     | 
    
         
            +
            	end
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
       84 
138 
     | 
    
         
             
            	it "passes nil to the configure method if the config doesn't respond to the section " +
         
     | 
| 
       85 
139 
     | 
    
         
             
            	   "name or the index operator" do
         
     | 
| 
       86 
140 
     | 
    
         
             
            		klass = Class.new do
         
     | 
| 
         @@ -97,6 +151,7 @@ describe Configurability do 
     | 
|
| 
       97 
151 
     | 
    
         
             
            		Configurability.configure_objects( config )
         
     | 
| 
       98 
152 
     | 
    
         
             
            	end
         
     | 
| 
       99 
153 
     | 
    
         | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
       100 
155 
     | 
    
         
             
            	it "tries the config key as a String if calling it with the Symbol returns nil" do
         
     | 
| 
       101 
156 
     | 
    
         
             
            		klass = Class.new do
         
     | 
| 
       102 
157 
     | 
    
         
             
            			extend Configurability
         
     | 
| 
         @@ -117,6 +172,22 @@ describe Configurability do 
     | 
|
| 
       117 
172 
     | 
    
         
             
            		Configurability.configure_objects( config )
         
     | 
| 
       118 
173 
     | 
    
         
             
            	end
         
     | 
| 
       119 
174 
     | 
    
         | 
| 
      
 175 
     | 
    
         
            +
             
     | 
| 
      
 176 
     | 
    
         
            +
            	it "extends including classes instead of appending features to them" do
         
     | 
| 
      
 177 
     | 
    
         
            +
            		klass = Class.new do
         
     | 
| 
      
 178 
     | 
    
         
            +
            			include Configurability
         
     | 
| 
      
 179 
     | 
    
         
            +
            			config_key :testconfig
         
     | 
| 
      
 180 
     | 
    
         
            +
            		end
         
     | 
| 
      
 181 
     | 
    
         
            +
             
     | 
| 
      
 182 
     | 
    
         
            +
            		config = double( "configuration object" )
         
     | 
| 
      
 183 
     | 
    
         
            +
            		expect( config ).to receive( :respond_to? ).with( :testconfig ).and_return( true )
         
     | 
| 
      
 184 
     | 
    
         
            +
            		expect( config ).to receive( :testconfig ).and_return( :a_config_section )
         
     | 
| 
      
 185 
     | 
    
         
            +
             
     | 
| 
      
 186 
     | 
    
         
            +
            		expect( klass ).to receive( :configure ).with( :a_config_section )
         
     | 
| 
      
 187 
     | 
    
         
            +
            		Configurability.configure_objects( config )
         
     | 
| 
      
 188 
     | 
    
         
            +
            	end
         
     | 
| 
      
 189 
     | 
    
         
            +
             
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
       120 
191 
     | 
    
         
             
            	it "can be used to configure plain objects, too" do
         
     | 
| 
       121 
192 
     | 
    
         
             
            		object = Object.new
         
     | 
| 
       122 
193 
     | 
    
         
             
            		object.extend( Configurability )
         
     | 
| 
         @@ -131,6 +202,7 @@ describe Configurability do 
     | 
|
| 
       131 
202 
     | 
    
         
             
            		Configurability.configure_objects( config )
         
     | 
| 
       132 
203 
     | 
    
         
             
            	end
         
     | 
| 
       133 
204 
     | 
    
         | 
| 
      
 205 
     | 
    
         
            +
             
     | 
| 
       134 
206 
     | 
    
         
             
            	it "configures classes that have inherited Configurability and set a different config_key" do
         
     | 
| 
       135 
207 
     | 
    
         
             
            		klass = Class.new do
         
     | 
| 
       136 
208 
     | 
    
         
             
            			extend Configurability
         
     | 
| 
         @@ -151,6 +223,7 @@ describe Configurability do 
     | 
|
| 
       151 
223 
     | 
    
         
             
            		Configurability.configure_objects( config )
         
     | 
| 
       152 
224 
     | 
    
         
             
            	end
         
     | 
| 
       153 
225 
     | 
    
         | 
| 
      
 226 
     | 
    
         
            +
             
     | 
| 
       154 
227 
     | 
    
         
             
            	it "uses the object's name for its config key if it has one and hasn't specified a key " +
         
     | 
| 
       155 
228 
     | 
    
         
             
            	   "directly" do
         
     | 
| 
       156 
229 
     | 
    
         
             
            		object = Object.new
         
     | 
| 
         @@ -166,6 +239,7 @@ describe Configurability do 
     | 
|
| 
       166 
239 
     | 
    
         
             
            		Configurability.configure_objects( config )
         
     | 
| 
       167 
240 
     | 
    
         
             
            	end
         
     | 
| 
       168 
241 
     | 
    
         | 
| 
      
 242 
     | 
    
         
            +
             
     | 
| 
       169 
243 
     | 
    
         
             
            	it "normalizes the object's name before using it" do
         
     | 
| 
       170 
244 
     | 
    
         
             
            		object = Object.new
         
     | 
| 
       171 
245 
     | 
    
         
             
            		def object.name; "Test Obj-Config"; end
         
     | 
| 
         @@ -180,7 +254,8 @@ describe Configurability do 
     | 
|
| 
       180 
254 
     | 
    
         
             
            		Configurability.configure_objects( config )
         
     | 
| 
       181 
255 
     | 
    
         
             
            	end
         
     | 
| 
       182 
256 
     | 
    
         | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
      
 257 
     | 
    
         
            +
             
     | 
| 
      
 258 
     | 
    
         
            +
            	it "uses the object's class name for its config key if it doesn't have a name and " +
         
     | 
| 
       184 
259 
     | 
    
         
             
            	   "hasn't specified a key directly" do
         
     | 
| 
       185 
260 
     | 
    
         
             
            		object = Object.new
         
     | 
| 
       186 
261 
     | 
    
         
             
            		object.extend( Configurability )
         
     | 
| 
         @@ -194,6 +269,7 @@ describe Configurability do 
     | 
|
| 
       194 
269 
     | 
    
         
             
            		Configurability.configure_objects( config )
         
     | 
| 
       195 
270 
     | 
    
         
             
            	end
         
     | 
| 
       196 
271 
     | 
    
         | 
| 
      
 272 
     | 
    
         
            +
             
     | 
| 
       197 
273 
     | 
    
         
             
            	it "uses only the last part of a class's name if it is namespaced" do
         
     | 
| 
       198 
274 
     | 
    
         
             
            		module My
         
     | 
| 
       199 
275 
     | 
    
         
             
            			class DbObject
         
     | 
| 
         @@ -210,6 +286,7 @@ describe Configurability do 
     | 
|
| 
       210 
286 
     | 
    
         
             
            		Configurability.configure_objects( config )
         
     | 
| 
       211 
287 
     | 
    
         
             
            	end
         
     | 
| 
       212 
288 
     | 
    
         | 
| 
      
 289 
     | 
    
         
            +
             
     | 
| 
       213 
290 
     | 
    
         
             
            	it "uses the 'anonymous' key if the object doesn't have a name, and its class is " +
         
     | 
| 
       214 
291 
     | 
    
         
             
            	   "anonymous, and it hasn't specified a key directly" do
         
     | 
| 
       215 
292 
     | 
    
         
             
            		objectclass = Class.new
         
     | 
| 
         @@ -243,6 +320,7 @@ describe Configurability do 
     | 
|
| 
       243 
320 
     | 
    
         
             
            			expect( Configurability.loaded_config ).to equal( @config )
         
     | 
| 
       244 
321 
     | 
    
         
             
            		end
         
     | 
| 
       245 
322 
     | 
    
         | 
| 
      
 323 
     | 
    
         
            +
             
     | 
| 
       246 
324 
     | 
    
         
             
            		it "propagates the installed configuration to any objects which add Configurability" do
         
     | 
| 
       247 
325 
     | 
    
         
             
            			objectclass = Class.new do
         
     | 
| 
       248 
326 
     | 
    
         
             
            				def initialize; @config = nil; end
         
     | 
| 
         @@ -257,6 +335,7 @@ describe Configurability do 
     | 
|
| 
       257 
335 
     | 
    
         
             
            			expect( object.config ).to eq( :yes )
         
     | 
| 
       258 
336 
     | 
    
         
             
            		end
         
     | 
| 
       259 
337 
     | 
    
         | 
| 
      
 338 
     | 
    
         
            +
             
     | 
| 
       260 
339 
     | 
    
         
             
            		it "defers configuration until after an object has defined a #configure method if " +
         
     | 
| 
       261 
340 
     | 
    
         
             
            		   "it adds Configurability before declaring one" do
         
     | 
| 
       262 
341 
     | 
    
         
             
            			objectclass = Class.new do
         
     | 
| 
         @@ -269,6 +348,7 @@ describe Configurability do 
     | 
|
| 
       269 
348 
     | 
    
         
             
            			expect( objectclass.config ).to eq( :yes )
         
     | 
| 
       270 
349 
     | 
    
         
             
            		end
         
     | 
| 
       271 
350 
     | 
    
         | 
| 
      
 351 
     | 
    
         
            +
             
     | 
| 
       272 
352 
     | 
    
         
             
            		it "doesn't reconfigure objects that have already been configured unless the config changes" do
         
     | 
| 
       273 
353 
     | 
    
         
             
            			first_objectclass = Class.new do
         
     | 
| 
       274 
354 
     | 
    
         
             
            				extend Configurability
         
     | 
| 
         @@ -304,6 +384,7 @@ describe Configurability do 
     | 
|
| 
       304 
384 
     | 
    
         
             
            			expect(Configurability.gather_defaults).to be_a( Hash )
         
     | 
| 
       305 
385 
     | 
    
         
             
            		end
         
     | 
| 
       306 
386 
     | 
    
         | 
| 
      
 387 
     | 
    
         
            +
             
     | 
| 
       307 
388 
     | 
    
         
             
            		it "fetches defaults from a CONFIG_DEFAULTS constant if the object defines one" do
         
     | 
| 
       308 
389 
     | 
    
         
             
            			klass = Class.new do
         
     | 
| 
       309 
390 
     | 
    
         
             
            				extend Configurability
         
     | 
| 
         @@ -319,6 +400,7 @@ describe Configurability do 
     | 
|
| 
       319 
400 
     | 
    
         
             
            			expect( defaults[:testconfig] ).to_not be( klass.const_get(:CONFIG_DEFAULTS) )
         
     | 
| 
       320 
401 
     | 
    
         
             
            		end
         
     | 
| 
       321 
402 
     | 
    
         | 
| 
      
 403 
     | 
    
         
            +
             
     | 
| 
       322 
404 
     | 
    
         
             
            		it "fetches defaults from a DEFAULT_CONFIG constant if the object defines one" do
         
     | 
| 
       323 
405 
     | 
    
         
             
            			klass = Class.new do
         
     | 
| 
       324 
406 
     | 
    
         
             
            				extend Configurability
         
     | 
| 
         @@ -333,6 +415,7 @@ describe Configurability do 
     | 
|
| 
       333 
415 
     | 
    
         
             
            			expect( defaults[:testconfig] ).to_not be( klass.const_get(:DEFAULT_CONFIG) )
         
     | 
| 
       334 
416 
     | 
    
         
             
            		end
         
     | 
| 
       335 
417 
     | 
    
         | 
| 
      
 418 
     | 
    
         
            +
             
     | 
| 
       336 
419 
     | 
    
         
             
            		it "fetches defaults from a #defaults method if the object implements one" do
         
     | 
| 
       337 
420 
     | 
    
         
             
            			klass = Class.new do
         
     | 
| 
       338 
421 
     | 
    
         
             
            				extend Configurability
         
     | 
| 
         @@ -347,6 +430,7 @@ describe Configurability do 
     | 
|
| 
       347 
430 
     | 
    
         
             
            			expect( defaults[:otherconfig] ).to_not be( klass.defaults )
         
     | 
| 
       348 
431 
     | 
    
         
             
            		end
         
     | 
| 
       349 
432 
     | 
    
         | 
| 
      
 433 
     | 
    
         
            +
             
     | 
| 
       350 
434 
     | 
    
         
             
            		it "can return a Configurability::Config object with defaults, too" do
         
     | 
| 
       351 
435 
     | 
    
         
             
            			klass1 = Class.new do
         
     | 
| 
       352 
436 
     | 
    
         
             
            				extend Configurability
         
     | 
| 
         @@ -374,6 +458,7 @@ describe Configurability do 
     | 
|
| 
       374 
458 
     | 
    
         
             
            			expect( config.otherconfig.other ).to be_truthy()
         
     | 
| 
       375 
459 
     | 
    
         
             
            		end
         
     | 
| 
       376 
460 
     | 
    
         | 
| 
      
 461 
     | 
    
         
            +
             
     | 
| 
       377 
462 
     | 
    
         
             
            		it "returns defaults for an object that inherits from a class with Configurability" do
         
     | 
| 
       378 
463 
     | 
    
         
             
            			klass = Class.new do
         
     | 
| 
       379 
464 
     | 
    
         
             
            				extend Configurability
         
     | 
| 
         @@ -390,7 +475,6 @@ describe Configurability do 
     | 
|
| 
       390 
475 
     | 
    
         | 
| 
       391 
476 
     | 
    
         
             
            			expect( config ).to respond_to( :spanishconfig )
         
     | 
| 
       392 
477 
     | 
    
         
             
            			expect( config.spanishconfig.uno ).to eq( 1 )
         
     | 
| 
       393 
     | 
    
         
            -
             
     | 
| 
       394 
478 
     | 
    
         
             
            		end
         
     | 
| 
       395 
479 
     | 
    
         | 
| 
       396 
480 
     | 
    
         
             
            	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: 2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.3.0.pre20161121123955
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Michael Granger
         
     | 
| 
         @@ -35,7 +35,7 @@ cert_chain: 
     | 
|
| 
       35 
35 
     | 
    
         
             
              w8aNA5re5+Rt/Vvjxj5AcEnZnZiz5x959NaddQocX32Z1unHw44pzRNUur1GInfW
         
     | 
| 
       36 
36 
     | 
    
         
             
              p4vpx2kUSFSAGjtCbDGTNV2AH8w9OU4xEmNz8c5lyoA=
         
     | 
| 
       37 
37 
     | 
    
         
             
              -----END CERTIFICATE-----
         
     | 
| 
       38 
     | 
    
         
            -
            date: 2016- 
     | 
| 
      
 38 
     | 
    
         
            +
            date: 2016-11-21 00:00:00.000000000 Z
         
     | 
| 
       39 
39 
     | 
    
         
             
            dependencies:
         
     | 
| 
       40 
40 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       41 
41 
     | 
    
         
             
              name: loggability
         
     | 
| 
         @@ -66,103 +66,103 @@ dependencies: 
     | 
|
| 
       66 
66 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       67 
67 
     | 
    
         
             
                    version: '1.4'
         
     | 
| 
       68 
68 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       69 
     | 
    
         
            -
              name: hoe- 
     | 
| 
      
 69 
     | 
    
         
            +
              name: hoe-deveiate
         
     | 
| 
       70 
70 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       71 
71 
     | 
    
         
             
                requirements:
         
     | 
| 
       72 
72 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       73 
73 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       74 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 74 
     | 
    
         
            +
                    version: '0.8'
         
     | 
| 
       75 
75 
     | 
    
         
             
              type: :development
         
     | 
| 
       76 
76 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       77 
77 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       78 
78 
     | 
    
         
             
                requirements:
         
     | 
| 
       79 
79 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       80 
80 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       81 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 81 
     | 
    
         
            +
                    version: '0.8'
         
     | 
| 
       82 
82 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       83 
     | 
    
         
            -
              name:  
     | 
| 
      
 83 
     | 
    
         
            +
              name: hoe-highline
         
     | 
| 
       84 
84 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       85 
85 
     | 
    
         
             
                requirements:
         
     | 
| 
       86 
86 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       87 
87 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       88 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 88 
     | 
    
         
            +
                    version: '0.2'
         
     | 
| 
       89 
89 
     | 
    
         
             
              type: :development
         
     | 
| 
       90 
90 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       91 
91 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       92 
92 
     | 
    
         
             
                requirements:
         
     | 
| 
       93 
93 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       94 
94 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       95 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 95 
     | 
    
         
            +
                    version: '0.2'
         
     | 
| 
       96 
96 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       97 
     | 
    
         
            -
              name:  
     | 
| 
      
 97 
     | 
    
         
            +
              name: simplecov
         
     | 
| 
       98 
98 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       99 
99 
     | 
    
         
             
                requirements:
         
     | 
| 
       100 
100 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       101 
101 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       102 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 102 
     | 
    
         
            +
                    version: '0.8'
         
     | 
| 
       103 
103 
     | 
    
         
             
              type: :development
         
     | 
| 
       104 
104 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       105 
105 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       106 
106 
     | 
    
         
             
                requirements:
         
     | 
| 
       107 
107 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       108 
108 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       109 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 109 
     | 
    
         
            +
                    version: '0.8'
         
     | 
| 
       110 
110 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       111 
     | 
    
         
            -
              name:  
     | 
| 
      
 111 
     | 
    
         
            +
              name: hoe-bundler
         
     | 
| 
       112 
112 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       113 
113 
     | 
    
         
             
                requirements:
         
     | 
| 
       114 
114 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       115 
115 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       116 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 116 
     | 
    
         
            +
                    version: '1.2'
         
     | 
| 
       117 
117 
     | 
    
         
             
              type: :development
         
     | 
| 
       118 
118 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       119 
119 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       120 
120 
     | 
    
         
             
                requirements:
         
     | 
| 
       121 
121 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       122 
122 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       123 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 123 
     | 
    
         
            +
                    version: '1.2'
         
     | 
| 
       124 
124 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       125 
     | 
    
         
            -
              name:  
     | 
| 
      
 125 
     | 
    
         
            +
              name: rspec
         
     | 
| 
       126 
126 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       127 
127 
     | 
    
         
             
                requirements:
         
     | 
| 
       128 
128 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       129 
129 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       130 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 130 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
       131 
131 
     | 
    
         
             
              type: :development
         
     | 
| 
       132 
132 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       133 
133 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       134 
134 
     | 
    
         
             
                requirements:
         
     | 
| 
       135 
135 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       136 
136 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       137 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 137 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
       138 
138 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       139 
     | 
    
         
            -
              name:  
     | 
| 
      
 139 
     | 
    
         
            +
              name: rdoc
         
     | 
| 
       140 
140 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       141 
141 
     | 
    
         
             
                requirements:
         
     | 
| 
       142 
142 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       143 
143 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       144 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 144 
     | 
    
         
            +
                    version: '4.0'
         
     | 
| 
       145 
145 
     | 
    
         
             
              type: :development
         
     | 
| 
       146 
146 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       147 
147 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       148 
148 
     | 
    
         
             
                requirements:
         
     | 
| 
       149 
149 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       150 
150 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       151 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 151 
     | 
    
         
            +
                    version: '4.0'
         
     | 
| 
       152 
152 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       153 
153 
     | 
    
         
             
              name: hoe
         
     | 
| 
       154 
154 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       155 
155 
     | 
    
         
             
                requirements:
         
     | 
| 
       156 
156 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       157 
157 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       158 
     | 
    
         
            -
                    version: '3. 
     | 
| 
      
 158 
     | 
    
         
            +
                    version: '3.15'
         
     | 
| 
       159 
159 
     | 
    
         
             
              type: :development
         
     | 
| 
       160 
160 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       161 
161 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       162 
162 
     | 
    
         
             
                requirements:
         
     | 
| 
       163 
163 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       164 
164 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       165 
     | 
    
         
            -
                    version: '3. 
     | 
| 
      
 165 
     | 
    
         
            +
                    version: '3.15'
         
     | 
| 
       166 
166 
     | 
    
         
             
            description: |-
         
     | 
| 
       167 
167 
     | 
    
         
             
              Configurability is a unified, unintrusive, assume-nothing configuration system
         
     | 
| 
       168 
168 
     | 
    
         
             
              for Ruby. It lets you keep the configuration for multiple objects in a single
         
     | 
| 
         @@ -179,10 +179,8 @@ extra_rdoc_files: 
     | 
|
| 
       179 
179 
     | 
    
         
             
            - Manifest.txt
         
     | 
| 
       180 
180 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       181 
181 
     | 
    
         
             
            files:
         
     | 
| 
       182 
     | 
    
         
            -
            - ".gemtest"
         
     | 
| 
       183 
182 
     | 
    
         
             
            - ChangeLog
         
     | 
| 
       184 
183 
     | 
    
         
             
            - History.rdoc
         
     | 
| 
       185 
     | 
    
         
            -
            - LICENSE
         
     | 
| 
       186 
184 
     | 
    
         
             
            - Manifest.txt
         
     | 
| 
       187 
185 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       188 
186 
     | 
    
         
             
            - Rakefile
         
     | 
| 
         @@ -214,12 +212,12 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       214 
212 
     | 
    
         
             
                  version: 1.9.2
         
     | 
| 
       215 
213 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       216 
214 
     | 
    
         
             
              requirements:
         
     | 
| 
       217 
     | 
    
         
            -
              - - " 
     | 
| 
      
 215 
     | 
    
         
            +
              - - ">"
         
     | 
| 
       218 
216 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       219 
     | 
    
         
            -
                  version:  
     | 
| 
      
 217 
     | 
    
         
            +
                  version: 1.3.1
         
     | 
| 
       220 
218 
     | 
    
         
             
            requirements: []
         
     | 
| 
       221 
219 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       222 
     | 
    
         
            -
            rubygems_version: 2.6. 
     | 
| 
      
 220 
     | 
    
         
            +
            rubygems_version: 2.6.8
         
     | 
| 
       223 
221 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       224 
222 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       225 
223 
     | 
    
         
             
            summary: Configurability is a unified, unintrusive, assume-nothing configuration system
         
     | 
    
        checksums.yaml.gz.sig
    DELETED
    
    | 
         Binary file 
     | 
    
        data.tar.gz.sig
    DELETED
    
    
    
        data/.gemtest
    DELETED
    
    | 
         
            File without changes
         
     | 
    
        data/LICENSE
    DELETED
    
    | 
         @@ -1,27 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            Copyright (c) 2010-2016 Michael Granger
         
     | 
| 
       2 
     | 
    
         
            -
            All rights reserved.
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            Redistribution and use in source and binary forms, with or without
         
     | 
| 
       5 
     | 
    
         
            -
            modification, are permitted provided that the following conditions are met:
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            * Redistributions of source code must retain the above copyright notice,
         
     | 
| 
       8 
     | 
    
         
            -
              this list of conditions and the following disclaimer.
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            * Redistributions in binary form must reproduce the above copyright notice,
         
     | 
| 
       11 
     | 
    
         
            -
              this list of conditions and the following disclaimer in the documentation
         
     | 
| 
       12 
     | 
    
         
            -
              and/or other materials provided with the distribution.
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
            * Neither the name of the author/s, nor the names of the project's
         
     | 
| 
       15 
     | 
    
         
            -
              contributors may be used to endorse or promote products derived from this
         
     | 
| 
       16 
     | 
    
         
            -
              software without specific prior written permission.
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         
     | 
| 
       19 
     | 
    
         
            -
            AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         
     | 
| 
       20 
     | 
    
         
            -
            IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
         
     | 
| 
       21 
     | 
    
         
            -
            DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
         
     | 
| 
       22 
     | 
    
         
            -
            FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
         
     | 
| 
       23 
     | 
    
         
            -
            DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
         
     | 
| 
       24 
     | 
    
         
            -
            SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
         
     | 
| 
       25 
     | 
    
         
            -
            CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
         
     | 
| 
       26 
     | 
    
         
            -
            OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
         
     | 
| 
       27 
     | 
    
         
            -
            OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         
     | 
    
        metadata.gz.sig
    DELETED
    
    | 
         @@ -1,4 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            -�ܼπi)?S�����L��p���&'P�=�7��/��3ߘ��&���X$�#w�I�z�Wٶ�Ċ�VжosL��"��a�c��&�����?{�WTD2ޡ�`��5I�0��Pv}�P�b=GPPRS�ZN�<����nOז1�
         
     | 
| 
       2 
     | 
    
         
            -
            -$c:0�Bu~�����@��ȼ���;��g
         
     | 
| 
       3 
     | 
    
         
            -
            ��\�,*%m����t������m��A�:��{���y<�I�E�b�� +E���3ټUgW�<c��d6T�A*�T���*��0�=��O.��#�*dD�
         
     | 
| 
       4 
     | 
    
         
            -
            ӯo~���d�.��"'SiF��O��^��,0�������]���NRT�V��C�X��O�٪�}<t"�7S�՟W4�{E"����19[ʴ��-�1
         
     |