Permalink
Browse files

Updating rake tasks to the latest version of Mr Bones. These tasks ha…

…ve Git support.
  • Loading branch information...
1 parent db8bedd commit d024f893b86384d1b152f0a46dde4fb94d1f6c71 @TwP TwP committed Jun 3, 2008
Showing with 52 additions and 3 deletions.
  1. +10 −2 tasks/gem.rake
  2. +41 −0 tasks/git.rake
  3. +1 −1 tasks/rubyforge.rake
View
@@ -91,8 +91,11 @@ namespace :gem do
end
desc 'Install the gem'
- task :install => [:clobber, :package] do
- sh "#{SUDO} #{GEM} install --no-update-sources pkg/#{PROJ.gem._spec.full_name}"
+ task :install => [:clobber, 'gem:package'] do
+ sh "#{SUDO} #{GEM} install --local pkg/#{PROJ.gem._spec.full_name}"
+
+ # use this version of the command for rubygems > 1.0.0
+ #sh "#{SUDO} #{GEM} install --no-update-sources pkg/#{PROJ.gem._spec.full_name}"
end
desc 'Uninstall the gem'
@@ -106,6 +109,11 @@ namespace :gem do
desc 'Reinstall the gem'
task :reinstall => [:uninstall, :install]
+ desc 'Cleanup the gem'
+ task :cleanup do
+ sh "#{SUDO} #{GEM} cleanup #{PROJ.gem._spec.name}"
+ end
+
end # namespace :gem
desc 'Alias to gem:package'
View
@@ -0,0 +1,41 @@
+# $Id$
+
+if HAVE_GIT
+
+namespace :git do
+
+ # A prerequisites task that all other tasks depend upon
+ task :prereqs
+
+ desc 'Show tags from the Git repository'
+ task :show_tags => 'git:prereqs' do |t|
+ puts %x/git tag/
+ end
+
+ desc 'Create a new tag in the Git repository'
+ task :create_tag => 'git:prereqs' do |t|
+ v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
+ abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
+
+ tag = "%s-%s" % [PROJ.name, PROJ.version]
+ msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
+
+ puts "Creating Git tag '#{tag}'"
+ unless system "git tag -a -m '#{msg}' #{tag}"
+ abort "Tag creation failed"
+ end
+
+ if %x/git remote/ =~ %r/^origin\s*$/
+ unless system "git push origin #{tag}"
+ abort "Could not push tag to remote Git repository"
+ end
+ end
+ end
+
+end # namespace :git
+
+task 'gem:release' => 'git:create_tag'
+
+end # if HAVE_GIT
+
+# EOF
View
@@ -7,7 +7,7 @@ require 'rake/contrib/sshpublisher'
namespace :gem do
desc 'Package and upload to RubyForge'
- task :release => [:clobber, :package] do |t|
+ task :release => [:clobber, 'gem:package'] do |t|
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
pkg = "pkg/#{PROJ.gem._spec.full_name}"

0 comments on commit d024f89

Please sign in to comment.