2014-08-28 23:13:12 +00:00
|
|
|
require 'rubygems'
|
2014-09-12 23:13:19 +00:00
|
|
|
require 'fileutils'
|
2014-08-29 21:01:42 +00:00
|
|
|
require "bundler/gem_tasks"
|
2014-08-28 23:13:12 +00:00
|
|
|
require 'rspec/core/rake_task'
|
2014-08-29 21:01:42 +00:00
|
|
|
require 'rake/extensiontask'
|
2016-02-03 13:02:50 +00:00
|
|
|
require 'ci/reporter/rake/rspec'
|
2014-05-30 19:58:38 +00:00
|
|
|
|
2014-08-29 21:01:42 +00:00
|
|
|
Rake::ExtensionTask.new do |t|
|
2015-06-23 16:01:31 +00:00
|
|
|
t.name = 'hermann_rdkafka'
|
2014-08-29 21:01:42 +00:00
|
|
|
t.ext_dir = 'ext/hermann'
|
|
|
|
t.gem_spec = Gem::Specification.load('hermann.gemspec')
|
2014-05-30 19:58:38 +00:00
|
|
|
end
|
|
|
|
|
2014-10-30 16:47:11 +00:00
|
|
|
def add_rspec_options(options)
|
2014-10-08 16:45:07 +00:00
|
|
|
if RUBY_PLATFORM == 'java'
|
|
|
|
options << '--tag ~platform:mri'
|
|
|
|
else
|
|
|
|
options << '--tag ~platform:java'
|
|
|
|
end
|
2014-10-30 16:47:11 +00:00
|
|
|
return options
|
|
|
|
end
|
|
|
|
|
|
|
|
RSpec::Core::RakeTask.new(:spec) do |r|
|
|
|
|
options = add_rspec_options(['--tag ~type:integration'])
|
2014-10-08 16:45:07 +00:00
|
|
|
|
|
|
|
r.rspec_opts = options.join(' ')
|
2014-09-09 18:18:08 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
namespace :spec do
|
|
|
|
RSpec::Core::RakeTask.new(:integration) do |r|
|
2014-10-30 16:47:11 +00:00
|
|
|
options = add_rspec_options(['--tag type:integration'])
|
|
|
|
r.rspec_opts = options.join(' ')
|
2014-09-09 18:18:08 +00:00
|
|
|
end
|
|
|
|
end
|
2014-08-29 18:00:35 +00:00
|
|
|
|
2014-09-12 23:13:19 +00:00
|
|
|
desc 'Remove the entire ./tmp directory'
|
|
|
|
task :removetmp do
|
|
|
|
FileUtils.rm_rf('tmp')
|
|
|
|
end
|
|
|
|
|
|
|
|
task :clean => [:removetmp]
|
2014-10-08 17:10:08 +00:00
|
|
|
|
|
|
|
if RUBY_PLATFORM == 'java'
|
|
|
|
task :default => [:clean, :spec]
|
|
|
|
else
|
2014-10-15 19:33:25 +00:00
|
|
|
task :build => [:compile]
|
2014-10-08 17:10:08 +00:00
|
|
|
task :default => [:clean, :build, :spec]
|
|
|
|
end
|
2014-08-29 21:01:42 +00:00
|
|
|
|