Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: f58a17bb13
Fetching contributors…

Cannot retrieve contributors at this time

71 lines (60 sloc) 2.052 kB
begin
require 'hanna/rdoctask'
rescue LoadError
require 'rdoc'
require 'rake/rdoctask'
end
require 'rake/testtask'
require 'rake/gempackagetask'
load 'sinatra-mapping.gemspec'
def current_version(file = "VERSION")
@current_value ||= YAML.load_file(file) || {}
end
desc "Generate version for release and tagging."
task :version, [:major, :minor, :patch, :release, :date, :cycle] do |taskspec, version|
require 'parsedate'
version_date = Date.new(*ParseDate.parsedate(version[:date] || current_version[:date].to_s).compact) unless version or current_version
newer = {
:major => version[:major].to_i || current_version[:major].to_i,
:minor => version[:minor].to_i || current_version[:minor].to_i,
:patch => version[:patch].to_i || current_version[:patch].to_i,
:release => version[:release].to_s.empty? ? nil : version[:release].to_i,
:date => version_date || Date.today,
:cycle => version[:cycle] || current_version[:cycle]
}
newer.merge(current_version) do |key, new_value, current_value|
new_value || current_value
end
File.open(taskspec.name.upcase, "w") do |version_file|
version_file << newer.to_yaml
end
end
namespace :version do
desc "Show the current version."
task :show do
version = [:major, :minor, :patch, :release].map do |info|
current_version[info]
end.compact.join('.')
puts "#{@spec.name} v#{version} released at #{current_version[:date]} (#{current_version[:cycle]})"
end
end
Rake::TestTask.new :test do |spec|
spec.test_files = FileList["test/*_test.rb"]
end
Rake::GemPackageTask.new(@spec) do |pkg|
pkg.need_tar_bz2 = true
end
desc "Generate RDoc API documentation."
Rake::RDocTask.new("doc:api") do |rdoc|
rdoc.title = %q{Sinatra::Mapping - API Documentation}
rdoc.main = %q{README.rdoc}
rdoc.options = %w{--line-numbers --show-hash}
rdoc.rdoc_dir = %q{doc/api}
rdoc.rdoc_files.include %w{
CHANGES
LICENSE
README.rdoc
lib/**/*.rb
}
end
task :default => :test
Jump to Line
Something went wrong with that request. Please try again.