2021-01-29 11:27:31 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-02-16 12:38:48 +01:00
|
|
|
require 'rake/testtask'
|
2014-06-16 16:20:21 +02:00
|
|
|
require 'rubocop/rake_task'
|
2014-06-05 10:50:37 +02:00
|
|
|
|
2014-06-16 16:20:21 +02:00
|
|
|
# Rubocop
|
|
|
|
desc 'Run Rubocop lint checks'
|
|
|
|
task :rubocop do
|
2014-06-22 12:57:10 +02:00
|
|
|
RuboCop::RakeTask.new
|
2014-06-16 16:20:21 +02:00
|
|
|
end
|
|
|
|
|
2016-02-16 12:38:48 +01:00
|
|
|
# lint the project
|
|
|
|
desc 'Run robocop linter'
|
|
|
|
task lint: [:rubocop]
|
2014-06-16 16:20:21 +02:00
|
|
|
|
2016-02-16 12:38:48 +01:00
|
|
|
# run tests
|
|
|
|
task default: [:lint, 'test:check']
|
2014-06-05 10:50:37 +02:00
|
|
|
|
2016-02-16 12:38:48 +01:00
|
|
|
namespace :test do
|
|
|
|
# run inspec check to verify that the profile is properly configured
|
|
|
|
task :check do
|
2019-05-14 23:35:51 +01:00
|
|
|
require 'inspec'
|
|
|
|
puts "Checking profile with InSpec Version: #{Inspec::VERSION}"
|
|
|
|
profile = Inspec::Profile.for_target('.', backend: Inspec::Backend.create(Inspec::Config.mock))
|
|
|
|
pp profile.check
|
2014-06-05 10:50:37 +02:00
|
|
|
end
|
|
|
|
end
|