2015-09-03 17:25:43 +00:00
|
|
|
#!/usr/bin/env rake
|
|
|
|
# encoding: utf-8
|
|
|
|
|
2015-11-05 17:50:53 +00:00
|
|
|
require 'bundler'
|
|
|
|
require 'bundler/gem_tasks'
|
2015-09-02 02:13:59 +00:00
|
|
|
require 'rake/testtask'
|
2015-09-03 17:25:43 +00:00
|
|
|
require 'rubocop/rake_task'
|
2015-10-30 13:38:21 +00:00
|
|
|
require_relative 'tasks/maintainers'
|
2015-09-03 17:25:43 +00:00
|
|
|
|
|
|
|
# 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-10-13 09:29:10 +00:00
|
|
|
task default: [:test, :lint]
|
|
|
|
|
2015-09-02 02:13:59 +00:00
|
|
|
Rake::TestTask.new do |t|
|
|
|
|
t.libs << 'test'
|
2015-10-17 20:53:21 +00:00
|
|
|
t.pattern = 'test/unit/**/*_test.rb'
|
2015-09-02 02:13:59 +00:00
|
|
|
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-15 13:52:07 +00:00
|
|
|
Dir.glob('test/unit/*_test.rb').all? do |file|
|
2015-09-02 02:13:59 +00:00
|
|
|
sh(Gem.ruby, '-w', '-Ilib:test', file)
|
2015-09-14 08:29:31 +00:00
|
|
|
end or fail 'Failures'
|
2015-09-02 02:13:59 +00:00
|
|
|
end
|
2015-09-03 11:22:15 +00:00
|
|
|
|
2015-09-14 08:28:07 +00:00
|
|
|
task :resources do
|
2015-09-22 17:35:31 +00:00
|
|
|
tests = Dir['test/resource/*_test.rb']
|
2015-09-03 11:22:15 +00:00
|
|
|
return if tests.empty?
|
2015-09-22 15:43:08 +00:00
|
|
|
sh(Gem.ruby, 'test/docker_test.rb', *tests)
|
2015-09-03 11:22:15 +00:00
|
|
|
end
|
2015-10-21 20:52:41 +00:00
|
|
|
|
|
|
|
task :vm do
|
|
|
|
concurrency = ENV['CONCURRENCY'] || 4
|
|
|
|
path = File.join(File.dirname(__FILE__), 'test', 'integration')
|
|
|
|
sh('sh', '-c', "cd #{path} && bundle exec kitchen test -c #{concurrency} -t .")
|
|
|
|
end
|
2015-09-02 02:13:59 +00:00
|
|
|
end
|
2015-11-20 21:38:12 +00:00
|
|
|
|
|
|
|
# Automatically generate a changelog for this project. Only loaded if
|
|
|
|
# the necessary gem is installed.
|
|
|
|
begin
|
|
|
|
require 'github_changelog_generator/task'
|
2015-11-20 22:32:49 +00:00
|
|
|
require_relative 'lib/inspec/version'
|
2015-11-20 21:38:12 +00:00
|
|
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
2015-11-20 21:48:38 +00:00
|
|
|
config.since_tag = '0.7.0'
|
2015-11-20 22:32:49 +00:00
|
|
|
config.future_release = Inspec::VERSION
|
2015-11-20 21:38:12 +00:00
|
|
|
end
|
|
|
|
rescue LoadError
|
|
|
|
end
|