process_shared/Rakefile

74 lines
1.7 KiB
Ruby
Raw Normal View History

2012-03-24 18:27:42 +00:00
require 'ci/reporter/rake/minitest'
2012-02-09 14:14:47 +00:00
require 'ffi'
2012-03-24 18:27:42 +00:00
require 'fileutils'
require 'flog'
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'
require 'rubygems/gem_runner'
2012-03-24 18:27:42 +00:00
require 'rubygems/package_task'
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
2012-03-24 18:27:42 +00:00
desc 'Generate flog reports for all ruby code'
task :flog do
opts = {
:all => true,
:blame => true,
:details => true,
:group => true
}
flog = Flog.new(opts)
flog.flog('lib')
out = 'target/reports/flog.txt'
FileUtils.mkdir_p(File.dirname(out))
File.open('target/reports/flog.txt', 'wb') {|io| flog.report io }
end
desc 'Run test for CI environment with xunit reports and flog'
task :ci_test => ['ci:setup:minitest', :test, :flog]