configurability 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/ChangeLog CHANGED
@@ -1,12 +1,103 @@
1
+ 2013-01-30 Mahlon E. Smith <mahlon@martini.nu>
2
+
3
+ * .hgtags:
4
+ Added tag v2.0.0 for changeset 120cbb7d7020
5
+ [ef82f9cfdc97] [tip]
6
+
7
+ * .hgsigs:
8
+ Added signature for changeset c4f53e99a024
9
+ [120cbb7d7020] [v2.0.0]
10
+
11
+ 2013-01-30 Michael Granger <ged@FaerieMUD.org>
12
+
13
+ * History.rdoc, lib/configurability.rb:
14
+ Bump major version, update history.
15
+ [c4f53e99a024]
16
+
17
+ * lib/configurability/config.rb, spec/configurability/config_spec.rb:
18
+ Make missing config values return nil instead of auto-vivifying to a
19
+ Struct.
20
+
21
+ This is not a backward-compatible change, but in practice, far more
22
+ work was done to detect non-existant values than was saved by the
23
+ debatable convenience of being able to auto-create nested structs.
24
+ [71e0fdf7525c] [github/master]
25
+
26
+ * .tm_properties:
27
+ Set indent for specs, too
28
+ [652d73f009ee]
29
+
30
+ 2012-08-06 Michael Granger <ged@FaerieMUD.org>
31
+
32
+ * spec/configurability/deferredconfig_spec.rb:
33
+ Added a test for propagating config defaults.
34
+ [6a9b96abf9c9]
35
+
36
+ 2012-06-07 Michael Granger <ged@FaerieMUD.org>
37
+
38
+ * .rvm.gems, Rakefile, lib/configurability/config.rb,
39
+ spec/configurability/config_spec.rb, spec/configurability_spec.rb,
40
+ spec/lib/helpers.rb:
41
+ Update to loggability 0.4 and add Rubinius (1.9-mode) fixes.
42
+ [e4f8f58e87f9]
43
+
44
+ 2012-05-19 Mahlon E. Smith <mahlon@martini.nu>
45
+
46
+ * bin/configurability:
47
+ Fix a minor copy/paste omission.
48
+ [67eaa6009847]
49
+
50
+ 2012-05-18 Michael Granger <ged@FaerieMUD.org>
51
+
52
+ * .rvm.gems:
53
+ Bumping Loggability dependency for inheritance bugfix
54
+ [ab21216307cc]
55
+
56
+ 2012-05-10 Michael Granger <ged@FaerieMUD.org>
57
+
58
+ * .rvm.gems, Rakefile:
59
+ Bump dependency on Loggability to 0.2.
60
+ [6e9391f1b7fa]
61
+
62
+ 2012-05-09 Michael Granger <ged@FaerieMUD.org>
63
+
64
+ * .hgtags:
65
+ Added tag v1.2.0 for changeset 393e62010a17
66
+ [2cbdc041962d]
67
+
68
+ * .hgsigs:
69
+ Added signature for changeset 6b5e075386ee
70
+ [393e62010a17] [v1.2.0]
71
+
72
+ * .rvm.gems, History.rdoc, Rakefile, lib/configurability.rb:
73
+ Bump the minor version, update history.
74
+ [6b5e075386ee]
75
+
76
+ * .hgignore:
77
+ Ignore Rubinius bytecode cache
78
+ [2987cb594c6c]
79
+
80
+ 2012-05-07 Michael Granger <ged@FaerieMUD.org>
81
+
82
+ * bin/configurability:
83
+ Bugfix for bin/configurability.
84
+ [68fdbae52542]
85
+
86
+ * .rvm.gems, Manifest.txt, Rakefile, bin/configurability,
87
+ lib/configurability.rb, lib/configurability/config.rb,
88
+ lib/configurability/logging.rb, spec/lib/helpers.rb:
89
+ Converted to Loggability for logging.
90
+ [1631d0c31d81]
91
+
1
92
  2012-04-25 Michael Granger <ged@FaerieMUD.org>
