configurability 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
@@ -1,2 +1 @@
1
- 3B���/�d2:�6��rqe�~z��s
2
- �)��A1�fQl��a⾡���,���}u�#��x�-#s���X*�M���Q��p?��]�GJ��Q%�}��ޢ���&%~�P��Y����"�T���\OgC���-m����~<�5Ԓw
1
+ #�Ы�݈�1O�0���@� #���U(��+�AvߜkU���!��, ���<��~�:[@ ��ߜ����}ߧBAϯ�¹����m-}����9��t]` d�K���t9BY�_�����?���
File without changes
@@ -0,0 +1,40 @@
1
+ ## 1.0.5 [2011-02-08] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Bugfixes:
4
+
5
+ * Now handles config files with nil keys correctly.
6
+
7
+
8
+ ## 1.0.4 [2010-11-29] Michael Granger <ged@FaerieMUD.org>
9
+
10
+ Packaging fix.
11
+
12
+
13
+ ## 1.0.3 [2010-11-29] Michael Granger <ged@FaerieMUD.org>
14
+
15
+ Enchancements:
16
+
17
+ * Propagate the installed config to objects that add Configurability after the
18
+ config is loaded.
19
+
20
+
21
+ ## 1.0.2 [2010-11-29] Michael Granger <ged@FaerieMUD.org>
22
+
23
+ Bugfixes:
24
+
25
+ * Fixes for specs under 1.9.2.
26
+
27
+
28
+ ## 1.0.1 [2010-08-08] Michael Granger <ged@FaerieMUD.org>
29
+
30
+ Enhancements:
31
+
32
+ * Adding a Configurability::Config class for YAML config loading.
33
+ * Add an rspec shared behavior for testing classes with Configurability
34
+ * Converted tests to RSpec 2.
35
+
36
+
37
+ ## 1.0.0 [2010-07-12] Michael Granger <ged@FaerieMUD.org>
38
+
39
+ Initial release
40
+
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010, Michael Granger
1
+ Copyright (c) 2010, 2011 Michael Granger
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
data/README.md CHANGED
@@ -1,10 +1,21 @@
1
1
  # Configurability
2
2
 
3
+ * http://bitbucket.org/ged/configurability
4
+
5
+
6
+ ## Description
7
+
3
8
  Configurability is a mixin that allows you to add configurability to one or
4
9
  more objects or classes. You can assign them each a subsection of the
5
10
  configuration, and then later, when the configuration is loaded, the
6
11
  configuration is split up and sent to the objects that will use it.
7
12
 
13
+
14
+ ## Installation
15
+
16
+ gem install configurability
17
+
18
+
8
19
  ## Usage
9
20
 
10
21
  To add configurability to a class, just require the library and extend
@@ -214,23 +225,23 @@ or write it back to the file it was loaded from:
214
225
  config.write
215
226
 
216
227
 
217
-
218
228
  ## Development
219
229
 
220
- You can submit bug reports, suggestions, and read more about future plans at
221
- the project page:
230
+ You can submit bug reports, suggestions, clone it with Mercurial, and read
231
+ more about future plans at [the project page][projectpage]. If you prefer Git,
232
+ there is also a [Github mirror][gitmirror].
222
233
 
223
- > http://bitbucket.org/ged/configurability
234
+ After checking out the source, run:
224
235
 
225
- or clone it with Mercurial from the same address. If you prefer Git, there is
226
- also a mirror of the repo on Github:
236
+ $ rake newb
227
237
 
228
- > https://github.com/ged/configurability
238
+ This task will install any missing dependencies, run the tests/specs,
239
+ and generate the API documentation.
229
240
 
230
241
 
231
242
  ## License
232
243
 
233
- Copyright (c) 2010, Michael Granger
244
+ Copyright (c) 2010, 2011 Michael Granger
234
245
  All rights reserved.
235
246
 
236
247
  Redistribution and use in source and binary forms, with or without
@@ -258,3 +269,7 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
258
269
  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
259
270
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
260
271
 
