Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

96 lines (80 sloc) 2.476 kB
require 'rake'
require 'rake/testtask'
desc "Default: run tests"
task :default => %w[test:multi_verbose spec]
Rake::TestTask.new("test") do |t|
t.pattern = "test/**/*_test.rb"
t.verbose = true
end
begin
require "rcov/rcovtask"
desc "run tests with rcov"
Rcov::RcovTask.new do |t|
t.pattern = "test/**/*_test.rb"
t.rcov_opts << ["--no-html", "--exclude 'Library,#{Gem.path.join(',')}'"]
t.verbose = true
end
rescue LoadError
end
require "date"
gem_spec = Gem::Specification.new do |s|
s.name = "unit_record"
s.summary = "UnitRecord enables unit testing without hitting the database."
s.version = "0.9.1"
s.author = "Dan Manges"
s.description = "UnitRecord enables unit testing without hitting the database."
s.email = "daniel.manges@gmail.com"
s.homepage = "http://unit-test-ar.rubyforge.org"
s.rubyforge_project = "unit-test-ar"
s.has_rdoc = false
s.autorequire = "unit_record"
s.files = FileList['{lib,test,vendor}/**/*.rb', 'CHANGELOG', 'LICENSE', 'README.markdown', 'Rakefile'].to_a
end
task :gem => %w[test:multi] do
Gem::Builder.new(gem_spec).build
end
namespace :gemspec do
desc "generates unit-record.gemspec"
task :generate do
File.open("unit-record.gemspec", "w") do |f|
f.puts "# this file is generated by rake gemspec:generate for github"
f.write gem_spec.to_ruby
end
end
end
task :readme do
require "rubygems"; gem "BlueCloth"; require "BlueCloth"; require 'tmpdir'
file = "#{Dir.tmpdir}/readme.html"
File.open(file, "w") { |f| f.write BlueCloth.new(File.read("README.markdown")).to_html }
sh "open #{file}"
end
RAILS_VERSIONS = %w[1.2.6 2.0.2 2.1.0 2.1.1 2.2.2 2.3.1]
namespace :test do
desc "test with multiple versions of rails"
task :multi do
RAILS_VERSIONS.each do |rails_version|
puts "Testing with Rails #{rails_version}"
sh "RAILS_VERSION='#{rails_version}' rake test > /dev/null 2>&1"
end
end
task :multi_verbose do
(RAILS_VERSIONS - %w[]).each do |rails_version|
task = defined?(Rcov) ? "rcov" : "test"
puts "Testing with Rails #{rails_version}"
sh "RAILS_VERSION='#{rails_version}' rake #{task}"
end
end
end
begin
gem "rspec"
require "spec/rake/spectask"
Spec::Rake::SpecTask.new(:spec) do |t|
t.spec_files = %w[test/sample_spec.rb]
end
rescue LoadError
task :spec do
puts "== RSpec failed to load"
end
end
desc "pre-commit task"
task :pc => %w[test:multi spec gemspec:generate]
Jump to Line
Something went wrong with that request. Please try again.