Add a Rake task for packaging a special edge gem.

This commit is contained in:
Nathan Weizenbaum 2009-04-29 16:52:57 -07:00
parent 0b0ded0ba5
commit 1a0b452b26
2 changed files with 39 additions and 3 deletions

View File

@ -48,9 +48,10 @@ end
task :revision_file do
require 'lib/haml'
if Haml.version[:rev] && !Rake.application.top_level_tasks.include?('release')
release = Rake.application.top_level_tasks.include?('release') || File.exist?('EDGE_GEM_VERSION')
if Haml.version[:rev] && !release
File.open('REVISION', 'w') { |f| f.puts Haml.version[:rev] }
elsif Rake.application.top_level_tasks.include?('release')
elsif release
File.open('REVISION', 'w') { |f| f.puts "(release)" }
else
File.open('REVISION', 'w') { |f| f.puts "(unknown)" }
@ -79,6 +80,40 @@ task :release => [:package] do
sh %{rubyforge add_file haml haml "#{name} (v#{version})" pkg/haml-#{version}.zip}
end
task :release_edge do
sh %{git checkout edge-gem}
sh %{git fetch origin}
sh %{git merge origin/edge-gem}
sh %{git merge origin/master}
# Get the current master branch version
version = File.read('VERSION').strip.split('.').map {|n| n.to_i}
raise "#{version.join('.')} is not a development version" unless version[1].odd? && version[2] == 0
# Bump the edge gem version
edge_version = File.read('EDGE_GEM_VERSION').strip.split('.').map {|n| n.to_i}
if edge_version[0..1] != version[0..1]
# A new master branch version was released, reset the edge gem version
edge_version[0..1] = version[0..1]
edge_version[2] = 0
else
# Just bump the teeny version
edge_version[2] += 1
end
edge_version = edge_version.join('.')
File.open('EDGE_GEM_VERSION', 'w') {|f| f.puts(edge_version)}
sh %{git commit -a -m "Bump edge gem version."}
sh %{git push origin edge-gem}
# Package the edge gem with the proper version
File.open('VERSION', 'w') {|f| f.puts(edge_version)}
sh %{rake package}
sh %{git checkout VERSION}
sh %{rubyforge login}
sh %{rubyforge add_release haml haml-edge "Bleeding Edge (v#{edge_version})" pkg/haml-edge-#{edge_version}.gem}
end
# ----- Documentation -----
begin

View File

@ -2,7 +2,8 @@ require 'rubygems'
require 'rake'
HAML_GEMSPEC = Gem::Specification.new do |spec|
spec.rubyforge_project = spec.name = 'haml'
spec.rubyforge_project = 'haml'
spec.name = File.exist?('EDGE_GEM_VERSION') ? 'haml-edge' : 'haml'
spec.summary = "An elegant, structured XHTML/XML templating engine.\nComes with Sass, a similar CSS templating engine."
spec.version = File.read('VERSION').strip
spec.authors = ['Nathan Weizenbaum', 'Hampton Catlin']