pg 0.9.0 → 0.10.0

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/rake/hg.rb CHANGED
@@ -22,6 +22,8 @@ unless defined?( HG_DOTDIR )
22
22
  ###
23
23
 
24
24
  module MercurialHelpers
25
+ require './helpers.rb' unless defined?( RakefileHelpers )
26
+ include RakefileHelpers
25
27
 
26
28
  ###############
27
29
  module_function
@@ -83,7 +85,7 @@ unless defined?( HG_DOTDIR )
83
85
 
84
86
  ### Return the list of files which are of status 'unknown'
85
87
  def get_unknown_files
86
- list = read_command_output( 'hg', 'status', '-un', '--no-color' )
88
+ list = read_command_output( 'hg', 'status', '-un', '--color', 'never' )
87
89
  list = list.split( /\n/ )
88
90
 
89
91
  trace "New files: %p" % [ list ]
@@ -213,13 +215,20 @@ unless defined?( HG_DOTDIR )
213
215
  paths = get_repo_paths()
214
216
  if origin_url = paths['default']
215
217
  ask_for_confirmation( "Pull and update from '#{origin_url}'?", false ) do
216
- run 'hg', 'pull', '-u'
218
+ Rake::Task['hg:pull_without_confirmation'].invoke
217
219
  end
218
220
  else
219
221
  trace "Skipping pull: No 'default' path."
220
222
  end
221
223
  end
222
224
 
225
+
226
+ desc "Pull and update without confirmation"
227
+ task :pull_without_confirmation do
228
+ run 'hg', 'pull', '-u'
229
+ end
230
+
231
+
223
232
  desc "Check the current code in if tests pass"
224
233
  task :checkin => ['hg:pull', 'hg:newfiles', 'test', COMMIT_MSG_FILE] do
225
234
  targets = get_target_args()
@@ -240,13 +249,18 @@ unless defined?( HG_DOTDIR )
240
249
  paths = get_repo_paths()
241
250
  if origin_url = paths['default']
242
251
  ask_for_confirmation( "Push to '#{origin_url}'?", false ) do
243
- run 'hg', 'push'
252
+ Rake::Task['hg:push_without_confirmation'].invoke
244
253
  end
245
254
  else
246
255
  trace "Skipping push: No 'default' path."
247
256
  end
248
257
  end
249
258
 
259
+ desc "Push to the default repo without confirmation"
260
+ task :push_without_confirmation do
261
+ run 'hg', 'push'
262
+ end
263
+
250
264
  end
251
265
 
252
266
  if HG_DOTDIR.exist?
@@ -147,9 +147,14 @@ module Manual
147
147
 
148
148
  layout = self.config['layout'].sub( /\.page$/, '' )
149
149
  templatepath = @layouts_dir + "#{layout}.page"
150
- template = ERB.new( templatepath.read )
151
- page = self
150
+ template = nil
151
+ if Object.const_defined?( :Encoding )
152
+ template = ERB.new( templatepath.read(:encoding => 'UTF-8') )
153
+ else
154
+ template = ERB.new( templatepath.read )
155
+ end
152
156
 
157
+ page = self
153
158
  html = template.result( binding() )
154
159
 
155
160
  # Use Tidy to clean up the html if 'cleanup' is turned on, but remove the Tidy
@@ -565,7 +570,7 @@ module Manual
565
570
  manual_pages = setup_page_conversion_tasks( sourcedir, outputdir, catalog )
566
571
 
567
572
  desc "Build the manual"
568
- task :build => [ :rdoc, :copy_resources, :copy_apidocs, :generate_pages ]
573
+ task :build => [ :apidocs, :copy_resources, :copy_apidocs, :generate_pages ]
569
574
 
570
575
  task :clobber do
571
576
  RakeFileUtils.verbose( $verbose ) do
@@ -686,8 +691,8 @@ module Manual
686
691
  end
687
692
 
688
693
  desc "Copy API documentation to the manual output directory"
689
- task :copy_apidocs => :rdoc do
690
- cp_r( RDOCDIR, outputdir )
694
+ task :copy_apidocs => :apidocs do
695
+ cp_r( API_DOCSDIR, outputdir )
691
696
  end
692
697
 
693
698
  # Now group all the resource file tasks into a containing task
@@ -713,7 +718,7 @@ if MANUALDIR.exist?
713
718
 
714
719
  Manual::GenTask.new do |manual|
715
720
  manual.metadata.version = PKG_VERSION
