configurability 1.0.1 → 1.0.2
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.
- data.tar.gz.sig +0 -0
- data/ChangeLog +4 -4
- data/Rakefile +10 -2
- data/lib/configurability.rb +2 -2
- data/lib/configurability/behavior.rb +7 -7
- data/rake/documentation.rb +10 -1
- data/rake/hg.rb +6 -1
- data/rake/packaging.rb +1 -1
- data/rake/publishing.rb +158 -95
- data/rake/testing.rb +52 -88
- data/spec/configurability/config_spec.rb +2 -1
- data/spec/configurability_spec.rb +3 -1
- metadata +30 -5
- metadata.gz.sig +0 -0
data.tar.gz.sig
ADDED
Binary file
|
data/ChangeLog
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
17[tip]
|
2
|
-
|
1
|
+
17[tip] e2bf2e43bccf 2010-10-25 10:53 -0700 ged
|
2
|
+
Fixed require for RSpec 2 in the shared behavior.
|
3
3
|
|
4
|
-
16
|
5
|
-
|
4
|
+
16 5d18e28e387b 2010-10-25 10:48 -0700 ged
|
5
|
+
Converted tests to RSpec 2.
|
6
6
|
|
7
7
|
15 41bc1de0bf36 2010-08-04 18:51 -0700 ged
|
8
8
|
More Configurability::Config work
|
data/Rakefile
CHANGED
@@ -18,6 +18,7 @@ BEGIN {
|
|
18
18
|
libdir = basedir + "lib"
|
19
19
|
extdir = libdir + Config::CONFIG['sitearch']
|
20
20
|
|
21
|
+
$LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
|
21
22
|
$LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
|
22
23
|
$LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
|
23
24
|
}
|
@@ -169,9 +170,9 @@ include RakefileHelpers
|
|
169
170
|
# Set the build ID if the mercurial executable is available
|
170
171
|
if hg = which( 'hg' )
|
171
172
|
id = `#{hg} id -n`.chomp
|
172
|
-
PKG_BUILD =
|
173
|
+
PKG_BUILD = (id.chomp[ /^[[:xdigit:]]+/ ] || '1')
|
173
174
|
else
|
174
|
-
PKG_BUILD = '
|
175
|
+
PKG_BUILD = '0'
|
175
176
|
end
|
176
177
|
SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}"
|
177
178
|
SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
|
@@ -208,6 +209,8 @@ PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
|
|
208
209
|
PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
|
209
210
|
PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
|
210
211
|
|
212
|
+
GEM_PUBHOST = 'rubygems.org'
|
213
|
+
|
211
214
|
# Gem dependencies: gemname => version
|
212
215
|
DEPENDENCIES = {
|
213
216
|
}
|
@@ -264,6 +267,11 @@ GEMSPEC = Gem::Specification.new do |gem|
|
|
264
267
|
gem.files = RELEASE_FILES
|
265
268
|
gem.test_files = SPEC_FILES
|
266
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
|
+
|
267
275
|
DEPENDENCIES.each do |name, version|
|
268
276
|
version = '>= 0' if version.length.zero?
|
269
277
|
gem.add_runtime_dependency( name, version )
|
data/lib/configurability.rb
CHANGED
@@ -9,10 +9,10 @@ require 'yaml'
|
|
9
9
|
module Configurability
|
10
10
|
|
11
11
|
# Library version constant
|
12
|
-
VERSION = '1.0.
|
12
|
+
VERSION = '1.0.2'
|
13
13
|
|
14
14
|
# Version-control revision constant
|
15
|
-
REVISION = %q$Revision:
|
15
|
+
REVISION = %q$Revision: 17a6999c08b9 $
|
16
16
|
|
17
17
|
require 'configurability/logformatter.rb'
|
18
18
|
|
@@ -1,25 +1,25 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'configurability'
|
4
|
-
require '
|
4
|
+
require 'rspec'
|
5
5
|
|
6
6
|
share_examples_for "an object with Configurability" do
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
"instance variable" unless defined?( @object )
|
8
|
+
let( :config ) do
|
9
|
+
described_class
|
11
10
|
end
|
12
11
|
|
12
|
+
|
13
13
|
it "is extended with Configurability" do
|
14
|
-
Configurability.configurable_objects.should include(
|
14
|
+
Configurability.configurable_objects.should include( self.config )
|
15
15
|
end
|
16
16
|
|
17
17
|
it "has a Symbol config key" do
|
18
|
-
|
18
|
+
self.config.config_key.should be_a( Symbol )
|
19
19
|
end
|
20
20
|
|
21
21
|
it "has a config key that is a reasonable section name" do
|
22
|
-
|
22
|
+
self.config.config_key.to_s.should =~ /^[a-z][a-z0-9]*$/i
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
data/rake/documentation.rb
CHANGED
@@ -44,6 +44,7 @@ begin
|
|
44
44
|
end
|
45
45
|
|
46
46
|
class YARD::CLI::Base; include YardGlobals; end
|
47
|
+
class YARD::CLI::Command; include YardGlobals; end
|
47
48
|
class YARD::Parser::SourceParser; extend YardGlobals; include YardGlobals; end
|
48
49
|
class YARD::Parser::CParser; include YardGlobals; end
|
49
50
|
class YARD::CodeObjects::Base; include YardGlobals; end
|
@@ -53,6 +54,7 @@ begin
|
|
53
54
|
class YARD::RegistryStore; include YardGlobals; end
|
54
55
|
class YARD::Docstring; include YardGlobals; end
|
55
56
|
module YARD::Templates::Helpers::ModuleHelper; include YardGlobals; end
|
57
|
+
module YARD::Templates::Helpers::HtmlHelper; include YardGlobals; end
|
56
58
|
|
57
59
|
if vvec(RUBY_VERSION) >= vvec("1.9.1")
|
58
60
|
# Monkeypatched to allow more than two '#' characters at the beginning
|
@@ -61,8 +63,15 @@ begin
|
|
61
63
|
require 'yard/parser/ruby/ruby_parser'
|
62
64
|
class YARD::Parser::Ruby::RipperParser < Ripper
|
63
65
|
def on_comment(comment)
|
64
|
-
$stderr.puts "Adding comment: %p" % [ comment ]
|
65
66
|
visit_ns_token(:comment, comment)
|
67
|
+
case comment
|
68
|
+
when /\A# @group\s+(.+)\s*\Z/
|
69
|
+
@groups.unshift [lineno, $1]
|
70
|
+
return
|
71
|
+
when /\A# @endgroup\s*\Z/
|
72
|
+
@groups.unshift [lineno, nil]
|
73
|
+
return
|
74
|
+
end
|
66
75
|
|
67
76
|
comment = comment.gsub(/^\#+\s{0,1}/, '').chomp
|
68
77
|
append_comment = @comments[lineno - 1]
|
data/rake/hg.rb
CHANGED
@@ -249,13 +249,18 @@ unless defined?( HG_DOTDIR )
|
|
249
249
|
paths = get_repo_paths()
|
250
250
|
if origin_url = paths['default']
|
251
251
|
ask_for_confirmation( "Push to '#{origin_url}'?", false ) do
|
252
|
-
|
252
|
+
Rake::Task['hg:push_without_confirmation'].invoke
|
253
253
|
end
|
254
254
|
else
|
255
255
|
trace "Skipping push: No 'default' path."
|
256
256
|
end
|
257
257
|
end
|
258
258
|
|
259
|
+
desc "Push to the default repo without confirmation"
|
260
|
+
task :push_without_confirmation do
|
261
|
+
run 'hg', 'push'
|
262
|
+
end
|
263
|
+
|
259
264
|
end
|
260
265
|
|
261
266
|
if HG_DOTDIR.exist?
|
data/rake/packaging.rb
CHANGED
@@ -12,7 +12,7 @@ include Config
|
|
12
12
|
### Task: prerelease
|
13
13
|
desc "Append the package build number to package versions"
|
14
14
|
task :prerelease do
|
15
|
-
GEMSPEC.version.version << ".#{PKG_BUILD}"
|
15
|
+
GEMSPEC.version.version << ".pre.#{PKG_BUILD}"
|
16
16
|
Rake::Task[:gem].clear
|
17
17
|
|
18
18
|
Gem::PackageTask.new( GEMSPEC ) do |pkg|
|
data/rake/publishing.rb
CHANGED
@@ -5,6 +5,8 @@
|
|
5
5
|
RELEASE_NOTES_FILE = 'release.notes'
|
6
6
|
RELEASE_ANNOUNCE_FILE = 'release.ann'
|
7
7
|
|
8
|
+
GEM_PUBHOST = '' unless defined?( GEM_PUBHOST )
|
9
|
+
|
8
10
|
require 'net/smtp'
|
9
11
|
require 'net/protocol'
|
10
12
|
require 'openssl'
|
@@ -13,6 +15,7 @@ $publish_privately = false
|
|
13
15
|
|
14
16
|
### Add SSL to Net::SMTP
|
15
17
|
class Net::SMTP
|
18
|
+
|
16
19
|
def ssl_start( helo='localhost.localdomain', user=nil, secret=nil, authtype=nil )
|
17
20
|
if block_given?
|
18
21
|
begin
|
@@ -93,6 +96,9 @@ begin
|
|
93
96
|
require 'etc'
|
94
97
|
require 'socket'
|
95
98
|
require 'text/format'
|
99
|
+
require 'rubygems/gemcutter_utilities'
|
100
|
+
|
101
|
+
include Gem::GemcutterUtilities
|
96
102
|
|
97
103
|
### Generate a valid RFC822 message-id
|
98
104
|
def gen_message_id
|
@@ -104,6 +110,48 @@ begin
|
|
104
110
|
end
|
105
111
|
|
106
112
|
|
113
|
+
### Fetch the rubygems API token if it hasn't been already.
|
114
|
+
def sign_in_to_rubygems
|
115
|
+
return if Gem.configuration.rubygems_api_key
|
116
|
+
|
117
|
+
log "Enter your RubyGems.org credentials."
|
118
|
+
|
119
|
+
email = prompt " Email: "
|
120
|
+
password = prompt_for_password( "Password: " )
|
121
|
+
|
122
|
+
response = rubygems_api_request( :get, "api/v1/api_key" ) do |request|
|
123
|
+
request.basic_auth( email, password )
|
124
|
+
end
|
125
|
+
|
126
|
+
with_response( response ) do |resp|
|
127
|
+
log "Signed in."
|
128
|
+
Gem.configuration.rubygems_api_key = resp.body
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
|
133
|
+
### Push the gem at the specified +path+ to the rubygems server at +gemhost+.
|
134
|
+
def push_gem( path, gemhost )
|
135
|
+
ENV['RUBYGEMS_HOST'] = "http://#{gemhost}"
|
136
|
+
|
137
|
+
sign_in_to_rubygems()
|
138
|
+
|
139
|
+
response = rubygems_api_request( :post, "api/v1/gems" ) do |request|
|
140
|
+
request.body = Gem.read_binary( path )
|
141
|
+
request.add_field "Content-Length", request.body.size
|
142
|
+
request.add_field "Content-Type", "application/octet-stream"
|
143
|
+
request.add_field "Authorization", Gem.configuration.rubygems_api_key
|
144
|
+
end
|
145
|
+
|
146
|
+
case response
|
147
|
+
when Net::HTTPSuccess
|
148
|
+
log( response.body )
|
149
|
+
else
|
150
|
+
fail( response.body )
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
|
107
155
|
namespace :release do
|
108
156
|
task :default => [ :prep_release, :upload, :publish, :announce ]
|
109
157
|
|
@@ -133,124 +181,138 @@ begin
|
|
133
181
|
end
|
134
182
|
CLOBBER.include( RELEASE_NOTES_FILE )
|
135
183
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
184
|
+
# Only define upload tasks if there's an upload host
|
185
|
+
if PROJECT_HOST.empty?
|
186
|
+
task :no_upload_host do
|
187
|
+
log "Skipping upload: no upload host."
|
188
|
+
end
|
189
|
+
task :upload => :no_upload_host
|
190
|
+
task :upload_docs => :no_upload_host
|
191
|
+
task :upload_packages => :no_upload_host
|
192
|
+
else
|
193
|
+
desc "Upload project documentation and packages to #{PROJECT_HOST}"
|
194
|
+
task :upload => [ :upload_docs, :upload_packages ]
|
195
|
+
task :project => :upload # the old name
|
196
|
+
|
197
|
+
desc "Publish the project docs to #{PROJECT_HOST}"
|
198
|
+
task :upload_docs => [ :apidocs ] do
|
199
|
+
when_writing( "Publishing docs to #{PROJECT_SCPDOCURL}" ) do
|
200
|
+
log "Uploading API documentation to %s:%s" % [ PROJECT_HOST, PROJECT_DOCDIR ]
|
201
|
+
run 'ssh', PROJECT_HOST, "rm -rf #{PROJECT_DOCDIR}"
|
202
|
+
run 'scp', '-qCr', API_DOCSDIR, PROJECT_SCPDOCURL
|
203
|
+
end
|
147
204
|
end
|
148
|
-
end
|
149
205
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
206
|
+
desc "Publish the project packages to #{PROJECT_HOST}"
|
207
|
+
task :upload_packages => [ :package ] do
|
208
|
+
when_writing( "Uploading packages") do
|
209
|
+
pkgs = Pathname.glob( PKGDIR + "#{PKG_FILE_NAME}.{gem,tar.gz,tar.bz2,zip}" )
|
210
|
+
log "Uploading %d packages to #{PROJECT_SCPPUBURL}" % [ pkgs.length ]
|
211
|
+
pkgs.each do |pkgfile|
|
212
|
+
run 'scp', '-qC', pkgfile, PROJECT_SCPPUBURL
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
159
216
|
end
|
160
217
|
|
218
|
+
# Only define the announcement tasks if there are addresses to announce to
|
219
|
+
if RELEASE_ANNOUNCE_ADDRESSES.empty?
|
220
|
+
task :no_announce_addresses do
|
221
|
+
log "Skipping announcement: no announce addresses"
|
222
|
+
end
|
223
|
+
task :announce => :no_announce_addresses
|
161
224
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
Version #{PKG_VERSION} of #{PKG_NAME} has been released.
|
167
|
-
|
168
|
-
#{Text::Format.new(:first_indent => 0).format_one_paragraph(GEMSPEC.description)}
|
169
|
-
|
170
|
-
== Project Page
|
171
|
-
|
172
|
-
#{GEMSPEC.homepage}
|
225
|
+
else
|
226
|
+
file RELEASE_ANNOUNCE_FILE => [RELEASE_NOTES_FILE] do |task|
|
227
|
+
relnotes = File.read( RELEASE_NOTES_FILE )
|
228
|
+
announce_body = %{
|
173
229
|
|
174
|
-
|
230
|
+
Version #{PKG_VERSION} of #{PKG_NAME} has been released.
|
175
231
|
|
176
|
-
|
232
|
+
#{Text::Format.new(:first_indent => 0).format_one_paragraph(GEMSPEC.description)}
|
177
233
|
|
178
|
-
|
234
|
+
== Project Page
|
179
235
|
|
180
|
-
|
236
|
+
#{GEMSPEC.homepage}
|
181
237
|
|
182
|
-
|
183
|
-
$ tar -xzvf #{PKG_FILE_NAME}.tar.gz
|
184
|
-
$ cd #{PKG_FILE_NAME}
|
185
|
-
$ sudo rake install
|
238
|
+
== Installation
|
186
239
|
|
187
|
-
|
188
|
-
#{relnotes}
|
189
|
-
}.gsub( /^\t+/, '' )
|
240
|
+
$ sudo gem install #{GEMSPEC.name}
|
190
241
|
|
191
|
-
|
192
|
-
|
193
|
-
|
242
|
+
== Changes
|
243
|
+
#{relnotes}
|
244
|
+
}.gsub( /^\t+/, '' )
|
194
245
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
desc 'Send out a release announcement'
|
201
|
-
task :announce => [RELEASE_ANNOUNCE_FILE] do
|
202
|
-
email = TMail::Mail.new
|
246
|
+
File.open( task.name, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
|
247
|
+
fh.print( announce_body )
|
248
|
+
end
|
203
249
|
|
204
|
-
|
205
|
-
trace "Sending private announce mail"
|
206
|
-
email.to = 'rubymage@gmail.com'
|
207
|
-
else
|
208
|
-
trace "Sending public announce mail"
|
209
|
-
email.to = RELEASE_ANNOUNCE_ADDRESSES
|
210
|
-
email.bcc = 'rubymage@gmail.com'
|
250
|
+
edit task.name
|
211
251
|
end
|
252
|
+
CLOBBER.include( RELEASE_ANNOUNCE_FILE )
|
212
253
|
|
213
|
-
from = prompt_with_default( "Send announcement as:",
|
214
|
-
'Michael Granger <ged@FaerieMUD.org>' ) or fail
|
215
|
-
|
216
|
-
email.from = from
|
217
|
-
email.subject = "[ANN] #{PKG_NAME} #{PKG_VERSION}"
|
218
|
-
email.body = File.read( RELEASE_ANNOUNCE_FILE )
|
219
|
-
email.date = Time.new
|
220
|
-
|
221
|
-
email.message_id = gen_message_id()
|
222
254
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
'---'
|
255
|
+
desc 'Send out a release announcement'
|
256
|
+
task :announce => [RELEASE_ANNOUNCE_FILE] do
|
257
|
+
email = TMail::Mail.new
|
227
258
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
smtp.set_debug_output( $stdout )
|
237
|
-
smtp.esmtp = true
|
259
|
+
if $publish_privately || RELEASE_ANNOUNCE_ADDRESSES.empty?
|
260
|
+
trace "Sending private announce mail"
|
261
|
+
email.to = 'rubymage@gmail.com'
|
262
|
+
else
|
263
|
+
trace "Sending public announce mail"
|
264
|
+
email.to = RELEASE_ANNOUNCE_ADDRESSES
|
265
|
+
email.bcc = 'rubymage@gmail.com'
|
266
|
+
end
|
238
267
|
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
268
|
+
from = prompt_with_default( "Send announcement as:",
|
269
|
+
'Michael Granger <ged@FaerieMUD.org>' ) or fail
|
270
|
+
|
271
|
+
email.from = from
|
272
|
+
email.subject = "[ANN] #{PKG_NAME} #{PKG_VERSION}"
|
273
|
+
email.body = File.read( RELEASE_ANNOUNCE_FILE )
|
274
|
+
email.date = Time.new
|
275
|
+
|
276
|
+
email.message_id = gen_message_id()
|
277
|
+
|
278
|
+
log "About to send the following email:"
|
279
|
+
puts '---',
|
280
|
+
email.to_s,
|
281
|
+
'---'
|
282
|
+
|
283
|
+
ask_for_confirmation( "Will send via #{SMTP_HOST}." ) do
|
284
|
+
pwent = Etc.getpwuid( Process.euid )
|
285
|
+
curuser = pwent ? pwent.name : 'unknown'
|
286
|
+
username = prompt_with_default( "SMTP user", curuser )
|
287
|
+
password = prompt_for_password()
|
288
|
+
|
289
|
+
trace "Creating SMTP connection to #{SMTP_HOST}:#{SMTP_PORT}"
|
290
|
+
smtp = Net::SMTP.new( SMTP_HOST, SMTP_PORT )
|
291
|
+
smtp.set_debug_output( $stdout )
|
292
|
+
smtp.esmtp = true
|
293
|
+
|
294
|
+
trace "connecting..."
|
295
|
+
smtp.ssl_start( Socket.gethostname, username, password, :plain ) do |smtp|
|
296
|
+
trace "sending message..."
|
297
|
+
smtp.send_message( email.to_s, email.from, email.to )
|
298
|
+
end
|
299
|
+
trace "done."
|
243
300
|
end
|
244
|
-
trace "done."
|
245
301
|
end
|
246
302
|
end
|
247
303
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
304
|
+
if GEM_PUBHOST.empty?
|
305
|
+
task :no_gem_host do
|
306
|
+
log "Skipping gem push: no gem publication host."
|
307
|
+
end
|
308
|
+
task :publish => :no_gem_host
|
309
|
+
else
|
310
|
+
desc 'Publish the new gem to #{GEM_PUBHOST}'
|
311
|
+
task :publish => [:clean, :gem, :notes] do |task|
|
312
|
+
ask_for_confirmation( "Publish #{GEM_FILE_NAME} to #{GEM_PUBHOST}?", false ) do
|
313
|
+
gempath = PKGDIR + GEM_FILE_NAME
|
314
|
+
push_gem( gempath, GEM_PUBHOST )
|
315
|
+
end
|
254
316
|
end
|
255
317
|
end
|
256
318
|
end
|
@@ -266,6 +328,7 @@ rescue LoadError => err
|
|
266
328
|
end
|
267
329
|
|
268
330
|
task :release => :no_release_tasks
|
331
|
+
task "release:rerelease" => :no_release_tasks
|
269
332
|
task "release:announce" => :no_release_tasks
|
270
333
|
task "release:publish" => :no_release_tasks
|
271
334
|
task "release:notes" => :no_release_tasks
|
data/rake/testing.rb
CHANGED
@@ -16,7 +16,7 @@ end
|
|
16
16
|
SPEC_FILES = [] unless defined?( SPEC_FILES )
|
17
17
|
TEST_FILES = [] unless defined?( TEST_FILES )
|
18
18
|
|
19
|
-
|
19
|
+
COMMON_RSPEC_OPTS = [] unless defined?( COMMON_RSPEC_OPTS )
|
20
20
|
|
21
21
|
COVERAGE_TARGETDIR = BASEDIR + 'coverage' unless defined?( COVERAGE_TARGETDIR )
|
22
22
|
RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib' unless
|
@@ -39,10 +39,10 @@ end
|
|
39
39
|
|
40
40
|
### RSpec specifications
|
41
41
|
begin
|
42
|
-
gem 'rspec', '>=
|
42
|
+
gem 'rspec', '>= 2.0.0'
|
43
43
|
|
44
|
-
require '
|
45
|
-
require '
|
44
|
+
require 'rspec'
|
45
|
+
require 'rspec/core/rake_task'
|
46
46
|
|
47
47
|
### Task: spec
|
48
48
|
desc "Run specs"
|
@@ -51,137 +51,101 @@ begin
|
|
51
51
|
namespace :spec do
|
52
52
|
desc "Run rspec every time there's a change to one of the files"
|
53
53
|
task :autotest do
|
54
|
-
require 'autotest
|
55
|
-
|
56
|
-
|
57
|
-
autotester.run
|
54
|
+
require 'autotest'
|
55
|
+
Autotest.add_discovery { "rspec2" }
|
56
|
+
Autotest.run
|
58
57
|
end
|
59
58
|
|
60
59
|
desc "Generate regular color 'doc' spec output"
|
61
|
-
|
62
|
-
task.
|
63
|
-
task.spec_opts = COMMON_SPEC_OPTS + ['-f', 's', '-c']
|
60
|
+
RSpec::Core::RakeTask.new( :doc ) do |task|
|
61
|
+
task.rspec_opts = COMMON_RSPEC_OPTS + ['-f', 'd', '-c']
|
64
62
|
end
|
65
63
|
|
66
64
|
desc "Generate spec output with profiling"
|
67
|
-
|
68
|
-
task.
|
69
|
-
task.spec_opts = COMMON_SPEC_OPTS + ['-f', 'o']
|
65
|
+
RSpec::Core::RakeTask.new( :profile ) do |task|
|
66
|
+
task.rspec_opts = COMMON_RSPEC_OPTS + ['-f', 'p', '-p']
|
70
67
|
end
|
71
68
|
|
72
69
|
desc "Generate quiet non-colored plain-text output"
|
73
|
-
|
74
|
-
task.
|
75
|
-
task.spec_opts = COMMON_SPEC_OPTS + ['-f', 'p']
|
70
|
+
RSpec::Core::RakeTask.new( :quiet ) do |task|
|
71
|
+
task.rspec_opts = COMMON_RSPEC_OPTS + ['-f', 'p']
|
76
72
|
end
|
77
73
|
|
78
74
|
desc "Generate HTML output"
|
79
|
-
|
80
|
-
task.
|
81
|
-
task.spec_opts = COMMON_SPEC_OPTS + ['-f', 'h']
|
75
|
+
RSpec::Core::RakeTask.new( :html ) do |task|
|
76
|
+
task.rspec_opts = COMMON_RSPEC_OPTS + ['-f', 'h']
|
82
77
|
end
|
83
78
|
|
84
|
-
end
|
85
|
-
rescue LoadError => err
|
86
|
-
task :no_rspec do
|
87
|
-
$stderr.puts "Specification tasks not defined: %s" % [ err.message ]
|
88
|
-
end
|
89
|
-
|
90
|
-
task :spec => :no_rspec
|
91
|
-
namespace :spec do
|
92
|
-
task :autotest => :no_rspec
|
93
|
-
task :doc => :no_rspec
|
94
|
-
task :profile => :no_rspec
|
95
|
-
task :quiet => :no_rspec
|
96
|
-
task :html => :no_rspec
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
|
101
|
-
### Test::Unit tests
|
102
|
-
begin
|
103
|
-
require 'rake/testtask'
|
104
|
-
|
105
|
-
Rake::TestTask.new( :unittests ) do |task|
|
106
|
-
task.libs += [LIBDIR]
|
107
|
-
task.test_files = TEST_FILES
|
108
|
-
task.verbose = true
|
109
|
-
end
|
110
79
|
|
111
|
-
rescue LoadError => err
|
112
|
-
task :no_test do
|
113
|
-
$stderr.puts "Test tasks not defined: %s" % [ err.message ]
|
114
80
|
end
|
115
81
|
|
116
|
-
task :unittests => :no_rspec
|
117
|
-
end
|
118
|
-
|
119
|
-
|
120
|
-
### RCov (via RSpec) tasks
|
121
|
-
begin
|
122
|
-
gem 'rcov'
|
123
|
-
gem 'rspec', '>= 1.1.3'
|
124
|
-
|
125
|
-
require 'spec'
|
126
|
-
require 'rcov'
|
127
|
-
|
128
82
|
### Task: coverage (via RCov)
|
129
83
|
desc "Build test coverage reports"
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
task.rcov_opts = RCOV_OPTS
|
136
|
-
task.rcov = true
|
137
|
-
end
|
84
|
+
RSpec::Core::RakeTask.new( :coverage ) do |task|
|
85
|
+
task.ruby_opts = [ "-I#{LIBDIR}" ]
|
86
|
+
task.rspec_opts = ['-f', 'p', '-b']
|
87
|
+
task.rcov_opts = RCOV_OPTS
|
88
|
+
task.rcov = true
|
138
89
|
end
|
139
90
|
|
140
|
-
|
141
91
|
### Task: rcov
|
142
92
|
task :rcov => :coverage
|
143
93
|
|
144
94
|
### Other coverage tasks
|
145
95
|
namespace :coverage do
|
146
96
|
desc "Generate a detailed text coverage report"
|
147
|
-
|
148
|
-
task.spec_files = SPEC_FILES
|
97
|
+
RSpec::Core::RakeTask.new( :text ) do |task|
|
149
98
|
task.rcov_opts = RCOV_OPTS + ['--text-report']
|
150
99
|
task.rcov = true
|
151
100
|
end
|
152
101
|
|
153
102
|
desc "Show differences in coverage from last run"
|
154
|
-
|
155
|
-
task.
|
156
|
-
task.spec_opts = ['-f', 'p', '-b']
|
103
|
+
RSpec::Core::RakeTask.new( :diff ) do |task|
|
104
|
+
task.rspec_opts = ['-f', 'p', '-b']
|
157
105
|
task.rcov_opts = RCOV_OPTS - ['--save'] + ['--text-coverage-diff']
|
158
106
|
task.rcov = true
|
159
107
|
end
|
160
108
|
|
161
109
|
desc "Run RCov in 'spec-only' mode to check coverage from specs"
|
162
|
-
|
163
|
-
task.spec_files = SPEC_FILES
|
110
|
+
RSpec::Core::RakeTask.new( :speconly ) do |task|
|
164
111
|
task.rcov_opts = ['--exclude', RCOV_EXCLUDES, '--text-report', '--save']
|
165
112
|
task.rcov = true
|
166
113
|
end
|
167
114
|
end
|
168
115
|
|
169
116
|
CLOBBER.include( COVERAGE_TARGETDIR )
|
170
|
-
|
171
117
|
rescue LoadError => err
|
172
|
-
task :
|
173
|
-
$stderr.puts "
|
174
|
-
[ err.message ]
|
118
|
+
task :no_rspec do
|
119
|
+
$stderr.puts "Specification tasks not defined: %s" % [ err.message ]
|
175
120
|
end
|
176
121
|
|
177
|
-
task :
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
task :
|
182
|
-
task :
|
122
|
+
task :spec => :no_rspec
|
123
|
+
namespace :spec do
|
124
|
+
task :autotest => :no_rspec
|
125
|
+
task :doc => :no_rspec
|
126
|
+
task :profile => :no_rspec
|
127
|
+
task :quiet => :no_rspec
|
128
|
+
task :html => :no_rspec
|
183
129
|
end
|
184
|
-
|
130
|
+
end
|
131
|
+
|
132
|
+
|
133
|
+
### Test::Unit tests
|
134
|
+
begin
|
135
|
+
require 'rake/testtask'
|
136
|
+
|
137
|
+
Rake::TestTask.new( :unittests ) do |task|
|
138
|
+
task.libs += [LIBDIR]
|
139
|
+
task.test_files = TEST_FILES
|
140
|
+
task.verbose = true
|
141
|
+
end
|
142
|
+
|
143
|
+
rescue LoadError => err
|
144
|
+
task :no_test do
|
145
|
+
$stderr.puts "Test tasks not defined: %s" % [ err.message ]
|
146
|
+
end
|
147
|
+
|
148
|
+
task :unittests => :no_rspec
|
185
149
|
end
|
186
150
|
|
187
151
|
|
@@ -6,14 +6,15 @@ BEGIN {
|
|
6
6
|
|
7
7
|
libdir = basedir + "lib"
|
8
8
|
|
9
|
+
$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
|
9
10
|
$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
|
10
11
|
}
|
11
12
|
|
12
13
|
require 'tempfile'
|
13
14
|
require 'logger'
|
14
15
|
require 'fileutils'
|
16
|
+
require 'rspec'
|
15
17
|
|
16
|
-
require 'spec'
|
17
18
|
require 'spec/lib/helpers'
|
18
19
|
|
19
20
|
require 'configurability/config'
|
@@ -6,10 +6,12 @@ BEGIN {
|
|
6
6
|
|
7
7
|
libdir = basedir + "lib"
|
8
8
|
|
9
|
+
$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
|
9
10
|
$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
|
10
11
|
}
|
11
12
|
|
12
|
-
require '
|
13
|
+
require 'rspec'
|
14
|
+
|
13
15
|
require 'spec/lib/helpers'
|
14
16
|
|
15
17
|
require 'configurability'
|
metadata
CHANGED
@@ -1,20 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configurability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Michael Granger
|
13
14
|
autorequire:
|
14
15
|
bindir: bin
|
15
|
-
cert_chain:
|
16
|
+
cert_chain:
|
17
|
+
- |
|
18
|
+
-----BEGIN CERTIFICATE-----
|
19
|
+
MIIDLDCCAhSgAwIBAgIBADANBgkqhkiG9w0BAQUFADA8MQwwCgYDVQQDDANnZWQx
|
20
|
+
FzAVBgoJkiaJk/IsZAEZFgdfYWVyaWVfMRMwEQYKCZImiZPyLGQBGRYDb3JnMB4X
|
21
|
+
DTEwMDkxNjE0NDg1MVoXDTExMDkxNjE0NDg1MVowPDEMMAoGA1UEAwwDZ2VkMRcw
|
22
|
+
FQYKCZImiZPyLGQBGRYHX2FlcmllXzETMBEGCgmSJomT8ixkARkWA29yZzCCASIw
|
23
|
+
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALy//BFxC1f/cPSnwtJBWoFiFrir
|
24
|
+
h7RicI+joq/ocVXQqI4TDWPyF/8tqkvt+rD99X9qs2YeR8CU/YiIpLWrQOYST70J
|
25
|
+
vDn7Uvhb2muFVqq6+vobeTkILBEO6pionWDG8jSbo3qKm1RjKJDwg9p4wNKhPuu8
|
26
|
+
KGue/BFb67KflqyApPmPeb3Vdd9clspzqeFqp7cUBMEpFS6LWxy4Gk+qvFFJBJLB
|
27
|
+
BUHE/LZVJMVzfpC5Uq+QmY7B+FH/QqNndn3tOHgsPadLTNimuB1sCuL1a4z3Pepd
|
28
|
+
TeLBEFmEao5Dk3K/Q8o8vlbIB/jBDTUx6Djbgxw77909x6gI9doU4LD5XMcCAwEA
|
29
|
+
AaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJeoGkOr9l4B
|
30
|
+
+saMkW/ZXT4UeSvVMA0GCSqGSIb3DQEBBQUAA4IBAQBG2KObvYI2eHyyBUJSJ3jN
|
31
|
+
vEnU3d60znAXbrSd2qb3r1lY1EPDD3bcy0MggCfGdg3Xu54z21oqyIdk8uGtWBPL
|
32
|
+
HIa9EgfFGSUEgvcIvaYqiN4jTUtidfEFw+Ltjs8AP9gWgSIYS6Gr38V0WGFFNzIH
|
33
|
+
aOD2wmu9oo/RffW4hS/8GuvfMzcw7CQ355wFR4KB/nyze+EsZ1Y5DerCAagMVuDQ
|
34
|
+
U0BLmWDFzPGGWlPeQCrYHCr+AcJz+NRnaHCKLZdSKj/RHuTOt+gblRex8FAh8NeA
|
35
|
+
cmlhXe46pZNJgWKbxZah85jIjx95hR8vOI+NAM5iH9kOqK13DrxacTKPhqj5PjwF
|
36
|
+
-----END CERTIFICATE-----
|
16
37
|
|
17
|
-
date: 2010-
|
38
|
+
date: 2010-10-29 00:00:00 -07:00
|
18
39
|
default_executable:
|
19
40
|
dependencies: []
|
20
41
|
|
@@ -73,23 +94,27 @@ rdoc_options:
|
|
73
94
|
require_paths:
|
74
95
|
- lib
|
75
96
|
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
76
98
|
requirements:
|
77
99
|
- - ">="
|
78
100
|
- !ruby/object:Gem::Version
|
101
|
+
hash: 3
|
79
102
|
segments:
|
80
103
|
- 0
|
81
104
|
version: "0"
|
82
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
83
107
|
requirements:
|
84
108
|
- - ">="
|
85
109
|
- !ruby/object:Gem::Version
|
110
|
+
hash: 3
|
86
111
|
segments:
|
87
112
|
- 0
|
88
113
|
version: "0"
|
89
114
|
requirements: []
|
90
115
|
|
91
116
|
rubyforge_project:
|
92
|
-
rubygems_version: 1.3.
|
117
|
+
rubygems_version: 1.3.7
|
93
118
|
signing_key:
|
94
119
|
specification_version: 3
|
95
120
|
summary: A configurability mixin for Ruby
|
metadata.gz.sig
ADDED
Binary file
|