272
+
273
+ [projectpage]:http://bitbucket.org/ged/configurability
274
+ [gitmirror]:https://github.com/ged/configurability
275
+
data/Rakefile CHANGED
@@ -1,362 +1,88 @@
1
- #!rake -*- ruby -*-
2
- #
3
- # configurability rakefile
4
- #
5
- # Based on various other Rakefiles, especially one by Ben Bleything
6
- #
7
- # Copyright (c) 2007-2010 The FaerieMUD Consortium
8
- #
9
- # Authors:
10
- # * Michael Granger <ged@FaerieMUD.org>
11
- #
12
-
13
- BEGIN {
14
- require 'rbconfig'
15
- require 'pathname'
16
- basedir = Pathname.new( __FILE__ ).dirname
17
-
18
- libdir = basedir + "lib"
19
- extdir = libdir + Config::CONFIG['sitearch']
20
-
21
- $LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
22
- $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
23
- $LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
24
- }
1
+ #!/usr/bin/env rake
25
2
 
26
3
  begin
27
- require 'readline'
28
- include Readline
4
+ require 'hoe'
29
5
  rescue LoadError
30
- # Fall back to a plain prompt
31
- def readline( text )
32
- $stderr.print( text.chomp )
33
- return $stdin.gets
34
- end
35
- end
36
-
37
- begin
38
- require 'rubygems'
39
- rescue LoadError
40
- module Gem
41
- class Specification; end
42
- end
43
- end
44
-
45
- require 'pathname'
46
- require 'rbconfig'
47
- require 'rake'
48
- require 'rake/testtask'
49
- require 'rake/packagetask'
50
- require 'rake/clean'
51
- # require 'rake/191_compat.rb'
52
-
53
- $dryrun = false
54
-
55
- ### Config constants
56
- BASEDIR = Pathname.new( __FILE__ ).dirname.relative_path_from( Pathname.getwd )
57
- BINDIR = BASEDIR + 'bin'
58
- LIBDIR = BASEDIR + 'lib'
59
- EXTDIR = BASEDIR + 'ext'
60
- DOCSDIR = BASEDIR + 'docs'
61
- PKGDIR = BASEDIR + 'pkg'
62
- DATADIR = BASEDIR + 'data'
63
-
64
- MANUALDIR = DOCSDIR + 'manual'
65
-
66
- PROJECT_NAME = 'configurability'
67
- PKG_NAME = PROJECT_NAME.downcase
68
- PKG_SUMMARY = 'A configurability mixin for Ruby'
69
-
70
- # Cruisecontrol stuff
71
- CC_BUILD_LABEL = ENV['CC_BUILD_LABEL']
72
- CC_BUILD_ARTIFACTS = ENV['CC_BUILD_ARTIFACTS'] || 'artifacts'
73
-
74
- VERSION_FILE = LIBDIR + 'configurability.rb'
75
- if VERSION_FILE.exist? && buildrev = ENV['CC_BUILD_LABEL']
76
- PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] + '.' + buildrev
77
- elsif VERSION_FILE.exist?
78
- PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ]
6
+ abort "This Rakefile requires 'hoe' (gem install hoe)"
79
7
  end
80
8
 
81
- PKG_VERSION = '0.0.0' unless defined?( PKG_VERSION ) && !PKG_VERSION.nil?
82
9
 
83
- PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
84
- GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
10
+ Hoe.plugin :mercurial
11
+ Hoe.plugin :yard
12
+ Hoe.plugin :signing
85
13
 
86
- # Universal VCS constants
87
- DEFAULT_EDITOR = 'vi'
88
- COMMIT_MSG_FILE = 'commit-msg.txt'
89
- FILE_INDENT = " " * 12
90
- LOG_INDENT = " " * 3
14
+ Hoe.plugins.delete :rubyforge
91
15
 
92
- EXTCONF = EXTDIR + 'extconf.rb'
93
16
 
94
- ARTIFACTS_DIR = Pathname.new( CC_BUILD_ARTIFACTS )
17
+ hoespec = Hoe.spec 'configurability' do
18
+ self.readme_file = 'README.md'
19
+ self.history_file = 'History.md'
95
20
 
96
- TEXT_FILES = Rake::FileList.new( %w[Rakefile ChangeLog README* LICENSE] )
97
- BIN_FILES = Rake::FileList.new( "#{BINDIR}/*" )
98
- LIB_FILES = Rake::FileList.new( "#{LIBDIR}/**/*.rb" )
99
- EXT_FILES = Rake::FileList.new( "#{EXTDIR}/**/*.{c,h,rb}" )
100
- DATA_FILES = Rake::FileList.new( "#{DATADIR}/**/*" )
21
+ self.developer 'Michael Granger', 'ged@FaerieMUD.org'
101
22
 
