Class: SupplyDrop::SyntaxChecker
- Inherits:
-
Object
- Object
- SupplyDrop::SyntaxChecker
- Defined in:
- lib/supply_drop/syntax_checker.rb
Instance Method Summary collapse
-
#initialize(path) ⇒ SyntaxChecker
constructor
A new instance of SyntaxChecker.
- #validate_puppet_files ⇒ Object
- #validate_templates ⇒ Object
Constructor Details
#initialize(path) ⇒ SyntaxChecker
Returns a new instance of SyntaxChecker.
3 4 5 |
# File 'lib/supply_drop/syntax_checker.rb', line 3 def initialize(path) @path = path end |
Instance Method Details
#validate_puppet_files ⇒ Object
7 8 9 10 11 12 |
# File 'lib/supply_drop/syntax_checker.rb', line 7 def validate_puppet_files Dir.glob("#{@path}/**/*.pp").map do |puppet_file| output = `puppet parser validate #{puppet_file}` $?.to_i == 0 ? nil : [puppet_file, output] end.compact end |
#validate_templates ⇒ Object
14 15 16 17 18 19 |
# File 'lib/supply_drop/syntax_checker.rb', line 14 def validate_templates Dir.glob("#{@path}/**/*.erb").map do |template_file| output = `erb -x -T '-' #{template_file} | ruby -c 2>&1` $?.to_i == 0 ? nil : [template_file, output] end.compact end |