require "rake/clean" require "rake/testtask" require "bundler/gem_tasks" task :default => :test # FIXME: Redefining :test task to run test/options_test.rb in isolated process since it depends on whether Rails is loaded or not. # Remove this task when we finished changing escape_html option to be true by default. isolated_test = Rake::TestTask.new do |t| t.libs << 'test' t.test_files = %w[test/options_test.rb] t.warning = true t.verbose = true end Rake::TestTask.new do |t| t.libs << 'test' t.test_files = Dir['test/*_test.rb'] + Dir['test/haml-spec/*_test.rb'] + Dir['test/cases/*_test.rb'] - isolated_test.file_list t.warning = true t.verbose = true end CLEAN.replace %w(pkg doc coverage .yardoc test/haml vendor) desc "Benchmark Haml against ERB. TIMES=n sets the number of runs, default is 1000." task :benchmark do sh "ruby benchmark.rb #{ENV['TIMES']}" end task :submodules do if File.exist?(File.dirname(__FILE__) + "/.git") sh %{git submodule sync} sh %{git submodule update --init --recursive} end end namespace :doc do task :sass do require 'sass' Dir["yard/default/**/*.sass"].each do |sass| File.open(sass.gsub(/sass$/, 'css'), 'w') do |f| f.write(Sass::Engine.new(File.read(sass)).render) end end end desc "List all undocumented methods and classes." task :undocumented do command = 'yard --list --query ' command << '"object.docstring.blank? && ' command << '!(object.type == :method && object.is_alias?)"' sh command end end desc "Generate documentation" task(:doc => 'doc:sass') {sh "yard"} desc "Generate documentation incrementally" task(:redoc) {sh "yard -c"} desc < 'test:bundles:install' do with_each_gemfile {sh "bundle exec rake test"} end task :rc => :rails_compatibility end