treequel 1.1.1 → 1.2.0pre320

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data.tar.gz.sig +0 -0
  2. data/ChangeLog +49 -1
  3. data/README.md +65 -0
  4. data/Rakefile +24 -19
  5. data/bin/treequel +20 -3
  6. data/lib/treequel.rb +3 -3
  7. data/lib/treequel/branch.rb +21 -7
  8. data/lib/treequel/branchset.rb +10 -0
  9. data/lib/treequel/model.rb +12 -2
  10. data/lib/treequel/schema.rb +1 -1
  11. data/rake/documentation.rb +9 -2
  12. data/rake/hg.rb +16 -3
  13. data/rake/manual.rb +1 -1
  14. data/rake/packaging.rb +1 -1
  15. data/rake/publishing.rb +158 -95
  16. data/rake/testing.rb +52 -88
  17. data/spec/lib/constants.rb +1 -0
  18. data/spec/lib/control_behavior.rb +7 -5
  19. data/spec/lib/helpers.rb +40 -17
  20. data/spec/lib/matchers.rb +2 -0
  21. data/spec/treequel/branch_spec.rb +44 -21
  22. data/spec/treequel/branchcollection_spec.rb +4 -3
  23. data/spec/treequel/branchset_spec.rb +42 -31
  24. data/spec/treequel/control_spec.rb +2 -1
  25. data/spec/treequel/controls/contentsync_spec.rb +2 -1
  26. data/spec/treequel/controls/pagedresults_spec.rb +4 -7
  27. data/spec/treequel/controls/sortedresults_spec.rb +4 -7
  28. data/spec/treequel/directory_spec.rb +11 -12
  29. data/spec/treequel/filter_spec.rb +7 -14
  30. data/spec/treequel/mixins_spec.rb +4 -9
  31. data/spec/treequel/model/objectclass_spec.rb +2 -1
  32. data/spec/treequel/model_spec.rb +16 -35
  33. data/spec/treequel/monkeypatches_spec.rb +12 -1
  34. data/spec/treequel/schema/attributetype_spec.rb +2 -1
  35. data/spec/treequel/schema/ldapsyntax_spec.rb +2 -1
  36. data/spec/treequel/schema/matchingrule_spec.rb +2 -1
  37. data/spec/treequel/schema/matchingruleuse_spec.rb +2 -1
  38. data/spec/treequel/schema/objectclass_spec.rb +2 -1
  39. data/spec/treequel/schema/table_spec.rb +2 -1
  40. data/spec/treequel/schema_spec.rb +2 -1
  41. data/spec/treequel_spec.rb +10 -2
  42. metadata +16 -17
  43. metadata.gz.sig +0 -0
  44. data/README +0 -66
data/rake/hg.rb CHANGED
@@ -151,9 +151,10 @@ unless defined?( HG_DOTDIR )
151
151
  task :prep_release do
152
152
  tags = get_tags()
153
153
  rev = get_current_rev()
154
+ pkg_version_tag = "v#{PKG_VERSION}"
154
155
 
155
156
  # Look for a tag for the current release version, and if it exists abort
156
- if tags.include?( PKG_VERSION )
157
+ if tags.include?( pkg_version_tag )
157
158
  error "Version #{PKG_VERSION} already has a tag. Did you mean " +
158
159
  "to increment the version in #{VERSION_FILE}?"
159
160
  fail
@@ -164,8 +165,8 @@ unless defined?( HG_DOTDIR )
164
165
  run 'hg', 'sign'
165
166
 
166
167
  # Tag the current rev
167
- log "Tagging rev #{rev} as #{PKG_VERSION}"
168
- run 'hg', 'tag', PKG_VERSION
168
+ log "Tagging rev #{rev} as #{pkg_version_tag}"
169
+ run 'hg', 'tag', pkg_version_tag
169
170
 
170
171
  # Offer to push
171
172
  Rake::Task['hg:push'].invoke
@@ -229,6 +230,18 @@ unless defined?( HG_DOTDIR )
229
230
  end
230
231
 
231
232
 
233
+ desc "Update to tip"
234
+ task :update do
235
+ run 'hg', 'update'
236
+ end
237
+
238
+
239
+ desc "Clobber all changes (hg up -C)"
240
+ task :update_and_clobber do
241
+ run 'hg', 'update', '-C'
242
+ end
243
+
244
+
232
245
  desc "Check the current code in if tests pass"
233
246
  task :checkin => ['hg:pull', 'hg:newfiles', 'test', COMMIT_MSG_FILE] do
234
247
  targets = get_target_args()
@@ -269,7 +269,7 @@ module Manual
269
269
 
270
270
  ### Create a new PageCatalog that will load Manual::Page objects for .page files
271
271
  ### in the specified +sourcedir+.
272
- def initialize( sourcedir, layoutsdir )
272
+ def initialize( sourcedir, layoutsdir )
273
273
  @sourcedir = sourcedir
274
274
  @layoutsdir = layoutsdir
275
275
 
@@ -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|
@@ -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
- 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 => [ :apidocs ] 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', API_DOCSDIR, 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)}
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
- == Installation
230
+ Version #{PKG_VERSION} of #{PKG_NAME} has been released.
175
231
 
176
- Via gems:
232
+ #{Text::Format.new(:first_indent => 0).format_one_paragraph(GEMSPEC.description)}
177
233
 
178
- $ sudo gem install #{GEMSPEC.name}
234
+ == Project Page
179
235
 
180
- or from source:
236
+ #{GEMSPEC.homepage}
181
237
 
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
238
+ == Installation
186
239
 
187
- == Changes
188
- #{relnotes}
189
- }.gsub( /^\t+/, '' )
240
+ $ sudo gem install #{GEMSPEC.name}
190
241
 
191
- File.open( task.name, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
192
- fh.print( announce_body )
193
- end
242
+ == Changes
243
+ #{relnotes}
244
+ }.gsub( /^\t+/, '' )
194
245
 
195
- edit task.name
196
- end
197
- CLOBBER.include( RELEASE_ANNOUNCE_FILE )
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
- 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'
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
- log "About to send the following email:"
224
- puts '---',
225
- email.to_s,
226
- '---'
255
+ desc 'Send out a release announcement'
256
+ task :announce => [RELEASE_ANNOUNCE_FILE] do
257
+ email = TMail::Mail.new
227
258
 
228
- ask_for_confirmation( "Will send via #{SMTP_HOST}." ) do
229
- pwent = Etc.getpwuid( Process.euid )
230
- curuser = pwent ? pwent.name : 'unknown'
231
- username = prompt_with_default( "SMTP user", curuser )
232
- password = prompt_for_password()
233
-
234
- trace "Creating SMTP connection to #{SMTP_HOST}:#{SMTP_PORT}"
235
- smtp = Net::SMTP.new( SMTP_HOST, SMTP_PORT )
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
- trace "connecting..."
240
- smtp.ssl_start( Socket.gethostname, username, password, :plain ) do |smtp|
241
- trace "sending message..."
242
- 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."
243
300
  end
244
- trace "done."
245
301
  end
246
302
  end
247
303
 
248
-
249
- desc 'Publish the new release to Gemcutter'
250
- task :publish => [:clean, :gem, :notes] do |task|
251
- ask_for_confirmation( "Publish #{GEM_FILE_NAME} to Gemcutter?", false ) do
252
- gempath = PKGDIR + GEM_FILE_NAME
253
- 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
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
@@ -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