Class: SubversionDownloadStrategy
- Inherits:
-
VCSDownloadStrategy
- Object
- AbstractDownloadStrategy
- VCSDownloadStrategy
- SubversionDownloadStrategy
- Defined in:
- download_strategy.rb
Overview
Strategy for downloading a Subversion 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
-
#fetch(timeout: nil) ⇒ Object
Download and cache the repository at AbstractDownloadStrategy#cached_location.
-
#initialize(url, name, version, **meta) ⇒ SubversionDownloadStrategy
constructor
A new instance of SubversionDownloadStrategy.
-
#last_commit ⇒ String
-
#source_modified_time ⇒ Time
Methods inherited from VCSDownloadStrategy
#commit_outdated?, #fetch_last_commit, #head?
Methods inherited from AbstractDownloadStrategy
#basename, #clear_cache, #quiet!, #quiet?, #shutup!, #stage
Methods included from Context
current, current=, #debug?, #quiet?, #verbose?, #with_context
Constructor Details
#initialize(url, name, version, **meta) ⇒ SubversionDownloadStrategy
Returns a new instance of SubversionDownloadStrategy.
732 733 734 735 |
# File 'download_strategy.rb', line 732 def initialize(url, name, version, **) super @url = @url.sub("svn+http://", "") end |
Instance Method Details
#fetch(timeout: nil) ⇒ Object
Download and cache the repository at AbstractDownloadStrategy#cached_location.
740 741 742 743 744 745 |
# File 'download_strategy.rb', line 740 def fetch(timeout: nil) if @url.chomp("/") != repo_url || !silent_command("svn", args: ["switch", @url, cached_location]).success? clear_cache end super end |
#last_commit ⇒ String
764 765 766 767 |
# File 'download_strategy.rb', line 764 def last_commit out, = silent_command("svn", args: ["info", "--show-item", "revision"], chdir: cached_location) out.strip end |
#source_modified_time ⇒ Time
750 751 752 753 754 755 756 757 758 759 |
# File 'download_strategy.rb', line 750 def source_modified_time time = if Version.new(T.must(Utils::Svn.version)) >= Version.new("1.9") out, = silent_command("svn", args: ["info", "--show-item", "last-changed-date"], chdir: cached_location) out else out, = silent_command("svn", args: ["info"], chdir: cached_location) out[/^Last Changed Date: (.+)$/, 1] end Time.parse time end |