2015-09-03 17:25:43 +00:00
|
|
|
#!/usr/bin/env rake
|
|
|
|
# encoding: utf-8
|
|
|
|
|
2015-09-02 02:13:59 +00:00
|
|
|
require 'rake/testtask'
|
2015-09-03 17:25:43 +00:00
|
|
|
require 'rubocop/rake_task'
|
|
|
|
|
|
|
|
# Rubocop
|
|
|
|
desc 'Run Rubocop lint checks'
|
|
|
|
task :rubocop do
|
|
|
|
RuboCop::RakeTask.new
|
|
|
|
end
|
|
|
|
|
|
|
|
# lint the project
|
|
|
|
desc 'Run robocop linter'
|
|
|
|
task lint: [:rubocop]
|
2015-09-02 02:13:59 +00:00
|
|
|
|
2015-09-03 17:25:43 +00:00
|
|
|
# run tests
|
2015-09-02 02:13:59 +00:00
|
|
|
task :default => :test
|
|
|
|
Rake::TestTask.new do |t|
|
|
|
|
t.libs << 'test'
|
|
|
|
t.pattern = 'test/**/*_test.rb'
|
|
|
|
t.warning = true
|
|
|
|
t.verbose = true
|
2015-09-03 18:35:23 +00:00
|
|
|
t.ruby_opts = ['--dev'] if defined?(JRUBY_VERSION)
|
2015-09-02 02:13:59 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
namespace :test do
|
|
|
|
task :isolated do
|
2015-09-03 18:35:23 +00:00
|
|
|
Dir.glob('test/**/*_test.rb').all? do |file|
|
2015-09-02 02:13:59 +00:00
|
|
|
sh(Gem.ruby, '-w', '-Ilib:test', file)
|
2015-09-03 18:35:23 +00:00
|
|
|
end or raise 'Failures'
|
2015-09-02 02:13:59 +00:00
|
|
|
end
|
2015-09-03 11:22:15 +00:00
|
|
|
|
|
|
|
task :integration do
|
2015-09-03 18:35:23 +00:00
|
|
|
tests = Dir['test/resource/*.rb']
|
2015-09-03 11:22:15 +00:00
|
|
|
return if tests.empty?
|
2015-09-03 12:16:11 +00:00
|
|
|
sh(Gem.ruby, 'test/docker.rb', *tests)
|
2015-09-03 11:22:15 +00:00
|
|
|
end
|
2015-09-02 02:13:59 +00:00
|
|
|
end
|