mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Make sure we clean up the git repo after every relevant rake task.
This commit is contained in:
parent
5709b7082a
commit
2432d0c22a
1 changed files with 55 additions and 49 deletions
18
Rakefile
18
Rakefile
|
@ -82,6 +82,7 @@ task :release => [:package] do
|
|||
end
|
||||
|
||||
task :release_edge do
|
||||
ensure_git_cleanup do
|
||||
puts "#{'=' * 50} Running rake release_edge"
|
||||
|
||||
sh %{git checkout edge-gem}
|
||||
|
@ -116,6 +117,7 @@ task :release_edge do
|
|||
|
||||
sh %{rubyforge login}
|
||||
sh %{rubyforge add_release haml haml-edge "Bleeding Edge (v#{edge_version})" pkg/haml-edge-#{edge_version}.gem}
|
||||
end
|
||||
end
|
||||
|
||||
task :watch_for_update do
|
||||
|
@ -156,6 +158,7 @@ rescue LoadError
|
|||
end
|
||||
|
||||
task :pages do
|
||||
ensure_git_cleanup do
|
||||
puts "#{'=' * 50} Running rake pages PROJ=#{ENV["PROJ"].inspect}"
|
||||
raise 'No ENV["PROJ"]!' unless proj = ENV["PROJ"]
|
||||
sh %{git checkout #{proj}-pages}
|
||||
|
@ -163,6 +166,7 @@ task :pages do
|
|||
|
||||
sh %{rake build --trace}
|
||||
sh %{rsync -av --delete site/ /var/www/#{proj}-pages}
|
||||
end
|
||||
end
|
||||
|
||||
# ----- Coverage -----
|
||||
|
@ -249,6 +253,14 @@ end
|
|||
|
||||
# ----- Handling Updates -----
|
||||
|
||||
def ensure_git_cleanup
|
||||
yield
|
||||
ensure
|
||||
sh %{git reset --hard HEAD}
|
||||
sh %{git clean -xdf}
|
||||
sh %{git checkout master}
|
||||
end
|
||||
|
||||
task :handle_update do
|
||||
unless ENV["REF"] =~ %r{^refs/heads/(master|(?:haml|sass)-pages)$}
|
||||
puts "#{'=' * 20} Ignoring rake handle_update REF=#{ENV["REF"].inspect}"
|
||||
|
@ -265,7 +277,6 @@ task :handle_update do
|
|||
sh %{git fetch origin}
|
||||
sh %{git reset --hard origin/master}
|
||||
|
||||
begin
|
||||
if branch == "master"
|
||||
sh %{rake release_edge --trace}
|
||||
sh %{rake pages --trace PROJ=haml}
|
||||
|
@ -273,11 +284,6 @@ task :handle_update do
|
|||
elsif branch =~ /^(haml|sass)-pages$/
|
||||
sh %{rake pages --trace PROJ=#{$1}}
|
||||
end
|
||||
ensure
|
||||
sh %{git reset --hard HEAD}
|
||||
sh %{git clean -xdf}
|
||||
sh %{git checkout master}
|
||||
end
|
||||
|
||||
puts 'Done running handle_update'
|
||||
puts '=' * 150
|
||||
|
|
Loading…
Reference in a new issue