Class: FossilDownloadStrategy

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

Overview

Strategy for downloading a Fossil 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?

Methods inherited from AbstractDownloadStrategy

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

Methods included from Context

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

Constructor Details

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

Returns a new instance of FossilDownloadStrategy.


1134
1135
1136
1137
# File 'Library/Homebrew/download_strategy.rb', line 1134

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

Instance Method Details

#last_commitObject


1146
1147
1148
1149
# File 'Library/Homebrew/download_strategy.rb', line 1146

def last_commit
  out, = silent_command("fossil", args: ["info", "tip", "-R", cached_location])
  out[/^uuid: +(\h+) .+$/, 1]
end

#repo_valid?Boolean

Returns:

  • (Boolean)

1151
1152
1153
# File 'Library/Homebrew/download_strategy.rb', line 1151

def repo_valid?
  silent_command("fossil", args: ["branch", "-R", cached_location]).success?
end

#source_modified_timeObject

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


1140
1141
1142
1143
# File 'Library/Homebrew/download_strategy.rb', line 1140

def source_modified_time
  out, = silent_command("fossil", args: ["info", "tip", "-R", cached_location])
  Time.parse(out[/^uuid: +\h+ (.+)$/, 1])
end