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.



1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
# File 'download_strategy.rb', line 1165

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:



1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
# File 'download_strategy.rb', line 1182

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