mirror of
https://github.com/genebean/dots.git
synced 2026-03-27 01:17:42 -04:00
More testing
This commit is contained in:
parent
d008f064cc
commit
1241ef7c85
9 changed files with 65 additions and 23 deletions
37
Rakefile
37
Rakefile
|
|
@ -1,3 +1,4 @@
|
|||
require 'rubocop/rake_task'
|
||||
require 'rubygems'
|
||||
require 'puppetlabs_spec_helper/rake_tasks'
|
||||
require 'puppet-lint/tasks/puppet-lint'
|
||||
|
|
@ -9,28 +10,56 @@ exclude_paths = [
|
|||
'spec/**/*'
|
||||
]
|
||||
|
||||
RuboCop::RakeTask.new
|
||||
RuboCop::RakeTask.new(:rubocop) do |task|
|
||||
# task.patterns = ['lib/**/*.rb']
|
||||
# only show the files with failures
|
||||
# task.formatters = ['files']
|
||||
# don't abort rake on failure
|
||||
# task.fail_on_error = false
|
||||
end
|
||||
|
||||
PuppetLint.configuration.fail_on_warnings = true
|
||||
PuppetLint.configuration.ignore_paths = exclude_paths
|
||||
PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{check}:%{KIND}:%{message}'
|
||||
PuppetLint.configuration.log_format =
|
||||
'%{path}:%{linenumber}:%{check}:%{KIND}:%{message}'
|
||||
|
||||
PuppetSyntax.exclude_paths = exclude_paths
|
||||
|
||||
desc 'Validate manifests, templates, and ruby files'
|
||||
task :validate do
|
||||
Dir['puppet/manifests/**/*.pp', 'puppet/site/*/manifests/**/*.pp'].each do |manifest|
|
||||
Dir['puppet/manifests/**/*.pp',
|
||||
'puppet/site/*/manifests/**/*.pp'].each do |manifest|
|
||||
sh "puppet parser validate --noop #{manifest}"
|
||||
end
|
||||
Dir['bin/**/*.rb', 'spec/**/*.rb'].each do |ruby_file|
|
||||
# sh "ruby -c #{ruby_file}" unless ruby_file.match? %r{spec\/fixtures}
|
||||
Dir['bin/**/*.rb',
|
||||
'spec/**/*.rb'].each do |ruby_file|
|
||||
# rubocop:disable RegexpLiteral
|
||||
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
|
||||
# rubocop:enable RegexpLiteral
|
||||
end
|
||||
Dir['puppet/site/*/templates/**/*.erb'].each do |template|
|
||||
sh "erb -P -x -T '-' #{template} | ruby -c"
|
||||
end
|
||||
end
|
||||
|
||||
YamlLint::RakeTask.new do |yamllint|
|
||||
yamllint.paths = %w[
|
||||
.*.yaml
|
||||
.*.yml
|
||||
*.yaml
|
||||
*.yml
|
||||
copy/**/*.yml
|
||||
link/**/*.yml
|
||||
puppet/hieradata/**/*.yml
|
||||
puppet/hieradata/**/*.yaml
|
||||
]
|
||||
end
|
||||
|
||||
task :tests do
|
||||
Rake::Task[:lint].invoke
|
||||
Rake::Task[:yamllint].invoke
|
||||
Rake::Task[:validate].invoke
|
||||
Rake::Task[:rubocop].invoke
|
||||
Rake::Task[:spec].invoke
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue