Class: SubversionDownloadStrategy
- Inherits:
-
VCSDownloadStrategy
- Object
- AbstractDownloadStrategy
- VCSDownloadStrategy
- SubversionDownloadStrategy
- Defined in:
- download_strategy/subversion_download_strategy.rb
Overview
Strategy for downloading a Subversion repository.
Constant Summary
Constants inherited from VCSDownloadStrategy
VCSDownloadStrategy::REF_TYPES
Constants inherited from AbstractDownloadStrategy
AbstractDownloadStrategy::HOMEBREW_CONTROLLED_STRATEGIES
Instance Attribute Summary
Attributes inherited from VCSDownloadStrategy
Attributes inherited from AbstractDownloadStrategy
Instance Method Summary collapse
-
#fetch(timeout: nil) ⇒ void
Download and cache the repository at VCSDownloadStrategy#cached_location.
-
#initialize(url, name, version, **meta) ⇒ void
constructor
private
Formula
urlspecs reach download strategies as arbitrary options. -
#last_commit ⇒ String
Return last commit's unique identifier for the repository.
-
#source_modified_time ⇒ Time
Returns the most recent modified time for all files in the current working directory after stage.
- #source_revision ⇒ String? private
Methods inherited from VCSDownloadStrategy
#command_sandbox, #commit_outdated?, #fetch_last_commit, #fetching?, #head?, #sandbox_write_path
Methods inherited from AbstractDownloadStrategy
#basename, #cached_location, #chdir, #clear_cache, expand_deferred_environment_for?, #fetched_size, #ohai, #quiet!, #quiet?, #stage, #total_size
Methods included from Utils::Output::Mixin
#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_once, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_cannot_install, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_incompatible, #pretty_install_status, #pretty_installed, #pretty_removed, #pretty_uninstalled, #pretty_unmarked, #pretty_upgradable, #pretty_warning
Methods included from SystemCommand::Mixin
#command_sandbox, #system_command, #system_command!
Methods included from Context
current, current=, #debug?, #deferred_environment_expansion?, #quiet?, #verbose?, #with_context
Constructor Details
#initialize(url, name, version, **meta) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Formula url specs reach download strategies as arbitrary options.
12 13 14 15 |
# File 'download_strategy/subversion_download_strategy.rb', line 12 def initialize(url, name, version, **) super @url = @url.sub("svn+http://", "") end |
Instance Method Details
#fetch(timeout: nil) ⇒ void
This method returns an undefined value.
Download and cache the repository at VCSDownloadStrategy#cached_location.
21 22 23 24 25 26 |
# File 'download_strategy/subversion_download_strategy.rb', line 21 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
Return last commit's unique identifier for the repository.
53 54 55 |
# File 'download_strategy/subversion_download_strategy.rb', line 53 def last_commit silent_command("svn", args: ["info", "--show-item", "revision"], chdir: cached_location).stdout.strip end |
#source_modified_time ⇒ Time
Returns the most recent modified time for all files in the current working directory after stage.
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'download_strategy/subversion_download_strategy.rb', line 32 def source_modified_time require "utils/svn" svn_version = Utils::Svn.version time = if svn_version && Version.new(svn_version) >= Version.new("1.9") silent_command("svn", args: ["info", "--show-item", "last-changed-date"], chdir: cached_location).stdout else silent_command("svn", args: ["info"], chdir: cached_location).stdout[/^Last Changed Date: (.+)$/, 1] end raise "Cannot determine the last changed date of the Subversion checkout in #{cached_location}" if time.nil? Time.parse time end |
#source_revision ⇒ String?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
47 |
# File 'download_strategy/subversion_download_strategy.rb', line 47 def source_revision = last_commit |