Sha256: 8de598b93c3669b99f952b4a9d80e068e0f00a194cebda4b158e430e7760bd0a

Contents?: true

Size: 755 Bytes

Versions: 8

Compression:

Stored size: 755 Bytes

Contents

# encoding: utf-8
module LocalPac
  module Actions
    class ShowPacFile
      private

      attr_reader :name, :repo, :options, :vcs_engine, :storage_path

      public

      def initialize(file, storage_path, options = {}, vcs_engine = GitStorage)
        @name         = ::File.basename(file, '.pac').to_sym
        @storage_path = storage_path
        @options      = options
        @vcs_engine   = vcs_engine
      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

        puts repo[name].content
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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