2016-02-16 11:38:48 +00:00
|
|
|
require 'rake/testtask'
|
2014-06-16 14:20:21 +00:00
|
|
|
require 'rubocop/rake_task'
|
2014-06-05 08:50:37 +00:00
|
|
|
|
2014-06-16 14:20:21 +00:00
|
|
|
# Rubocop
|
|
|
|
desc 'Run Rubocop lint checks'
|
|
|
|
task :rubocop do
|
2014-06-22 10:57:10 +00:00
|
|
|
RuboCop::RakeTask.new
|
2014-06-16 14:20:21 +00:00
|
|
|
end
|
|
|
|
|
2016-02-16 11:38:48 +00:00
|
|
|
# lint the project
|
|
|
|
desc 'Run robocop linter'
|
|
|
|
task lint: [:rubocop]
|
2014-06-16 14:20:21 +00:00
|
|
|
|
2016-02-16 11:38:48 +00:00
|
|
|
# run tests
|
|
|
|
task default: [:lint, 'test:check']
|
2014-06-05 08:50:37 +00:00
|
|
|
|
2016-02-16 11:38:48 +00:00
|
|
|
namespace :test do
|
|
|
|
# run inspec check to verify that the profile is properly configured
|
|
|
|
task :check do
|
2019-05-14 22:35:51 +00: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 08:50:37 +00:00
|
|
|
end
|
|
|
|
end
|
2016-12-21 10:40:56 +00:00
|
|
|
|
2019-05-14 22:35:51 +00:00
|
|
|
task :changelog do
|
|
|
|
# Automatically generate a changelog for this project. Only loaded if
|
|
|
|
# the necessary gem is installed. By default its picking up the version from
|
|
|
|
# inspec.yml. You can override that behavior with `rake changelog to=1.2.0`
|
|
|
|
begin
|
|
|
|
require 'yaml'
|
|
|
|
metadata = YAML.load_file('inspec.yml')
|
|
|
|
v = ENV['to'] || metadata['version']
|
|
|
|
puts " * Generating changelog for version #{v}"
|
|
|
|
require 'github_changelog_generator/task'
|
|
|
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
|
|
|
config.future_release = v
|
|
|
|
config.user = 'dev-sec'
|
|
|
|
config.project = 'linux-baseline'
|
|
|
|
end
|
|
|
|
Rake::Task[:changelog].execute
|
|
|
|
rescue LoadError
|
|
|
|
puts '>>>>> GitHub Changelog Generator not loaded, omitting tasks'
|
2016-12-21 10:40:56 +00:00
|
|
|
end
|
|
|
|
end
|