Sha256: 6b4e65bd1468e831ed16856f6bdfd32c9d7b16629cd2bfa9d2fd8ce2212e3b95

Contents?: true

Size: 1007 Bytes

Versions: 9

Compression:

Stored size: 1007 Bytes

Contents

# 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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
local_pac-0.10.2 lib/local_pac/actions/show_available_proxy_pac_files.rb
local_pac-0.10.1 lib/local_pac/actions/show_available_proxy_pac_files.rb
local_pac-0.10.0 lib/local_pac/actions/show_available_proxy_pac_files.rb
local_pac-0.9.0 lib/local_pac/actions/show_available_proxy_pac_files.rb
local_pac-0.7.0 lib/local_pac/actions/show_available_proxy_pac_files.rb
local_pac-0.6.3 lib/local_pac/actions/show_available_proxy_pac_files.rb
local_pac-0.6.2 lib/local_pac/actions/show_available_proxy_pac_files.rb
local_pac-0.6.1 lib/local_pac/actions/show_available_proxy_pac_files.rb
local_pac-0.5.0 lib/local_pac/actions/show_available_proxy_pac_files.rb