aboutsummaryrefslogtreecommitdiffstats
path: root/tasks/release.rb
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2010-11-16 16:03:57 -0800
committerCarl Lerche <me@carllerche.com>2010-11-16 17:19:47 -0800
commitdab1d8dcc6030a5c1f5e88744d3c40d771be23a3 (patch)
tree48294673b4497a48dd76eba5508343a36f4f0f6d /tasks/release.rb
parent6b3f521b806614a073e4418307b56241fe287940 (diff)
downloadrails-dab1d8dcc6030a5c1f5e88744d3c40d771be23a3.tar.gz
rails-dab1d8dcc6030a5c1f5e88744d3c40d771be23a3.tar.bz2
rails-dab1d8dcc6030a5c1f5e88744d3c40d771be23a3.zip
Add some sanity checks to the gem push script
Diffstat (limited to 'tasks/release.rb')
-rw-r--r--tasks/release.rb18
1 files changed, 16 insertions, 2 deletions
diff --git a/tasks/release.rb b/tasks/release.rb
index 4c038f51f5..8073965a50 100644
--- a/tasks/release.rb
+++ b/tasks/release.rb
@@ -2,6 +2,7 @@ FRAMEWORKS = %w( activesupport activemodel activerecord activeresource actionpac
root = File.expand_path('../../', __FILE__)
version = File.read("#{root}/RAILS_VERSION").strip
+tag = "v#{version}"
directory "dist"
@@ -52,15 +53,28 @@ directory "dist"
sh "gem install #{gem}"
end
+ task :prep_release => [:ensure_clean_state, :build]
+
task :push => :build do
sh "gem push #{gem}"
end
end
end
-namespace :git do
+namespace :release do
+ task :ensure_clean_state do
+ unless `git status -s | grep -v RAILS_VERSION`.strip.empty?
+ abort "[ABORTING] `git status` reports a dirty tree. Make sure all changes are committed"
+ end
+
+ unless ENV['SKIP_TAG'] || `git tag | grep #{tag}`.strip.empty?
+ abort "[ABORTING] `git tag` shows that #{tag} already exists. Has this version already\n"\
+ " been released? Git tagging can be skipped by setting SKIP_TAG=1"
+ end
+ end
+
task :tag do
- sh "git tag v#{version}"
+ sh "git tag #{tag}"
end
end