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 AbstractDownloadStrategy

#cache, #cached_location, #url

Instance Method Summary collapse

Methods inherited from VCSDownloadStrategy

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

Methods inherited from AbstractDownloadStrategy

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

Returns a new instance of CVSDownloadStrategy.



1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
# File 'download_strategy.rb', line 1170

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

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

Instance Method Details

#source_modified_timeTime

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

Returns:



1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
# File 'download_strategy.rb', line 1187

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