require 'rubygems' require 'rake' # ----- Benchmarking ----- desc < :test require 'rake/testtask' Rake::TestTask.new do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end Rake::Task[:test].send(:add_comment, < [:package] do sudo = RUBY_PLATFORM =~ /win32/ ? '' : 'sudo' sh %{#{sudo} gem install --no-ri pkg/haml-#{File.read('VERSION').strip}} end 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 ----- begin require 'hanna/rdoctask' rescue LoadError require 'rake/rdoctask' end Rake::RDocTask.new do |rdoc| rdoc.title = 'Haml/Sass' rdoc.options << '--line-numbers' << '--inline-source' rdoc.rdoc_files.include(*FileList.new('*') do |list| list.exclude(/(^|[^.a-z])[a-z]+/) list.exclude('TODO') end.to_a) rdoc.rdoc_files.include('lib/**/*.rb') rdoc.rdoc_files.exclude('TODO') rdoc.rdoc_files.exclude('lib/haml/buffer.rb') rdoc.rdoc_files.exclude('lib/sass/tree/*') rdoc.rdoc_dir = 'rdoc' rdoc.main = 'README.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 <