# File lib/chef/cookbook/syntax_check.rb, line 110 def validate_template(erb_file) Chef::Log.debug("Testing template #{erb_file} for syntax errors...") result = shell_out("sh -c 'erubis -x #{erb_file} | ruby -c'") result.error! true rescue Chef::Exceptions::ShellCommandFailed file_relative_path = erb_file[/^#{Regexp.escape(cookbook_path+File::Separator)}(.*)/, 1] Chef::Log.fatal("Erb template #{file_relative_path} has a syntax error:") result.stderr.each_line { |l| Chef::Log.fatal(l.chomp) } false end