<% case testing_framework %>
<% when :rspec %>
require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:<%= test_task %>) do |<%= test_task %>|
  <%= test_task %>.pattern = FileList['<%= test_pattern %>']
end
<% when :micronaut %>
require 'micronaut/rake_task'
Micronaut::RakeTask.new(:<%= test_task %>) do |<%= test_task %>|
  <%= test_task %>.pattern = '<%= test_pattern %>'
  <%= test_task %>.ruby_opts << '-Ilib -I<%= test_dir %>'
end
<% when :shindo %>
require 'shindo/rake'
Shindo::Rake.new
<% else %>
require 'rake/testtask'
Rake::TestTask.new(:<%= test_task %>) do |<%= test_task %>|
  <%= test_task %>.libs << 'lib' << '<%= test_dir %>'
  <%= test_task %>.pattern = '<%= test_pattern %>'
  <%= test_task %>.verbose = true
end
<% end %>

<% case testing_framework %>
<% when :rspec %>
RSpec::Core::RakeTask.new(:rcov) do |spec|
  spec.pattern = '<%= test_pattern %>'
  spec.rcov = true
end
<% when :micronaut %>
Micronaut::RakeTask.new(:rcov) do |examples|
  examples.pattern = '<%= test_pattern %>'
  examples.rcov_opts = '-Ilib -I<%= test_dir %>'
  examples.rcov = true
end
<% else %>
require 'rcov/rcovtask'
Rcov::RcovTask.new do |<%= test_task %>|
  <%= test_task %>.libs << '<%= test_dir %>'
  <%= test_task %>.pattern = '<%= test_pattern %>'
  <%= test_task %>.verbose = true
  <%= test_task %>.rcov_opts << '--exclude "gems/*"'
end
<% end %>

<% if should_use_cucumber %>
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features)
<% end %>

<% if should_use_reek %>
require 'reek/rake/task'
Reek::Rake::Task.new do |t|
  t.fail_on_error = true
  t.verbose = false
  t.source_files = 'lib/**/*.rb'
end
<% end %>

<% if should_use_roodi %>
require 'roodi'
require 'roodi_task'
RoodiTask.new do |t|
  t.verbose = false
end
<% end %>

task :default => :<%= default_task %>

<% case documentation_framework %>
<% when :rdoc %>
require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
  version = File.exist?('VERSION') ? File.read('VERSION') : ""

  rdoc.rdoc_dir = 'rdoc'
  rdoc.title = "<%= project_name %> #{version}"
  rdoc.rdoc_files.include('README*')
  rdoc.rdoc_files.include('lib/**/*.rb')
end
<% when :yard %>
require 'yard'
YARD::Rake::YardocTask.new
<% end %>
