
Introduce rspec tests for this functionality Change-Id: Ib52d2d3d7cfe4301af0f423d186fe01c3590918f
34 lines
1.0 KiB
Ruby
34 lines
1.0 KiB
Ruby
require 'rubygems'
|
|
require 'puppetlabs_spec_helper/rake_tasks'
|
|
require 'puppet-lint/tasks/puppet-lint'
|
|
require 'rspec/core/rake_task'
|
|
PuppetLint.configuration.send('disable_80chars')
|
|
PuppetLint.configuration.send('disable_autoloader_layout')
|
|
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
|
|
|
|
desc "Validate manifests, templates, and ruby files"
|
|
task :validate do
|
|
Dir['manifests/**/*.pp'].each do |manifest|
|
|
sh "puppet parser validate --noop #{manifest}"
|
|
end
|
|
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
|
|
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
|
|
end
|
|
Dir['templates/**/*.erb'].each do |template|
|
|
sh "erb -P -x -T '-' #{template} | ruby -c"
|
|
end
|
|
end
|
|
|
|
task :lint do
|
|
Dir['manifests/**/*.pp'].each do |manifest|
|
|
sh "puppet-lint --no-80chars-check --no-autoloader_layout-check #{manifest}"
|
|
end
|
|
end
|
|
|
|
begin
|
|
require 'kitchen/rake_tasks'
|
|
Kitchen::RakeTasks.new
|
|
rescue LoadError
|
|
puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI']
|
|
end
|