diff options
| author | Jack Nagel | 2014-12-06 15:59:17 -0500 | 
|---|---|---|
| committer | Jack Nagel | 2014-12-06 16:00:20 -0500 | 
| commit | 962d3bccbaa92c675226cbbfc71ad5b83df6f9e1 (patch) | |
| tree | 7a871c8793eee62be9226c6e3227bda1bd6da624 | |
| parent | 8c0a855bd80ad9edd4b1c7a9efd26bc1b8c3f1fb (diff) | |
| download | homebrew-962d3bccbaa92c675226cbbfc71ad5b83df6f9e1.tar.bz2 | |
Extract part of stage method to VCS strategy superclass
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 22 | 
1 files changed, 13 insertions, 9 deletions
| diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 8ef492098..de092a9a5 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -61,6 +61,10 @@ class VCSDownloadStrategy < AbstractDownloadStrategy      end    end +  def stage +    ohai "Checking out #{@ref_type} #{@ref}" if @ref_type && @ref +  end +    def cached_location      @clone    end @@ -387,7 +391,8 @@ class SubversionDownloadStrategy < VCSDownloadStrategy    end    def stage -    quiet_safe_system 'svn', 'export', '--force', @clone, Dir.pwd +    super +    quiet_safe_system "svn", "export", "--force", @clone, Dir.pwd    end    private @@ -481,9 +486,10 @@ class GitDownloadStrategy < VCSDownloadStrategy    end    def stage +    super +      dst = Dir.getwd      @clone.cd do -      ohai "Checking out #{@ref_type} #{@ref}"        # http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export        safe_system 'git', 'checkout-index', '-a', '-f', "--prefix=#{dst}/"        checkout_submodules(dst) if submodules? @@ -644,10 +650,11 @@ end  class MercurialDownloadStrategy < VCSDownloadStrategy    def stage +    super +      dst = Dir.getwd      @clone.cd do        if @ref_type and @ref -        ohai "Checking out #{@ref_type} #{@ref}"          safe_system hgpath, 'archive', '--subrepos', '-y', '-r', @ref, '-t', 'files', dst        else          safe_system hgpath, 'archive', '--subrepos', '-y', '-t', 'files', dst @@ -721,12 +728,9 @@ end  class FossilDownloadStrategy < VCSDownloadStrategy    def stage -    # TODO: The 'open' and 'checkout' commands are very noisy and have no '-q' option. -    safe_system fossilpath, 'open', @clone -    if @ref_type and @ref -      ohai "Checking out #{@ref_type} #{@ref}" -      safe_system fossilpath, 'checkout', @ref -    end +    super +    safe_system fossilpath, "open", @clone +    safe_system fossilpath, "checkout", @ref if @ref_type && @ref    end    private | 
