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'
|
2011-12-12 03:39:55 +00:00
|
|
|
|
|
|
|
def gemspec
|
2012-02-08 02:46:21 +00:00
|
|
|
@gemspec ||= Gem::Specification.load('process_shared.gemspec')
|
2011-12-12 03:39:55 +00:00
|
|
|
end
|
|
|
|
|
2012-01-30 04:52:03 +00:00
|
|
|
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]
|
|
|
|
|
2011-12-12 03:47:16 +00:00
|
|
|
Rake::TestTask.new(:test => [:compile]) do |t|
|
2012-02-08 02:44:53 +00:00
|
|
|
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
|
2012-01-30 04:52:03 +00:00
|
|
|
|
|
|
|
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
|