summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Davis <ryand@zenspider.com>2009-02-18 22:03:48 -0800
committerRyan Davis <ryand@zenspider.com>2009-02-18 22:03:48 -0800
commit677a621033ee0073eb27a20010bcd0510cdcf277 (patch)
treedcf39de9effd8dcaab782f87b86379b885e3c08f
parent878461702ebf8e8126e1b94525d32fd9abb85fe3 (diff)
downloadhoe-677a621033ee0073eb27a20010bcd0510cdcf277.tar.gz
Fixed multi task attaching to test task by refactoring task creation
[git-p4: depot-paths = "//src/hoe/dev/": change = 4611]
-rw-r--r--lib/hoe.rb33
-rw-r--r--test/test_hoe.rb4
2 files changed, 19 insertions, 18 deletions
diff --git a/lib/hoe.rb b/lib/hoe.rb
index 16014da..5d6b111 100644
--- a/lib/hoe.rb
+++ b/lib/hoe.rb
@@ -479,31 +479,30 @@ class Hoe
yield(config, rc)
end
+ def define_test_task name = :test
+ Rake::TestTask.new do |t|
+ t.name = name
+ t.options = FILTER if FILTER
+ t.loader = :direct
+ t.ruby_opts = RUBY_FLAGS.split(/\s+/) << "-r#{testlib}"
+ t.test_files = test_globs
+ t.verbose = true
+ end
+ end
+
def define_tasks # :nodoc:
default_tasks = []
if File.directory? "test" then
- test_task = Rake::TestTask.new do |t|
- flags = RUBY_FLAGS.split(/\s+/)
- flags << "-r#{testlib}"
-
- t.name = :test
- t.options = FILTER if FILTER
- t.loader = :direct
- t.ruby_opts = flags
- t.test_files = test_globs
- t.verbose = true
- end
-
- multi = test_task.dup
- multi.name = :multi
+ define_test_task :test
- def multi.ruby *args, &block
+ # I am a baaaad bad person.
+ def (define_test_task :multi).ruby *args, &block
args.unshift("-S", "multiruby")
super
end
- multi.define
+ ENV['EXCLUDED_VERSIONS'] = multiruby_skip.join(":")
desc 'Show which test files fail when run alone.'
task :test_deps do
@@ -643,7 +642,7 @@ class Hoe
s.rdoc_options = ['--main', readme_file]
s.extra_rdoc_files += s.files.grep(/txt$/)
- s.extra_rdoc_files.reject! { |f| f =~ %r%^(test|spec|vendor|data|tmp)/% }
+ s.extra_rdoc_files.reject! { |f| f =~ %r%^(test|spec|vendor|template|data|tmp)/% }
s.extra_rdoc_files += @extra_rdoc_files
s.has_rdoc = true
diff --git a/test/test_hoe.rb b/test/test_hoe.rb
index 92e5c7c..4caa061 100644
--- a/test/test_hoe.rb
+++ b/test/test_hoe.rb
@@ -72,6 +72,8 @@ class TestHoe < Test::Unit::TestCase
spec = hoe.spec
+ text_files = files.grep(/txt$/).reject { |f| f =~ /template/ }
+
assert_equal 'blah', spec.name
assert_equal '1.2.3', spec.version.to_s
assert_equal '>= 0', spec.required_rubygems_version.to_s
@@ -82,7 +84,7 @@ class TestHoe < Test::Unit::TestCase
assert_match(/Hoe.*Rakefiles/, spec.description)
assert_equal ['email'], spec.email
assert_equal ['sow'], spec.executables
- assert_equal files.grep(/txt$/), spec.extra_rdoc_files
+ assert_equal text_files, spec.extra_rdoc_files
assert_equal files, spec.files
assert_equal true, spec.has_rdoc
assert_equal "http://rubyforge.org/projects/seattlerb/", spec.homepage