102
- SPECDIR = BASEDIR + 'spec'
103
- SPECLIBDIR = SPECDIR + 'lib'
104
- SPEC_FILES = Rake::FileList.new( "#{SPECDIR}/**/*_spec.rb", "#{SPECLIBDIR}/**/*.rb" )
23
+ self.extra_dev_deps.push *{
24
+ 'rspec' => '~> 2.4',
25
+ }
105
26
 
106
- TESTDIR = BASEDIR + 'tests'
107
- TEST_FILES = Rake::FileList.new( "#{TESTDIR}/**/*.tests.rb" )
27
+ self.spec_extras[:licenses] = ["BSD"]
28
+ self.spec_extras[:post_install_message] = %{
108
29
 
109
- RAKE_TASKDIR = BASEDIR + 'rake'
110
- RAKE_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/*.rb" )
111
- PKG_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/{191_compat,helpers,packaging,rdoc,testing}.rb" )
112
- PKG_TASKLIBS.include( "#{RAKE_TASKDIR}/manual.rb" ) if MANUALDIR.exist?
30
+ New!
31
+
32
+ }.gsub( /^\t{2}/, '' )
113
33
 
114
- RAKE_TASKLIBS_URL = 'http://repo.deveiate.org/rake-tasklibs'
34
+ self.spec_extras[:signing_key] = '/Volumes/Keys/ged-private_gem_key.pem'
115
35
 
116
- LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local'
36
+ self.require_ruby_version( '>= 1.8.7' )
117
37
 
118
- EXTRA_PKGFILES = Rake::FileList.new
38
+ self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
39
+ self.yard_opts = [ '--protected', '--verbose' ] if self.respond_to?( :yard_opts= )
119
40
 
120
- RELEASE_FILES = TEXT_FILES +
121
- SPEC_FILES +
122
- TEST_FILES +
123
- BIN_FILES +
124
- LIB_FILES +
125
- EXT_FILES +
126
- DATA_FILES +
127
- RAKE_TASKLIBS +
128
- EXTRA_PKGFILES
129
-
130
-
131
- RELEASE_FILES << LOCAL_RAKEFILE.to_s if LOCAL_RAKEFILE.exist?
132
-
133
- RELEASE_ANNOUNCE_ADDRESSES = [
134
- "Ruby-Talk List <ruby-talk@ruby-lang.org>",
135
- ]
136
-
137
- COVERAGE_MINIMUM = ENV['COVERAGE_MINIMUM'] ? Float( ENV['COVERAGE_MINIMUM'] ) : 85.0
138
- RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib'
139
- RCOV_OPTS = [
140
- '--exclude', RCOV_EXCLUDES,
141
- '--xrefs',
142
- '--save',
143
- '--callsites',
144
- #'--aggregate', 'coverage.data' # <- doesn't work as of 0.8.1.2.0
145
- ]
146
-
147
-
148
- ### Load some task libraries that need to be loaded early
149
- if !RAKE_TASKDIR.exist?
150
- $stderr.puts "It seems you don't have the build task directory. Shall I fetch it "
151
- ans = readline( "for you? [y]" )
152
- ans = 'y' if !ans.nil? && ans.empty?
153
-
154
- if ans =~ /^y/i
155
- $stderr.puts "Okay, fetching #{RAKE_TASKLIBS_URL} into #{RAKE_TASKDIR}..."
156
- system 'hg', 'clone', RAKE_TASKLIBS_URL, "./#{RAKE_TASKDIR}"
157
- if ! $?.success?
158
- fail "Damn. That didn't work. Giving up; maybe try manually fetching?"
159
- end
160
- else
161
- $stderr.puts "Then I'm afraid I can't continue. Best of luck."
162
- fail "Rake tasklibs not present."
163
- end
164
-
165
- RAKE_TASKLIBS.include( "#{RAKE_TASKDIR}/*.rb" )
166
- end
167
-
168
- require RAKE_TASKDIR + 'helpers.rb'
169
- include RakefileHelpers
170
-
171
- # Set the build ID if the mercurial executable is available
172
- if hg = which( 'hg' )
173
- id = `#{hg} id -n`.chomp
174
- PKG_BUILD = (id.chomp[ /^[[:xdigit:]]+/ ] || '1')
175
- else
176
- PKG_BUILD = '0'
41
+ self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
177
42
  end
178
- SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}"
179
- SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
180
-
181
- # Documentation constants
182
- API_DOCSDIR = DOCSDIR + 'api'
183
- README_FILE = TEXT_FILES.find {|path| path =~ /^README/ } || 'README'
184
- RDOC_OPTIONS = [
185
- '--tab-width=4',
186
- '--show-hash',
187
- '--include', BASEDIR.to_s,
188
- "--main=#{README_FILE}",
189
- "--title=#{PKG_NAME}",
190
- ]
191
- YARD_OPTIONS = [
192
- '--use-cache',
193
- '--protected',
194
- '-r', README_FILE,
195
- '--exclude', 'extconf\\.rb',
196
- '--files', 'ChangeLog,LICENSE',
197
- '--output-dir', API_DOCSDIR.to_s,
198
- '--title', "#{PKG_NAME} #{PKG_VERSION}",
199
- ]
200
-
201
- # Release constants
202
- SMTP_HOST = "mail.faeriemud.org"
203
- SMTP_PORT = 465 # SMTP + SSL
204
-
205
- # Project constants
206
- PROJECT_HOST = 'deveiate.org'
207
- PROJECT_PUBDIR = '/usr/local/www/public/code'
208
- PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
209
- PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
210
- PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
211
-
212
- GEM_PUBHOST = 'rubygems.org'
213
43
 
214
- # Gem dependencies: gemname => version
215
- DEPENDENCIES = {
216
- }
44
+ ENV['VERSION'] ||= hoespec.spec.version.to_s
217
45
 
218
- # Developer Gem dependencies: gemname => version
219
- DEVELOPMENT_DEPENDENCIES = {
220
- 'rake' => '~> 0.8.7',
221
- 'rcodetools' => '~> 0.7.0.0',
222
- 'rcov' => '~> 0.8.1.2.0',
223
- 'yard' => '~> 0.6.1',
224
- 'RedCloth' => '~> 4.2.3',
225
- 'rspec' => '~> 2.0.1',
226
- 'ruby-termios' => '~> 0.9.6',
227
- 'text-format' => '~> 1.0.0',
228
- 'tmail' => '~> 1.2.3.1',
229
- }
46
+ # Ensure the specs pass before checking in
47
+ task 'hg:precheckin' => :spec
230
48
 
231
- # Non-gem requirements: packagename => version
232
- REQUIREMENTS = {
233
- }
234
-
235
- # RubyGem specification
236
- GEMSPEC = Gem::Specification.new do |gem|
237
- gem.name = PKG_NAME.downcase
238
- gem.version = PKG_VERSION
239
-
240
- gem.summary = PKG_SUMMARY
241
- gem.description = [
242
- "Configurability is a mixin that allows you to add ",
243
- "configurability to one or more classes, assign them ",
244
- "each a section of the configuration, and then when ",
245
- "the configuration is loaded, the class is given the ",
246
- "section it requested.",
247
- ].join( "\n" )
248
-
249
- gem.authors = ["Michael Granger"]
250
- gem.email = ["ged@FaerieMUD.org"]
251
- gem.homepage = 'http://bitbucket.org/ged/configurability'
252
- gem.licenses = ["BSD"]
253
-
254
- gem.has_rdoc = true
255
- gem.rdoc_options = RDOC_OPTIONS
256
- gem.extra_rdoc_files = TEXT_FILES - [ 'Rakefile' ]
257
-
258
- gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s
259
- gem.executables = BIN_FILES.select {|pn| File.executable?(pn) }.
260
- collect {|pn| File.basename(pn) }
261
- gem.require_paths << EXTDIR.relative_path_from( BASEDIR ).to_s if EXTDIR.exist?
262
-
263
- if EXTCONF.exist?
264
- gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s
265
- end
266
-
267
- gem.files = RELEASE_FILES
268
- gem.test_files = SPEC_FILES
269
-
270
- # signing key and certificate chain
271
- gem.signing_key = '/Volumes/Keys/ged-private_gem_key.pem'
272
- gem.cert_chain = [File.expand_path('~/.gem/ged-public_gem_cert.pem')]
273
-
274
-
275
- gem.required_ruby_version = '>= 1.8.7'
276
-
277
- DEPENDENCIES.each do |name, version|
278
- version = '>= 0' if version.length.zero?
279
- gem.add_runtime_dependency( name, version )
280
- end
281
-
282
- REQUIREMENTS.each do |name, version|
283
- gem.requirements << [ name, version ].compact.join(' ')
284
- end
285
- end
286
-
287
- $trace = Rake.application.options.trace ? true : false
288
- $dryrun = Rake.application.options.dryrun ? true : false
289
- $include_dev_dependencies = false
290
-
291
- # Load any remaining task libraries
292
- RAKE_TASKLIBS.each do |tasklib|
293
- next if tasklib.to_s =~ %r{/helpers\.rb$}
294
- begin
295
- trace " loading tasklib %s" % [ tasklib ]
296
- import tasklib
297
- rescue ScriptError => err
298
- fail "Task library '%s' failed to load: %s: %s" %
299
- [ tasklib, err.class.name, err.message ]
300
- trace "Backtrace: \n " + err.backtrace.join( "\n " )
301
- rescue => err
302
- log "Task library '%s' failed to load: %s: %s. Some tasks may not be available." %
303
- [ tasklib, err.class.name, err.message ]
304
- trace "Backtrace: \n " + err.backtrace.join( "\n " )
49
+ begin
50
+ include Hoe::MercurialHelpers
51
+
52
+ ### Task: prerelease
53
+ desc "Append the package build number to package versions"
54
+ task :pre do
55
+ rev = get_numeric_rev()
56
+ trace "Current rev is: %p" % [ rev ]
57
+ hoespec.spec.version.version << "pre#{rev}"
58
+ Rake::Task[:gem].clear
59
+
60
+ Gem::PackageTask.new( hoespec.spec ) do |pkg|
61
+ pkg.need_zip = true
62
+ pkg.need_tar = true
63
+ end
305
64
  end
306
- end
307
-
308
- # Load any project-specific rules defined in 'Rakefile.local' if it exists
309
- import LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
310
-
311
-
312
- #####################################################################
313
- ### T A S K S
314
- #####################################################################
315
-
316
- ### Default task
317
- task :default => [:clean, :local, :spec, :apidocs, :package]
318
65
 
319
- ### Task the local Rakefile can append to -- no-op by default
320
- task :local
321
-
322
- ### Task: clean
323
- CLEAN.include 'coverage', '**/*.orig', '**/*.rej'
324
- CLOBBER.include 'artifacts', 'coverage.info', 'ChangeLog', PKGDIR
325
-
326
- ### Task: changelog
327
- file 'ChangeLog' do |task|
328
- log "Updating #{task.name}"
329
-
330
- changelog = make_changelog()
331
- File.open( task.name, 'w' ) do |fh|
332
- fh.print( changelog )
66
+ ### Make the ChangeLog update if the repo has changed since it was last built
67
+ file '.hg/branch'
68
+ file 'ChangeLog' => '.hg/branch' do |task|
69
+ $stderr.puts "Updating the changelog..."
70
+ content = make_changelog()
71
+ File.open( task.name, 'w', 0644 ) do |fh|
72
+ fh.print( content )
73
+ end
333
74
  end
334
- end
335
-
336
75
 
337
- ### Task: cruise (Cruisecontrol task)
338
- desc "Cruisecontrol build"
339
- task :cruise => [:clean, 'spec:quiet', :package] do |task|
340
- raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty?
341
- artifact_dir = ARTIFACTS_DIR.cleanpath + (CC_BUILD_LABEL || Time.now.strftime('%Y%m%d-%T'))
342
- artifact_dir.mkpath
76
+ # Rebuild the ChangeLog immediately before release
77
+ task :prerelease => 'ChangeLog'
343
78
 
344
- coverage = BASEDIR + 'coverage'
345
- if coverage.exist? && coverage.directory?
346
- $stderr.puts "Copying coverage stats..."
347
- FileUtils.cp_r( 'coverage', artifact_dir )
79
+ rescue NameError => err
80
+ task :no_hg_helpers do
81
+ fail "Couldn't define the :pre task: %s: %s" % [ err.class.name, err.message ]
348
82
  end
349
83
 
350
- $stderr.puts "Copying packages..."
351
- FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir )
352
- end
353
-
84
+ task :pre => :no_hg_helpers
85
+ task 'ChangeLog' => :no_hg_helpers
354
86
 
355
- desc "Update the build system to the latest version"
356
- task :update_build do
357
- log "Updating the build system"
358
- run 'hg', '-R', RAKE_TASKDIR, 'pull', '-u'
359
- log "Updating the Rakefile"
360
- sh 'rake', '-f', RAKE_TASKDIR + 'Metarakefile'
361
87
  end
362
88