Class: CVSDownloadStrategy

Inherits:
VCSDownloadStrategy show all
Defined in:
download_strategy.rb

Overview

Strategy for downloading a CVS repository.

Constant Summary

Constants inherited from VCSDownloadStrategy

VCSDownloadStrategy::REF_TYPES

Instance Attribute Summary

Attributes inherited from VCSDownloadStrategy

#cached_location

Attributes inherited from AbstractDownloadStrategy

#cache, #url

Instance Method Summary collapse

Methods inherited from VCSDownloadStrategy

#commit_outdated?, #fetch, #fetch_last_commit, #head?, #last_commit

Methods inherited from AbstractDownloadStrategy

#basename, #cached_location, #clear_cache, #fetch, #quiet!, #quiet?, #stage

Methods included from SystemCommand::Mixin

#system_command, #system_command!

Methods included from Context

current, current=, #debug?, #quiet?, #verbose?, #with_context

Constructor Details

#initialize(url, name, version, **meta) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:



1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
# File 'download_strategy.rb', line 1286

def initialize(url, name, version, **meta)
  super
  @url = T.let(@url.sub(%r{^cvs://}, ""), String)

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

Instance Method Details

#source_modified_timeTime

Returns the most recent modified time for all files in the current working directory after stage.

Returns:



1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
# File 'download_strategy.rb', line 1307

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