Skip to content
This repository has been archived by the owner on May 1, 2018. It is now read-only.

Commit

Permalink
Update rake tasks to publish gem
Browse files Browse the repository at this point in the history
  • Loading branch information
webmat committed Dec 7, 2011
1 parent 4b7bda0 commit c95d3e0
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions tasks/gem.rake
Expand Up @@ -35,6 +35,7 @@ Gem::PackageTask.new(spec) do |p|
end end


TAG_COMMAND = "git tag -m 'Tagging version #{GitRemoteBranch::VERSION::STRING}' -a v#{GitRemoteBranch::VERSION::STRING}" TAG_COMMAND = "git tag -m 'Tagging version #{GitRemoteBranch::VERSION::STRING}' -a v#{GitRemoteBranch::VERSION::STRING}"
push_tags_command = 'git push --tags'
task :tag_warn do task :tag_warn do
puts "*" * 40, puts "*" * 40,
"Don't forget to tag the release:", "Don't forget to tag the release:",
Expand All @@ -46,32 +47,29 @@ task :tag_warn do
end end
task :tag do task :tag do
sh TAG_COMMAND sh TAG_COMMAND
puts "Upload tags to repo with 'git push --tags'" puts "Upload tags to repo with '#{push_tags_command}'"
end end
task :gem => :tag_warn task :gem => :tag_warn


namespace :gem do namespace :gem do
desc "Update the gemspec for GitHub's gem server" desc 'Upload gem to rubygems.org'
task :github do task :publish => :gem do
File.open("#{GitRemoteBranch::NAME}.gemspec", 'w'){|f| f.puts YAML::dump(spec) } sh "gem push pkg/#{spec.full_name}.gem"
puts "gemspec generated here: #{GitRemoteBranch::NAME}.gemspec"
end

desc 'Upload gem to rubyforge.org'
task :rubyforge => :gem do
sh 'rubyforge login'
sh "rubyforge add_release grb grb '#{GitRemoteBranch::VERSION::STRING}' pkg/#{spec.full_name}.gem"
sh "rubyforge add_file grb grb #{GitRemoteBranch::VERSION::STRING} pkg/#{spec.full_name}.gem"
end end


desc 'Install the gem built locally' desc 'Install the gem built locally'
task :install => [:clean, :gem] do task :install => [:clean, :gem] do
sh "#{SUDO} gem install pkg/#{spec.full_name}.gem" sh "gem install pkg/#{spec.full_name}.gem"
end end


desc "Uninstall version #{GitRemoteBranch::VERSION::STRING} of the gem" desc "Uninstall version #{GitRemoteBranch::VERSION::STRING} of the gem"
task :uninstall do task :uninstall do
sh "#{SUDO} gem uninstall -v #{GitRemoteBranch::VERSION::STRING} -x #{GitRemoteBranch::NAME}" sh "gem uninstall -v #{GitRemoteBranch::VERSION::STRING} -x #{GitRemoteBranch::NAME}"
end

desc "Build and publish the gem, tag the commit and push the tags in one command"
task :feeling_lucky => [:gem, :publish, :tag] do
sh push_tags_command
end end


if WINDOWS if WINDOWS
Expand Down

0 comments on commit c95d3e0

Please sign in to comment.