Rakefile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # encoding: utf-8
  2. require 'bundler/setup'
  3. require 'appraisal'
  4. require 'rdoc/task'
  5. require 'rspec/core/rake_task'
  6. require 'tasks/verify_rcov'
  7. Bundler::GemHelper.install_tasks
  8. desc 'Default: run unit specs.'
  9. task :default => :all
  10. desc 'Test formtastic with all supported Rails versions.'
  11. task :all => ["appraisal:install"] do
  12. exec('rake appraisal spec')
  13. end
  14. desc 'Generate documentation for the formtastic plugin.'
  15. Rake::RDocTask.new(:rdoc) do |rdoc|
  16. rdoc.rdoc_dir = 'rdoc'
  17. rdoc.title = 'Formtastic'
  18. rdoc.options << '--line-numbers' << '--inline-source'
  19. rdoc.rdoc_files.include('README.textile')
  20. rdoc.rdoc_files.include('lib/**/*.rb')
  21. end
  22. desc 'Test the formtastic plugin.'
  23. RSpec::Core::RakeTask.new('spec') do |t|
  24. t.pattern = FileList['spec/**/*_spec.rb']
  25. end
  26. desc 'Test the formtastic inputs.'
  27. RSpec::Core::RakeTask.new('spec:inputs') do |t|
  28. t.pattern = FileList['spec/inputs/*_spec.rb']
  29. end
  30. desc 'Test the formtastic plugin with specdoc formatting and colors'
  31. RSpec::Core::RakeTask.new('specdoc') do |t|
  32. t.pattern = FileList['spec/**/*_spec.rb']
  33. end
  34. desc 'Run all examples with RCov'
  35. RSpec::Core::RakeTask.new('rcov') do |t|
  36. t.pattern = FileList['spec/**/*_spec.rb']
  37. t.rcov = true
  38. t.rcov_opts = %w(--exclude gems/*,spec/*,.bundle/*, --aggregate coverage.data)
  39. end
  40. RCov::VerifyTask.new(:verify_coverage) do |t|
  41. t.require_exact_threshold = false
  42. t.threshold = (RUBY_VERSION == "1.8.7" ? 95 : 0)
  43. end
  44. desc "Run all examples and verify coverage"
  45. task :spec_and_verify_coverage => [:rcov, :verify_coverage] do
  46. end