Class: GitCompound::Repository::RemoteFile::GitArchiveStrategy
- Inherits:
-
RemoteFileStrategy
- Object
- RemoteFileStrategy
- GitCompound::Repository::RemoteFile::GitArchiveStrategy
- Defined in:
- lib/git_compound/repository/remote_file/git_archive_strategy.rb
Overview
Git archive strategy
Instance Method Summary collapse
- #contents ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(source, ref, file) ⇒ GitArchiveStrategy
constructor
A new instance of GitArchiveStrategy.
- #reachable? ⇒ Boolean
Constructor Details
#initialize(source, ref, file) ⇒ GitArchiveStrategy
Returns a new instance of GitArchiveStrategy.
7 8 9 10 11 12 |
# File 'lib/git_compound/repository/remote_file/git_archive_strategy.rb', line 7 def initialize(source, ref, file) super opts = "--format=tar --remote=#{@source} #{@ref} -- #{@file} | tar -O -xf -" @command = GitCommand.new(:archive, opts) @command.execute! end |
Instance Method Details
#contents ⇒ Object
14 15 16 17 18 |
# File 'lib/git_compound/repository/remote_file/git_archive_strategy.rb', line 14 def contents raise FileUnreachableError unless reachable? raise FileNotFoundError unless exists? @command.output end |
#exists? ⇒ Boolean
24 25 26 |
# File 'lib/git_compound/repository/remote_file/git_archive_strategy.rb', line 24 def exists? @command.valid? end |
#reachable? ⇒ Boolean
20 21 22 |
# File 'lib/git_compound/repository/remote_file/git_archive_strategy.rb', line 20 def reachable? @command.valid? || @command.output.include?('did not match any files') end |