# encoding: utf-8 module LocalPac module Actions class ValidatePacFile private attr_reader :path, :validator, :creator public def initialize(path, creator = File, validator = PacFileValidator.new) @path = path @validator = validator @creator = creator end def run file = creator.new(path, ::File.read(path)) if validator.valid?(file) puts "File \"#{file.path}\" is a valid pac file." else puts "File \"#{file.path}\" is not a valid pac file:" puts validator.errors(file) end rescue Errno::EISDIR => e raise Exceptions::PacFileInvalid, e.message end end end end