process_shared/Rakefile

54 lines
1.2 KiB
Ruby
Raw Normal View History

2012-02-09 14:14:47 +00:00
require 'ffi'
2011-12-12 03:39:55 +00:00
require 'rake/extensiontask'
require 'rake/testtask'
2012-02-09 14:14:47 +00:00
require 'rake/version_task'
2011-12-12 03:39:55 +00:00
require 'rubygems/package_task'
2012-02-09 14:14:47 +00:00
require 'rubygems/gem_runner'
require 'ci/reporter/rake/minitest'
2011-12-12 03:39:55 +00:00
def gemspec
@gemspec ||= Gem::Specification.load('process_shared.gemspec')
2011-12-12 03:39:55 +00:00
end
Rake::ExtensionTask.new('helper') do |ext|
ext.lib_dir = 'lib/process_shared/posix'
end
2011-12-12 03:39:55 +00:00
desc 'Run the tests'
task :default => [:test]
Rake::TestTask.new(:test => [:compile]) do |t|
if FFI::Platform.mac?
t.pattern = 'spec/**/*_spec.rb' # only include mach tests on mac
else
t.pattern = 'spec/process_shared/**/*_spec.rb'
end
2011-12-12 03:39:55 +00:00
t.libs.push 'spec'
end
2012-02-09 14:14:47 +00:00
pkg = Gem::PackageTask.new(gemspec) do |p|
2011-12-12 03:39:55 +00:00
p.need_tar = true
p.gem_spec = gemspec
end
task :gem => :compile
2012-02-09 14:14:47 +00:00
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