Rakefile in ruml-0.1.0 vs Rakefile in ruml-1.0.0
- old
+ new
@@ -3,43 +3,28 @@
# Test
require 'rake/testtask'
desc 'Default: run unit tests.'
task :default => :test
+namespace :test do
+ desc "Test runner"
+ Rake::TestTask.new :run do |test|
+ ENV['TEST_FIXTURE'] ||= "file"
+ test.test_files = FileList.new('test/**/*_test.rb')
+ test.libs << 'test'
+ test.verbose = true
+ end
+end
+
AVAILABLE_TEST_FIXTURES = %w[file yaml]
AVAILABLE_TEST_FIXTURES.each do |test_fixture|
namespace :test do
- Rake::TestTask.new(test_fixture) do |test|
- ENV['TEST_FIXTURE'] = test_fixture
- test.test_files = FileList.new('test/*_test.rb')
- test.libs << 'test'
- test.verbose = true
+ desc "Run tests with fixture #{test_fixture}"
+ task test_fixture do
+ system "bundle exec rake test:run TEST_FIXTURE=#{test_fixture}"
end
end
end
desc "Run tests for #{AVAILABLE_TEST_FIXTURES.join(', ')}"
task :test => AVAILABLE_TEST_FIXTURES.map { |f| "test:#{f}" }
-
-SUPPORTED_RUBIES = %w[ree 1.9.2 1.9.3 jruby rbx]
-GEMSPEC = Bundler::GemHelper.new(Dir.pwd).gemspec
-
-def with_ruby(ruby, command)
- rvm = "#{ruby}@#{GEMSPEC.name}"
- command = %{rvm #{rvm} exec bash -c '#{command}'}
-
- puts "\n" * 3
- puts "CMD: #{command}"
- puts "=" * 40
-
- system(command) or raise "command failed: #{command}"
-end
-
-namespace :rubies do
- desc "Run tests for following supported platforms #{SUPPORTED_RUBIES.join ", "}"
- task :test do
- command = "bundle check || bundle install && bundle exec rake"
- rubies = ENV['RUBIES'] ? ENV['RUBIES'].split(",") : SUPPORTED_RUBIES
- rubies.each { |ruby| with_ruby(ruby, command) }
- end
-end