Class: PuppetLint::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- PuppetLint::RakeTask
- Defined in:
- lib/puppet-lint/tasks/puppet-lint.rb
Overview
Public: A Rake task that can be loaded and used with everything you need.
Examples
require 'puppet-lint'
PuppetLint::RakeTask.new
Instance Method Summary collapse
-
#initialize(*args) ⇒ RakeTask
constructor
Public: Initialise a new PuppetLint::RakeTask.
Constructor Details
#initialize(*args) ⇒ RakeTask
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/puppet-lint/tasks/puppet-lint.rb', line 21 def initialize(*args) desc 'Run puppet-lint' task :lint do PuppetLint.configuration.with_filename = true PuppetLint::OptParser.build RakeFileUtils.send(:verbose, true) do linter = PuppetLint.new matched_files = FileList['**/*.pp'] if ignore_paths = PuppetLint.configuration.ignore_paths matched_files = matched_files.exclude(*ignore_paths) end matched_files.to_a.each do |puppet_file| linter.file = puppet_file linter.run linter.print_problems end abort if linter.errors? || ( linter.warnings? && PuppetLint.configuration.fail_on_warnings ) end end end |