require 'rubygems' require 'rake' # ----- Benchmarking ----- desc < :"test:rails_compatibility" else task :default => :test end require 'rake/testtask' Rake::TestTask.new do |t| t.libs << 'lib' test_files = FileList['test/**/*_test.rb'] test_files.exclude('test/rails/*') t.test_files = test_files t.verbose = true end Rake::Task[:test].send(:add_comment, < [:package] do sudo = RUBY_PLATFORM =~ /win32/ ? '' : 'sudo' gem = RUBY_PLATFORM =~ /java/ ? 'jgem' : 'gem' sh %{#{sudo} #{gem} install --no-ri pkg/haml-#{File.read('VERSION').strip}} end desc "Release a new Haml package to Rubyforge. Requires the NAME and VERSION flags." task :release => [:package] do name, version = ENV['NAME'], ENV['VERSION'] raise "Must supply NAME and VERSION for release task." unless name && version sh %{rubyforge login} sh %{rubyforge add_release haml haml "#{name} (v#{version})" pkg/haml-#{version}.gem} sh %{rubyforge add_file haml haml "#{name} (v#{version})" pkg/haml-#{version}.tar.gz} sh %{rubyforge add_file haml haml "#{name} (v#{version})" pkg/haml-#{version}.tar.bz2} sh %{rubyforge add_file haml haml "#{name} (v#{version})" pkg/haml-#{version}.zip} end # ----- Documentation ----- task :rdoc do puts '=' * 100, < :yardoc rescue LoadError task :doc => :rdoc task :yardoc => :rdoc end # ----- Coverage ----- begin require 'rcov/rcovtask' Rcov::RcovTask.new do |t| t.test_files = FileList['test/**/*_test.rb'] t.rcov_opts << '-x' << '"^\/"' if ENV['NON_NATIVE'] t.rcov_opts << "--no-rcovrt" end t.verbose = true end rescue LoadError; end # ----- Profiling ----- begin require 'ruby-prof' desc <