Class: SubversionDownloadStrategy

Inherits:
VCSDownloadStrategy show all
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 VCSDownloadStrategy

#cached_location

Attributes inherited from AbstractDownloadStrategy

#cache, #url

Instance Method Summary collapse

Methods inherited from VCSDownloadStrategy

#commit_outdated?, #fetch_last_commit, #head?

Methods inherited from AbstractDownloadStrategy

#basename, #cached_location, #clear_cache, #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) ⇒ 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.

Parameters:



830
831
832
833
# File 'download_strategy.rb', line 830

def initialize(url, name, version, **meta)
  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.

Parameters:

  • timeout (Float, Integer, nil) (defaults to: nil)


839
840
841
842
843
844
# File 'download_strategy.rb', line 839

def fetch(timeout: nil)
  if @url.chomp("/") != repo_url || !silent_command("svn", args: ["switch", @url, cached_location]).success?
    clear_cache
  end
  super
end

#last_commitString

Return last commit's unique identifier for the repository.

Returns:



865
866
867
# File 'download_strategy.rb', line 865

def last_commit
  silent_command("svn", args: ["info", "--show-item", "revision"], chdir: cached_location).stdout.strip
end

#source_modified_timeTime

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

Returns:



850
851
852
853
854
855
856
857
858
859
# File 'download_strategy.rb', line 850

def source_modified_time
  require "utils/svn"

  time = if Version.new(T.must(Utils::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
  Time.parse T.must(time)
end