Sha256: 68f731498424b2a4d2421989fa93c6d806eabf0a27032b6db605cf4c5f1993e7

Contents?: true

Size: 754 Bytes

Versions: 8

Compression:

Stored size: 754 Bytes

Contents

module GitCompound
  module Repository
    class RemoteFile
      # Git archive strategy
      #
      class GitArchiveStrategy < RemoteFileStrategy
        def initialize(source, ref, file)
          super
          opts = "--format=tar --remote=#{@source} #{@ref} -- #{@file} | tar -O -xf -"
          @command = GitCommand.new(:archive, opts)
          @command.execute!
        end

        def contents
          raise FileUnreachableError unless reachable?
          raise FileNotFoundError unless exists?
          @command.output
        end

        def reachable?
          @command.valid? || @command.output.include?('did not match any files')
        end

        def exists?
          @command.valid?
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
git_compound-0.2.2 lib/git_compound/repository/remote_file/git_archive_strategy.rb
git_compound-0.2.1 lib/git_compound/repository/remote_file/git_archive_strategy.rb
git_compound-0.2.0 lib/git_compound/repository/remote_file/git_archive_strategy.rb
git_compound-0.1.2 lib/git_compound/repository/remote_file/git_archive_strategy.rb
git_compound-0.1.1 lib/git_compound/repository/remote_file/git_archive_strategy.rb
git_compound-0.1.0 lib/git_compound/repository/remote_file/git_archive_strategy.rb
git_compound-0.0.10 lib/git_compound/repository/remote_file/git_archive_strategy.rb
git_compound-0.0.9 lib/git_compound/repository/remote_file/git_archive_strategy.rb