2
93
 
3
94
  * bin/configurability:
4
95
  Add first version of a command-line utility
5
- [ad1ff0049fcf] [tip]
96
+ [ad1ff0049fcf]
6
97
 
7
98
  * .hgtags:
8
99
  Added tag v1.1.0 for changeset 070e4bfc8e55
9
- [cc2d783fd316] [github/master]
100
+ [cc2d783fd316]
10
101
 
11
102
  * .hgsigs:
12
103
  Added signature for changeset 2e082d901553
@@ -80,6 +171,15 @@
80
171
  Merged with 29a1c3384b7f
81
172
  [afa3d24b4117]
82
173
 
174
+ 2012-02-06 Michael Granger <ged@FaerieMUD.org>
175
+
176
+ * lib/configurability.rb:
177
+ Make unknown config log message less chatty.
178
+
179
+ Thanks to Mahlon E. Smith for the gargantuan patch. "Ssssh baby.
180
+ It's cool. Don't say a word. There will also be corn served."
181
+ [29a1c3384b7f]
182
+
83
183
  2012-01-27 Michael Granger <ged@FaerieMUD.org>
84
184
 
85
185
  * .hgtags:
@@ -99,35 +199,6 @@
99
199
  Merged with ssh://hg@bitbucket.org/ged/configurability@86718657a466
100
200
  [d3f6f8d77060]
101
201
 
102
- 2011-11-01 Michael Granger <ged@FaerieMUD.org>
103
-
104
- * .hgtags:
105
- Added tag v1.0.8 for changeset 5b3d66af5a59
106
- [86718657a466]
107
-
108
- * .hgsigs:
109
- Added signature for changeset 97a03db6f41c
110
- [5b3d66af5a59] [v1.0.8]
111
-
112
- * History.rdoc, lib/configurability.rb:
113
- Bumped patch version and updated the History file.
114
- [97a03db6f41c]
115
-
116
- * spec/configurability/config_spec.rb:
117
- Fix for Ruby 1.9.3.
118
- [a26cd541ea8f]
119
-
120
- 2012-02-06 Michael Granger <ged@FaerieMUD.org>
121
-
122
- * lib/configurability.rb:
123
- Make unknown config log message less chatty.
124
-
125
- Thanks to Mahlon E. Smith for the gargantuan patch. "Ssssh baby.
126
- It's cool. Don't say a word. There will also be corn served."
127
- [29a1c3384b7f]
128
-
129
- 2012-01-27 Michael Granger <ged@FaerieMUD.org>
130
-
131
202
  * .hgtags:
132
203
  Added tag v1.0.8 for changeset 6a7852aa7398
133
204
  [5e85b9cb1122]
@@ -152,6 +223,24 @@
152
223
  Adding TextMate properties
153
224
  [45b92add3e1e]
154
225
 
226
+ 2011-11-01 Michael Granger <ged@FaerieMUD.org>
227
+
228
+ * .hgtags:
229
+ Added tag v1.0.8 for changeset 5b3d66af5a59
230
+ [86718657a466]
231
+
232
+ * .hgsigs:
233
+ Added signature for changeset 97a03db6f41c
234
+ [5b3d66af5a59] [v1.0.8]
235
+
236
+ * History.rdoc, lib/configurability.rb:
237
+ Bumped patch version and updated the History file.
238
+ [97a03db6f41c]
239
+
240
+ * spec/configurability/config_spec.rb:
241
+ Fix for Ruby 1.9.3.
242
+ [a26cd541ea8f]
243
+
155
244
  2011-10-13 Michael Granger <ged@FaerieMUD.org>
156
245
 
157
246
  * .hgtags:
@@ -236,24 +325,6 @@
236
325
  Removed tag v1.0.4
237
326
  [1ef1012b278c]
238
327
 
