Skip to content

Commit

Permalink
Add bundler release tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfranca committed May 5, 2017
1 parent c7e6a3c commit f4aa035
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env rake
require 'rake/testtask'
require 'rake/packagetask'
require 'rubygems/package_task'
require 'bundler'
Bundler::GemHelper.install_tasks

desc "Default Task"
task :default => [ :test ]
Expand Down Expand Up @@ -48,29 +48,3 @@ task :lines do

puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
end

# Publishing ------------------------------------------------------

spec = eval(File.read('activeresource.gemspec'))
gem = "pkg/activeresource-#{spec.version}.gem"
tag = "v#{spec.version}"

desc "Release to rubygems.org"
task :release => [:ensure_clean_state, :tag, :push]

task(:tag) { sh "git tag #{tag} && git push --tags" }

task(:push => :repackage) { sh "gem push #{gem}" }
task(:install => :repackage) { sh "gem install #{gem}" }
Gem::PackageTask.new(spec) { |p| p.gem_spec = spec }

task :ensure_clean_state do
unless `git status -s`.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

0 comments on commit f4aa035

Please sign in to comment.