716
- manual.metadata.api_dir = RDOCDIR
721
+ manual.metadata.api_dir = API_DOCSDIR
717
722
  manual.output_dir = MANUALOUTPUTDIR
718
723
  manual.base_dir = MANUALDIR
719
724
  manual.source_dir = 'src'
@@ -12,7 +12,13 @@ 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
+ Rake::Task[:gem].clear
17
+
18
+ Gem::PackageTask.new( GEMSPEC ) do |pkg|
19
+ pkg.need_zip = true
20
+ pkg.need_tar = true
21
+ end
16
22
  end
17
23
 
18
24
 
@@ -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,120 +181,138 @@ begin
133
181
  end
134
182
  CLOBBER.include( RELEASE_NOTES_FILE )
135
183
 
136
-
137
- desc "Upload project documentation and packages to #{PROJECT_HOST}"
138
- task :upload => [ :upload_docs, :upload_packages ]
139
- task :project => :upload # the old name
140
-
141
- desc "Publish the project docs to #{PROJECT_HOST}"
142
- task :upload_docs => [ :rdoc ] do
143
- when_writing( "Publishing docs to #{PROJECT_SCPDOCURL}" ) do
144
- log "Uploading API documentation to %s:%s" % [ PROJECT_HOST, PROJECT_DOCDIR ]
145
- run 'ssh', PROJECT_HOST, "rm -rf #{PROJECT_DOCDIR}"
146
- run 'scp', '-qCr', RDOCDIR, PROJECT_SCPDOCURL
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
- desc "Publish the project packages to #{PROJECT_HOST}"
151
- task :upload_packages => [ :package ] do
152
- when_writing( "Uploading packages") do
153
- pkgs = Pathname.glob( PKGDIR + "#{PKG_FILE_NAME}.{gem,tar.gz,tar.bz2,zip}" )
154
- log "Uploading %d packages to #{PROJECT_SCPPUBURL}" % [ pkgs.length ]
155
- pkgs.each do |pkgfile|
156
- run 'scp', '-qC', pkgfile, PROJECT_SCPPUBURL
157
- end
158
- end
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
- file RELEASE_ANNOUNCE_FILE => [RELEASE_NOTES_FILE] do |task|
163
- relnotes = File.read( RELEASE_NOTES_FILE )
164
- announce_body = %{
165
-
166
- Version #{PKG_VERSION} of #{PKG_NAME} has been released.
167
-
168
- #{Text::Format.new(:first_indent => 0).format_one_paragraph(GEMSPEC.description)}
225
+ else
226
+ file RELEASE_ANNOUNCE_FILE => [RELEASE_NOTES_FILE] do |task|
227
+ relnotes = File.read( RELEASE_NOTES_FILE )
228
+ announce_body = %{
169
229
 
170
- == Project Page
230
+ Version #{PKG_VERSION} of #{PKG_NAME} has been released.
171
231
 
172
- #{GEMSPEC.homepage}
232
+ #{Text::Format.new(:first_indent => 0).format_one_paragraph(GEMSPEC.description)}
173
233
 
174
- == Installation
234
+ == Project Page
175
235
 
176
- Via gems:
236
+ #{GEMSPEC.homepage}
177
237
 
178
- $ sudo gem install #{GEMSPEC.name}
238
+ == Installation
179
239
 
180
- or from source:
240
+ $ sudo gem install #{GEMSPEC.name}
181
241
 
182
- $ wget http://deveiate.org/code/#{PKG_FILE_NAME}.tar.gz
183
- $ tar -xzvf #{PKG_FILE_NAME}.tar.gz
184
- $ cd #{PKG_FILE_NAME}
185
- $ sudo rake install
242
+ == Changes
243
+ #{relnotes}
244
+ }.gsub( /^\t+/, '' )
186
245
 
187
- == Changes
188
- #{relnotes}
189
- }.gsub( /^\t+/, '' )
246
+ File.open( task.name, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
247
+ fh.print( announce_body )
248
+ end
190
249
 
191
- File.open( task.name, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
192
- fh.print( announce_body )
250
+ edit task.name
193
251
  end
252
+ CLOBBER.include( RELEASE_ANNOUNCE_FILE )
194
253
 
195
- edit task.name
196
- end
197
- CLOBBER.include( RELEASE_ANNOUNCE_FILE )
198
254
 
255
+ desc 'Send out a release announcement'
256
+ task :announce => [RELEASE_ANNOUNCE_FILE] do
257
+ email = TMail::Mail.new
199
258
 
200
- desc 'Send out a release announcement'
201
- task :announce => [RELEASE_ANNOUNCE_FILE] do
202
- email = TMail::Mail.new
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
203
267
 
204
- if $publish_privately || RELEASE_ANNOUNCE_ADDRESSES.empty?
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'
211
- end
212
- email.from = 'Michael Granger <mgranger@laika.com>'
213
- email.subject = "[ANN] #{PKG_NAME} #{PKG_VERSION}"
214
- email.body = File.read( RELEASE_ANNOUNCE_FILE )
215
- email.date = Time.new
216
-
217
- email.message_id = gen_message_id()
218
-
219
- log "About to send the following email:"
220
- puts '---',
221
- email.to_s,
222
- '---'
223
-
224
- ask_for_confirmation( "Will send via #{SMTP_HOST}." ) do
225
- pwent = Etc.getpwuid( Process.euid )
226
- curuser = pwent ? pwent.name : 'unknown'
227
- username = prompt_with_default( "SMTP user", curuser )
228
- password = prompt_for_password()
229
-
230
- trace "Creating SMTP connection to #{SMTP_HOST}:#{SMTP_PORT}"
231
- smtp = Net::SMTP.new( SMTP_HOST, SMTP_PORT )
232
- smtp.set_debug_output( $stdout )
233
- smtp.esmtp = true
234
-
235
- trace "connecting..."
236
- smtp.ssl_start( Socket.gethostname, username, password, :plain ) do |smtp|
237
- trace "sending message..."
238
- smtp.send_message( email.to_s, email.from, email.to )
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."
239
300
  end
240
- trace "done."
241
301
  end
242
302
  end
243
303
 
244
-
245
- desc 'Publish the new release to Gemcutter'
246
- task :publish => [:clean, :gem, :notes] do |task|
247
- ask_for_confirmation( "Publish #{GEM_FILE_NAME} to Gemcutter?", false ) do
248
- gempath = PKGDIR + GEM_FILE_NAME
249
- sh 'gem', 'push', gempath
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
250
316
  end
251
317
  end
252
318
  end
@@ -262,6 +328,7 @@ rescue LoadError => err
262
328
  end
263
329
 
264
330
  task :release => :no_release_tasks
331
+ task "release:rerelease" => :no_release_tasks
265
332
  task "release:announce" => :no_release_tasks
266
333
  task "release:publish" => :no_release_tasks
267
334
  task "release:notes" => :no_release_tasks
@@ -16,7 +16,7 @@ end
16
16
  SPEC_FILES = [] unless defined?( SPEC_FILES )
17
17
  TEST_FILES = [] unless defined?( TEST_FILES )
18
18
 
19
- COMMON_SPEC_OPTS = ['-Du'] unless defined?( COMMON_SPEC_OPTS )
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', '>= 1.1.3'
42
+ gem 'rspec', '>= 2.0.0'
43
43
 
44
- require 'spec'
45
- require 'spec/rake/spectask'
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/rspec'
55
-
56
- autotester = Autotest::Rspec.new
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
- Spec::Rake::SpecTask.new( :doc ) do |task|
62
- task.spec_files = SPEC_FILES
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
- Spec::Rake::SpecTask.new( :profile ) do |task|
68
- task.spec_files = SPEC_FILES
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
- Spec::Rake::SpecTask.new( :quiet ) do |task|
74
- task.spec_files = SPEC_FILES
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
- Spec::Rake::SpecTask.new( :html ) do |task|
80
- task.spec_files = SPEC_FILES
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
- unless SPEC_FILES.empty?
131
- Spec::Rake::SpecTask.new( :coverage ) do |task|
132
- task.spec_files = SPEC_FILES
133
- task.libs += [LIBDIR]
134
- task.spec_opts = ['-f', 'p', '-b']
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
- Spec::Rake::SpecTask.new( :text ) do |task|
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
- Spec::Rake::SpecTask.new( :diff ) do |task|
155
- task.spec_files = SPEC_FILES
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
- Spec::Rake::SpecTask.new( :speconly ) do |task|
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 :no_rcov do
173
- $stderr.puts "Coverage tasks not defined: RSpec+RCov tasklib not available: %s" %
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 :coverage => :no_rcov
178
- task :clobber_coverage
179
- task :rcov => :no_rcov
180
- namespace :coverage do
181
- task :text => :no_rcov
182
- task :diff => :no_rcov
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
- task :verify => :no_rcov
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