Class: SubversionDownloadStrategy

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

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_last_commit, #head?

Methods inherited from AbstractDownloadStrategy

#basename, #clear_cache, #ohai, #puts, #shutup!, #stage

Constructor Details

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

Returns a new instance of SubversionDownloadStrategy



511
512
513
514
# File 'brew/Library/Homebrew/download_strategy.rb', line 511

def initialize(url, name, version, **meta)
  super
  @url = @url.sub("svn+http://", "")
end

Instance Method Details

#fetchObject



516
517
518
519
520
521
# File 'brew/Library/Homebrew/download_strategy.rb', line 516

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

#last_commitObject



529
530
531
532
# File 'brew/Library/Homebrew/download_strategy.rb', line 529

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

#source_modified_timeObject



523
524
525
526
527
# File 'brew/Library/Homebrew/download_strategy.rb', line 523

def source_modified_time
  out, = system_command("svn", args: ["info", "--xml"], chdir: cached_location)
  xml = REXML::Document.new(out)
  Time.parse REXML::XPath.first(xml, "//date/text()").to_s
end