diff --git a/Rakefile b/Rakefile index 46c018c..5c056ac 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,9 @@ +require 'ffi' require 'rake/extensiontask' require 'rake/testtask' +require 'rake/version_task' require 'rubygems/package_task' -require 'ffi' +require 'rubygems/gem_runner' def gemspec @gemspec ||= Gem::Specification.load('process_shared.gemspec') @@ -23,9 +25,28 @@ Rake::TestTask.new(:test => [:compile]) do |t| t.libs.push 'spec' end -Gem::PackageTask.new(gemspec) do |p| +pkg = Gem::PackageTask.new(gemspec) do |p| p.need_tar = true p.gem_spec = gemspec end task :gem => :compile + +Rake::VersionTask.new do |t| + t.with_git_tag = true +end + +task :push => :gem do + gem_file = File.basename gemspec.cache_file + gem_path = File.join pkg.package_dir, gem_file + Gem::GemRunner.new.run(["push", gem_path]) +end + +if Version.current.prerelease? + vrelease = Version.current.bump! + desc "Release version #{vrelease}" + task :release => [:test, 'version:bump'] do + # must run in subprocess so tasks use newwer versioned gemspec + sh %{rake push version:bump:pre} + end +end diff --git a/process_shared.gemspec b/process_shared.gemspec index 8803172..71405aa 100644 --- a/process_shared.gemspec +++ b/process_shared.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'process_shared' - s.version = '0.1.1' + s.version = File.read(File.expand_path('../VERSION', __FILE__)) s.platform = Gem::Platform::RUBY s.has_rdoc = true s.extra_rdoc_files = ["README.rdoc", "ChangeLog", "COPYING"] @@ -18,4 +18,5 @@ Gem::Specification.new do |s| s.add_development_dependency('rake-compiler') s.add_development_dependency('minitest') s.add_development_dependency('minitest-matchers') + s.add_development_dependency('version') end