class Librarian::Puppet::Source::Git
Public Instance Methods
Source
# File lib/librarian/puppet/source/git.rb, line 27 def cache! return vendor_checkout! if vendor_cached? if environment.local? raise Error, "Could not find a local copy of #{uri}#{" at #{sha}" unless sha.nil?}." end begin super rescue Librarian::Posix::CommandFailure => e raise Error, "Could not checkout #{uri}#{" at #{sha}" unless sha.nil?}: #{e}" end if strip_dot_git? and repository.git? repository.path.join('.git').rmtree end cache_in_vendor(repository.path) if environment.vendor? end
Calls superclass method
Private Instance Methods
Source
# File lib/librarian/puppet/source/git.rb, line 74 def cache_in_vendor(tmp_path) Librarian::Posix.run!(%W[git archive -o #{vendor_tar} #{sha}], chdir: tmp_path.to_s) Librarian::Posix.run!(%W[gzip #{vendor_tar}], chdir: tmp_path.to_s) end
Source
# File lib/librarian/puppet/source/git.rb, line 61 def strip_dot_git? environment.config_db.local["install.strip-dot-git"] == '1' end
Source
# File lib/librarian/puppet/source/git.rb, line 57 def vendor_cached? vendor_tgz.exist? end
Source
# File lib/librarian/puppet/source/git.rb, line 65 def vendor_checkout! repository.path.rmtree if repository.path.exist? repository.path.mkpath Librarian::Posix.run!(%W[tar xzf #{vendor_tgz}], chdir: repository.path.to_s) repository_cached! end
Source
# File lib/librarian/puppet/source/git.rb, line 49 def vendor_tar environment.vendor_source.join("#{sha}.tar") end
Source
# File lib/librarian/puppet/source/git.rb, line 53 def vendor_tgz environment.vendor_source.join("#{sha}.tar.gz") end