%w[ rake hanna/rdoctask rake/gempackagetask rubygems/specification ].each { |x| require x }
%w[ spec/rake/spectask spec/rake/verify_rcov ].each { |x| require x }
spec_libs = %w[spec spec/fixtures/gemspecs/dryrun spec/fixtures/gemspecs/with-one-variable ]
spec_opts = ['--color']
task :default => "spec:rcov"
namespace :spec do
[:api, :model, :page, :misc].each do |category|
desc "Run all #{category} specs"
Spec::Rake::SpecTask.new(category) do |t|
t.libs += spec_libs
t.spec_opts = spec_opts
t.spec_files = FileList["spec/#{category.to_s}/**/*_spec.rb"]
end
end
desc "Run RSpec, and generate RCov documentation"
Spec::Rake::SpecTask.new(:rcov) do |t|
t.libs += spec_libs
t.spec_files = FileList['spec/**/*_spec.rb']
t.spec_opts = spec_opts
t.rcov_opts = ['--exclude', "spec/,rcov.rb,rspec.rb,spec*,gems*"]
t.rcov = true
t.rcov_dir = 'doc/coverage'
end
desc "Run RSpec on all specifications"
Spec::Rake::SpecTask.new(:rspec) do |t|
t.libs += spec_libs
t.spec_files = FileList['spec/**/*_spec.rb']
t.spec_opts = spec_opts
end
desc "Verify that coverage is 100%"
RCov::VerifyTask.new(:verify => :rcov) do |t|
t.index_html = "doc/coverage/index.html"
t.threshold = 100
end
end
spec = Gem::Specification.load('canticore.gemspec')
Rake::GemPackageTask.new(spec) do |package|
package.gem_spec = spec
end
desc "install the gem locally"
task :install => [:package] do
sh %{sudo gem install pkg/#{spec.name}-#{spec.version}}
end
desc "generate rdoc documentation"
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('README.rdoc', 'LICENSE' ).
include('lib/**/*.rb')
rdoc.options << '--title=Canticore Programmer Documentation'
rdoc.main = "README.rdoc"
rdoc.rdoc_dir = 'doc' # rdoc output folder
end