# encoding: utf-8 module LocalPac module Actions class ShowAvailableProxyPacFiles private attr_reader :repo, :options, :vcs_engine, :storage_path, :validator public def initialize(storage_path, options = {}, vcs_engine = GitStorage, validator = PacFileValidator.new) @options = options @vcs_engine = vcs_engine @storage_path = storage_path @validator = validator end def run begin @repo = vcs_engine.new(storage_path) rescue Rugged::OSError raise Exceptions::RepositoryDoesNotExist, "Sorry, but the repository at #{storage_path} does not exist" unless ::Dir.exists? storage_path end printf "%20s | %-20s | %-10s\n", 'Name', 'Path', 'Valid?' printf "%20s-+-%-20s-+-%-10s\n", '-' * 20, '-' * 20, '-' * 10 repo.each_pac_file do |f| printf "%20s | %-20s | %-10s\n", f.name, f.path, validator.valid?(f) end end end end end