Permalink
Browse files

[core] Breaks down rake tasks

While documenting our release process, we can see some things that don't
need to be locked together are.

This splits release into prepare/publish parts

Now anyone can prepare a release but will not be able to publish that
release without the correct access to Github and Rubygems.

Adds a preflight task and adds a check for existing tags to that.
  • Loading branch information...
1 parent 99756dd commit 28d6e219f3efbb5ad8bb04df602c9f24af4eb13d @tokengeek tokengeek committed Dec 27, 2012
Showing with 39 additions and 12 deletions.
  1. +7 −7 RELEASE.md
  2. +32 −5 Rakefile
View
@@ -23,13 +23,13 @@ services)
* Update the version number (`lib/fog/version.rb`)
* Run `rake changelog` to update `changelog.txt`
* Run `rake release` to prepare the release which does:
- * Builds the gem (`rake build`)
- * Tags the commit
- * Creates commits for version and pushes to github (Requires
-Credentials)
- * Pushes gem to rubygems (Requires Credentials)
- * Creates site documentation (`rake docs`)
- * Pushes site documentation to S3 (Requires Credentials)
+ * Prepares the release (`rake release:prepare`)
+ * Builds the gem
+ * Tags the commit
+ * Creates commits for version
+ * Publishes the release (`rake release:publish`)
+ * Pushes commit and tag to Github (Requires Credentials)
+ * Pushes gem to Rubygems (Requires Credentials)
## Announce the release
View
@@ -95,16 +95,43 @@ end
#
#############################################################################
-task :release => :build do
- unless `git branch` =~ /^\* master$/
- puts "You must be on the master branch to release!"
- exit!
+task :release => ["release:prepare", "release:publish"]
+
+namespace :release do
+ task :preflight do
+ unless `git branch` =~ /^\* master$/
+ puts "You must be on the master branch to release!"
+ exit!
+ end
+ if `git tag` =~ /^\* v#{version}$/
+ puts "Tag v#{version} already exists!"
+ exit!
+ end
+ end
+
+ task :prepare => :preflight do
+ Rake::Task[:build].invoke
+ sh "gem install pkg/#{name}-#{version}.gem"
+ Rake::Task[:git_mark_release].invoke
+ end
+
+ task :publish do
+ Rake::Task[:git_push_release].invoke
+ Rake::Task[:gem_push].invoke
end
- sh "gem install pkg/#{name}-#{version}.gem"
+end
+
+task :git_mark_release do
sh "git commit --allow-empty -a -m 'Release #{version}'"
sh "git tag v#{version}"
+end
+
+task :git_push_release do
sh "git push origin master"
sh "git push origin v#{version}"
+end
+
+task :gem_push do
sh "gem push pkg/#{name}-#{version}.gem"
end

0 comments on commit 28d6e21

Please sign in to comment.