Class: MercurialDownloadStrategy
- Inherits:
-
VCSDownloadStrategy
- Object
- AbstractDownloadStrategy
- VCSDownloadStrategy
- MercurialDownloadStrategy
- Defined in:
- download_strategy.rb
Overview
Strategy for downloading a Mercurial 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
-
#initialize(url, name, version, **meta) ⇒ MercurialDownloadStrategy
constructor
A new instance of MercurialDownloadStrategy.
-
#last_commit ⇒ String
-
#source_modified_time ⇒ Time
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) ⇒ MercurialDownloadStrategy
Returns a new instance of MercurialDownloadStrategy.
1203 1204 1205 1206 |
# File 'download_strategy.rb', line 1203 def initialize(url, name, version, **) super @url = @url.sub(%r{^hg://}, "") end |
Instance Method Details
#last_commit ⇒ String
1221 1222 1223 1224 |
# File 'download_strategy.rb', line 1221 def last_commit out, = silent_command("hg", args: ["parent", "--template", "{node|short}", "-R", cached_location]) out.chomp end |
#source_modified_time ⇒ Time
1211 1212 1213 1214 1215 1216 |
# File 'download_strategy.rb', line 1211 def source_modified_time out, = silent_command("hg", args: ["tip", "--template", "{date|isodate}", "-R", cached_location]) Time.parse(out) end |