Class: GitDownloadStrategy

Inherits:
VCSDownloadStrategy show all
Defined in:
Library/Homebrew/download_strategy.rb

Direct Known Subclasses

GitHubGitDownloadStrategy

Constant Summary collapse

SHALLOW_CLONE_WHITELIST =
[
  %r{git://},
  %r{https://github\.com},
  %r{http://git\.sv\.gnu\.org},
  %r{http://llvm\.org},
].freeze

Constants inherited from VCSDownloadStrategy

VCSDownloadStrategy::REF_TYPES

Instance Attribute Summary

Attributes inherited from AbstractDownloadStrategy

#cached_location, #meta, #name, #resource, #shutup, #version

Instance Method Summary collapse

Methods inherited from VCSDownloadStrategy

#cached_location, #commit_outdated?, #fetch, #fetch_last_commit

Methods inherited from AbstractDownloadStrategy

#clear_cache, #expand_safe_system_args, #fetch, #ohai, #puts, #quiet_safe_system, #safe_system, #shutup!

Methods included from FileUtils

#make, mkdir, mktemp, #old_mkdir, #old_ruby, #ruby, #scons, #xcodebuild

Constructor Details

#initialize(name, resource) ⇒ GitDownloadStrategy

Returns a new instance of GitDownloadStrategy



696
697
698
699
700
701
# File 'Library/Homebrew/download_strategy.rb', line 696

def initialize(name, resource)
  super
  @ref_type ||= :branch
  @ref ||= "master"
  @shallow = meta.fetch(:shallow) { true }
end

Instance Method Details

#last_commitObject



712
713
714
# File 'Library/Homebrew/download_strategy.rb', line 712

def last_commit
  Utils.popen_read("git", "--git-dir", git_dir, "rev-parse", "--short=7", "HEAD").chomp
end

#source_modified_timeObject



708
709
710
# File 'Library/Homebrew/download_strategy.rb', line 708

def source_modified_time
  Time.parse Utils.popen_read("git", "--git-dir", git_dir, "show", "-s", "--format=%cD")
end

#stageObject



703
704
705
706
# File 'Library/Homebrew/download_strategy.rb', line 703

def stage
  super
  cp_r File.join(cached_location, "."), Dir.pwd, preserve: true
end