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?, #shutup!, #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.



1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
# File 'download_strategy.rb', line 1154

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:



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

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