239
- * .hgtags:
240
- Added tag v1.0.4 for changeset 84718f122b7b
241
- [99d382b750f6]
242
-
243
- * .hgsigs:
244
- Added signature for changeset eef299ea1d29
245
- [84718f122b7b]
246
-
247
- * lib/configurability.rb, lib/configurability/config.rb,
248
- spec/configurability/config_spec.rb:
249
- Fix for config files with nil keys (fixes #1)
250
- [eef299ea1d29]
251
-
252
- * .hgsub, .hgsubstate, .hgsubstate, History.md, LICENSE, Manifest.txt,
253
- README.md, Rakefile, project.yml:
254
- Converted to Hoe.
255
- [fb024df77138]
256
-
257
328
  2010-11-29 Michael Granger <ged@FaerieMUD.org>
258
329
 
259
330
  * .hgsub:
@@ -276,6 +347,28 @@
276
347
  Adding Github mirror to the README
277
348
  [bb8f2829eb37]
278
349
 
350
+ 2011-02-08 Michael Granger <ged@FaerieMUD.org>
351
+
352
+ * .hgtags:
353
+ Added tag v1.0.4 for changeset 84718f122b7b
354
+ [99d382b750f6]
355
+
356
+ * .hgsigs:
357
+ Added signature for changeset eef299ea1d29
358
+ [84718f122b7b]
359
+
360
+ * lib/configurability.rb, lib/configurability/config.rb,
361
+ spec/configurability/config_spec.rb:
362
+ Fix for config files with nil keys (fixes #1)
363
+ [eef299ea1d29]
364
+
365
+ * .hgsub, .hgsubstate, .hgsubstate, History.md, LICENSE, Manifest.txt,
366
+ README.md, Rakefile, project.yml:
367
+ Converted to Hoe.
368
+ [fb024df77138]
369
+
370
+ 2010-11-29 Michael Granger <ged@FaerieMUD.org>
371
+
279
372
  * .hgtags:
280
373
  Added tag v1.0.3 for changeset 910ae8ac082f
281
374
  [a2ae16f86c98]
@@ -317,6 +410,16 @@
317
410
  * Merged with 17:e2bf2e43bccf
318
411
  [17a6999c08b9]
319
412
 
413
+ 2010-08-08 Michael Granger <ged@FaerieMUD.org>
414
+
415
+ * .hgtags:
416
+ Added tag 1.0.1 for changeset e3605ccbe057
417
+ [4bff6d5f7b6e]
418
+
419
+ * .hgsigs:
420
+ Added signature for changeset 41bc1de0bf36
421
+ [e3605ccbe057] [1.0.1]
422
+
320
423
  2010-10-25 Michael Granger <ged@FaerieMUD.org>
321
424
 
322
425
  * lib/configurability/behavior.rb:
@@ -329,16 +432,6 @@
329
432
  Converted tests to RSpec 2.
330
433
  [5d18e28e387b]
331
434
 
332
- 2010-08-08 Michael Granger <ged@FaerieMUD.org>
333
-
334
- * .hgtags:
335
- Added tag 1.0.1 for changeset e3605ccbe057
336
- [4bff6d5f7b6e]
337
-
338
- * .hgsigs:
339
- Added signature for changeset 41bc1de0bf36
340
- [e3605ccbe057] [1.0.1]
341
-
342
435
  2010-08-04 Michael Granger <ged@FaerieMUD.org>
343
436
 
344
437
  * .hgignore, README.md, lib/configurability/config.rb,
data/History.rdoc CHANGED
@@ -1,3 +1,15 @@
1
+ == v2.0.0 [2013-01-30] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - Make missing Configurability::Config values return nil instead of
4
+ auto-vivifying to a Struct.
5
+
6
+ This is not a backward-compatible change, but in practice, far more
7
+ work was done to detect non-existant values than was saved by the
8
+ debatable convenience of being able to auto-create nested structs.
9
+
10
+ - Update to loggability 0.4 and add Rubinius (1.9-mode) fixes.
11
+
12
+
1
13
  == v1.2.0 [2012-05-09] Michael Granger <ged@FaerieMUD.org>
2
14
 
3
15
  - Added a command-line utility.
data/Rakefile CHANGED
@@ -8,12 +8,12 @@ end
8
8
 
9
9
 
10
10
  Hoe.plugin :mercurial
11
- Hoe.plugin :yard
12
11
  Hoe.plugin :signing
13
12
  Hoe.plugin :deveiate
14
13
 
15
14
  Hoe.plugins.delete :rubyforge
16
15
 
16
+ Encoding.default_internal = Encoding::UTF_8
17
17
 
18
18
  hoespec = Hoe.spec 'configurability' do
19
19
  self.readme_file = 'README.rdoc'
@@ -22,7 +22,7 @@ hoespec = Hoe.spec 'configurability' do
22
22
 
23
23
  self.developer 'Michael Granger', 'ged@FaerieMUD.org'
24
24
 
25
- self.dependency 'loggability', '~> 0.1'
25
+ self.dependency 'loggability', '~> 0.4'
26
26
 
27
27
  self.dependency 'rspec', '~> 2.4', :developer
28
28
  self.dependency 'simplecov', '~> 0.3', :developer
@@ -40,3 +40,10 @@ ENV['VERSION'] ||= hoespec.spec.version.to_s
40
40
  # Ensure the specs pass before checking in
41
41
  task 'hg:precheckin' => [ :check_history, :check_manifest, :spec ]
42
42
 
43
+
44
+ desc "Build a coverage report"
45
+ task :coverage do
46
+ ENV["COVERAGE"] = 'yes'
47
+ Rake::Task[:spec].invoke
48
+ end
49
+
data/bin/configurability CHANGED
@@ -286,7 +286,7 @@ class Configurability::Command
286
286
  def version_command( *args )
287
287
  message( "<%= color 'Version:', :header %> " + Configurability.version_string(true) )
288
288
  end
289
- help :version, "Prints the Ruby-Mongrel2 version."
289
+ help :version, "Prints the Configurability version."
290
290
 
291
291
 
292
292
  #
@@ -18,10 +18,10 @@ module Configurability
18
18
 
19
19
 
20
20
  # Library version constant
21
- VERSION = '1.2.0'
21
+ VERSION = '2.0.0'
22
22
 
23
23
  # Version-control revision constant
24
- REVISION = %q$Revision: 6b5e075386ee $
24
+ REVISION = %q$Revision: c4f53e99a024 $
25
25
 
26
26
  require 'configurability/deferredconfig'
27
27
 
@@ -352,7 +352,7 @@ class Configurability::Config
352
352
  # config values.
353
353
  Kernel.methods(false).each {|meth|
354
354
  next unless method_defined?( meth )
355
- next if /^(?:__|dup|object_id|inspect|class|raise|method_missing)/.match( meth )
355
+ next if /^(?:__|dup|object_id|inspect|class|raise|method_missing)/.match( meth.to_s )
356
356
  undef_method( meth )
357
357
  }
358
358
 
@@ -382,12 +382,8 @@ class Configurability::Config
382
382
  def []( key )
383
383
  key = key.untaint.to_sym if key.respond_to?( :to_sym )
384
384
 
385
- # Create the config struct on the fly for subsections
386
- if !@hash.key?( key )
387
- @hash[ key ] = self.class.new
388
- elsif @hash[ key ].is_a?( Hash )
389
- @hash[ key ] = self.class.new( @hash[key] )
390
- end
385
+ # Convert Hashes to Struct on the fly for subsections
386
+ @hash[ key ] = self.class.new( @hash[key] ) if @hash[ key ].is_a?( Hash )
391
387
 
392
388
  return @hash[ key ]
393
389
  end
@@ -24,7 +24,6 @@ require 'configurability/config'
24
24
  ### C O N T E X T S
25
25
  #####################################################################
26
26
  describe Configurability::Config do
27
- include Configurability::SpecHelpers
28
27
 
29
28
  TEST_CONFIG = %{
30
29
  ---
@@ -66,6 +65,8 @@ describe Configurability::Config do
66
65
 
67
66
  it "autogenerates accessors for non-existant struct members" do
68
67
  config = Configurability::Config.new
68
+ config.plugins ||= {}
69
+ config.plugins.filestore ||= {}
69
70
  config.plugins.filestore.maxsize = 1024
70
71
  config.plugins.filestore.maxsize.should == 1024
71
72
  end
@@ -51,6 +51,23 @@ describe Configurability::DeferredConfig do
51
51
  a_class.config_object.should == :testing_config
52
52
  end
53
53
 
54
+
55
+ it "includes defaults when configuring" do
56
+ config = { :testing => :testing_config }
57
+ Configurability.configure_objects( config )
58
+
59
+ a_class = Class.new do
60
+ extend Configurability::DeferredConfig
61
+ class << self; attr_accessor :config_object; end
62
+ def self::config_key; "testing"; end
63
+ def self::configure( config )
64
+ self.config_object = config
65
+ end
66
+ end
67
+
68
+ a_class.config_object.should == :testing_config
69
+ end
70
+
54
71
  end
55
72
 
56
73
  # vim: set nosta noet ts=4 sw=4:
@@ -23,7 +23,6 @@ require 'configurability/config'
23
23
  #####################################################################
24
24
 
25
25
  describe Configurability do
26
- include Configurability::SpecHelpers
27
26
 
28
27
  before( :all ) do
29
28
  setup_logging( :fatal )
@@ -261,9 +260,8 @@ describe Configurability do
261
260
  it "doesn't reconfigure objects that have already been configured unless the config changes" do
262
261
  first_objectclass = Class.new do
263
262
  extend Configurability
264
- @configs = []
265
263
  config_key :postconfig
266
- def self::configure( config ); @configs << config; end
264
+ def self::configure( config ); @configs ||= []; @configs << config; end
267
265
  def self::inherited( subclass ); subclass.instance_variable_set(:@configs, []); super; end
268
266
  class << self; attr_reader :configs; end
269
267
  end
@@ -271,13 +269,13 @@ describe Configurability do
271
269
  second_objectclass = Class.new( first_objectclass ) do
272
270
  extend Configurability
273
271
  config_key :postconfig
274
- def self::configure( config ); @configs << config; end
272
+ def self::configure( config ); @configs ||= []; @configs << config; end
275
273
  end
276
274
 
277
275
  third_objectclass = Class.new( second_objectclass ) do
278
276
  extend Configurability
279
277
  config_key :postconfig
280
- def self::configure( config ); @configs << config; end
278
+ def self::configure( config ); @configs ||= []; @configs << config; end
281
279
  end
282
280
 
283
281
  first_objectclass.configs.should == [ @config[:postconfig] ]
data/spec/lib/helpers.rb CHANGED
@@ -10,55 +10,26 @@ BEGIN {
10
10
  $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
11
11
  }
12
12
 
13
- require 'simplecov'
13
+ if ENV['COVERAGE']
14
+ warn "Coverage doesn't work so great under non-MRI interpreters." if RUBY_ENGINE != "ruby"
15
+ require 'simplecov'
16
+ SimpleCov.start { add_filter '/spec/' }
17
+ end
18
+
14
19
  require 'rspec'
15
20
 
16
21
  require 'logger'
17
22
  require 'erb'
18
23
  require 'yaml'
19
24
 
20
- SimpleCov.start do
21
- add_filter '/spec/'
22
- end
23
- require 'configurability'
24
-
25
-
26
- ### RSpec helper functions.
27
- module Configurability::SpecHelpers
28
-
29
- ###############
30
- module_function
31
- ###############
25
+ require 'loggability/spechelpers'
32
26
 
33
- ### Reset the logging subsystem to its default state.
34
- def reset_logging
35
- Loggability.formatter = nil
36
- Loggability.output_to( $stderr )
37
- Loggability.level = :fatal
38
- end
39
-
40
-
41
- ### Alter the output of the default log formatter to be pretty in SpecMate output
42
- def setup_logging( level=:fatal )
43
-
44
- # Only do this when executing from a spec in TextMate
45
- if ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\.rb/)
46
- logarray = []
47
- Thread.current['logger-output'] = logarray
48
- Loggability.output_to( logarray )
49
- Loggability.format_as( :html )
50
- Loggability.level = :debug
51
- else
52
- Loggability.level = level
53
- end
54
- end
55
-
56
- end
27
+ require 'configurability'
57
28
 
58
29
 
59
30
  RSpec.configure do |config|
60
31
  config.mock_with( :rspec )
61
- config.include( Configurability::SpecHelpers )
32
+ config.include( Loggability::SpecHelpers )
62
33
  config.treat_symbols_as_metadata_keys_with_true_values = true
63
34
 
64
35
  config.filter_run_excluding :only_ruby_19 if RUBY_VERSION < '1.9.2'
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: 1.2.0
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,7 +36,7 @@ cert_chain:
36
36
  YUhDS0xaZFNLai9SSHVUT3QrZ2JsUmV4OEZBaDhOZUEKY21saFhlNDZwWk5K
37
37
  Z1dLYnhaYWg4NWpJang5NWhSOHZPSStOQU01aUg5a09xSzEzRHJ4YWNUS1Bo
38
38
  cWo1UGp3RgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
39
- date: 2012-05-09 00:00:00.000000000 Z
39
+ date: 2013-02-18 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: loggability
@@ -45,7 +45,7 @@ dependencies:
45
45
  requirements:
46
46
  - - ~>
47
47
  - !ruby/object:Gem::Version
48
- version: '0.1'
48
+ version: '0.4'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
@@ -53,7 +53,7 @@ dependencies:
53
53
  requirements:
54
54
  - - ~>
55
55
  - !ruby/object:Gem::Version
56
- version: '0.1'
56
+ version: '0.4'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: hoe-mercurial
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -141,7 +141,7 @@ dependencies:
141
141
  requirements:
142
142
  - - ~>
143
143
  - !ruby/object:Gem::Version
144
- version: '3.0'
144
+ version: '3.5'
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
@@ -149,7 +149,7 @@ dependencies:
149
149
  requirements:
150
150
  - - ~>
151
151
  - !ruby/object:Gem::Version
152
- version: '3.0'
152
+ version: '3.5'
153
153
  description: ! 'Configurability is a unified, unintrusive, assume-nothing configuration
154
154
  system
155
155
 
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
213
  version: '0'
214
214
  requirements: []
215
215
  rubyforge_project: configurability
216
- rubygems_version: 1.8.24
216
+ rubygems_version: 1.8.25
217
217
  signing_key:
218
218
  specification_version: 3
219
219
  summary: Configurability is a unified, unintrusive, assume-nothing configuration system
metadata.gz.sig CHANGED
@@ -1 +1 @@
1
- A=��%���ۋc����M2V������J}2�qNCL5nW�]9��h ����;�5'Gg��lM!Ǝ ���k��q���0"��}F��� TTn^&fh+����r���<P���/��tG9�67!�t��0��c� sY�]� c�n��B!�„�a!Yc��>3�8W[ÅVIAD�}+��
1
+ xF6 ���� W:|:�������CJ:bx5������z)"i��z;�,���?�Vk|��W���Qu7�����p|�~����Ygcu�$�!�Sl$�\�DW�q�u7!8Gՙ���Fw�^/�RR�Xa� �&�:�q{W�E��O�ꪍ��>R�@�^Sy��8���絗Q��/����U���Qh�M-}`�Ә������f?/�� ��nx{4!�6���J�v'�$������>