Class: CVSDownloadStrategy

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

Constant Summary

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, #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) ⇒ CVSDownloadStrategy

Returns a new instance of CVSDownloadStrategy



927
928
929
930
931
932
933
934
935
936
937
938
# File 'Library/Homebrew/download_strategy.rb', line 927

def initialize(name, resource)
  super
  @url = @url.sub(%r{^cvs://}, "")

  if meta.key?(:module)
    @module = meta.fetch(:module)
  elsif @url !~ %r{:[^/]+$}
    @module = name
  else
    @module, @url = split_url(@url)
  end
end

Instance Method Details

#source_modified_timeObject



940
941
942
943
944
945
946
947
948
949
950
951
# File 'Library/Homebrew/download_strategy.rb', line 940

def source_modified_time
  # Filter CVS's files because the timestamp for each of them is the moment
  # of clone.
  max_mtime = Time.at(0)
  cached_location.find do |f|
    Find.prune if f.directory? && f.basename.to_s == "CVS"
    next unless f.file?
    mtime = f.mtime
    max_mtime = mtime if mtime > max_mtime
  end
  max_mtime
end

#stageObject



953
954
955
# File 'Library/Homebrew/download_strategy.rb', line 953

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