Merge pull request #4427 from reitermarkus/download-refactoring
Download refactoring
This commit is contained in:
commit
4e70a426d1
@ -617,7 +617,7 @@ class SubversionDownloadStrategy < VCSDownloadStrategy
|
|||||||
|
|
||||||
def stage
|
def stage
|
||||||
super
|
super
|
||||||
quiet_safe_system "svn", "export", "--force", cached_location, Dir.pwd
|
safe_system "svn", "export", "--force", cached_location, Dir.pwd
|
||||||
end
|
end
|
||||||
|
|
||||||
def source_modified_time
|
def source_modified_time
|
||||||
@ -794,9 +794,9 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
return unless @ref_type == :branch || !ref?
|
return unless @ref_type == :branch || !ref?
|
||||||
|
|
||||||
if !shallow_clone? && shallow_dir?
|
if !shallow_clone? && shallow_dir?
|
||||||
quiet_safe_system "git", "fetch", "origin", "--unshallow"
|
safe_system "git", "fetch", "origin", "--unshallow"
|
||||||
else
|
else
|
||||||
quiet_safe_system "git", "fetch", "origin"
|
safe_system "git", "fetch", "origin"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -811,7 +811,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
|
|
||||||
def checkout
|
def checkout
|
||||||
ohai "Checking out #{@ref_type} #{@ref}" if @ref_type && @ref
|
ohai "Checking out #{@ref_type} #{@ref}" if @ref_type && @ref
|
||||||
quiet_safe_system "git", "checkout", "-f", @ref, "--"
|
safe_system "git", "checkout", "-f", @ref, "--"
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset_args
|
def reset_args
|
||||||
@ -826,12 +826,12 @@ class GitDownloadStrategy < VCSDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def reset
|
def reset
|
||||||
quiet_safe_system "git", *reset_args
|
safe_system "git", *reset_args
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_submodules
|
def update_submodules
|
||||||
quiet_safe_system "git", "submodule", "foreach", "--recursive", "git submodule sync"
|
safe_system "git", "submodule", "foreach", "--recursive", "git submodule sync"
|
||||||
quiet_safe_system "git", "submodule", "update", "--init", "--recursive"
|
safe_system "git", "submodule", "update", "--init", "--recursive"
|
||||||
fix_absolute_submodule_gitdir_references!
|
fix_absolute_submodule_gitdir_references!
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1035,7 +1035,9 @@ class MercurialDownloadStrategy < VCSDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
cached_location.cd { quiet_safe_system hgpath, "pull", "--update" }
|
cached_location.cd do
|
||||||
|
safe_system hgpath, "pull", "--update"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1083,7 +1085,9 @@ class BazaarDownloadStrategy < VCSDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
cached_location.cd { quiet_safe_system bzrpath, "update" }
|
cached_location.cd do
|
||||||
|
safe_system bzrpath, "update"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -112,10 +112,10 @@ module Formulary
|
|||||||
resource = Resource.new(formula_name) { url bottle_name }
|
resource = Resource.new(formula_name) { url bottle_name }
|
||||||
resource.specs[:bottle] = true
|
resource.specs[:bottle] = true
|
||||||
downloader = CurlDownloadStrategy.new resource.name, resource
|
downloader = CurlDownloadStrategy.new resource.name, resource
|
||||||
@bottle_filename = downloader.cached_location
|
cached = downloader.cached_location.exist?
|
||||||
cached = @bottle_filename.exist?
|
|
||||||
downloader.fetch
|
downloader.fetch
|
||||||
ohai "Pouring the cached bottle" if cached
|
ohai "Pouring the cached bottle" if cached
|
||||||
|
@bottle_filename = downloader.cached_location
|
||||||
else
|
else
|
||||||
@bottle_filename = Pathname(bottle_name).realpath
|
@bottle_filename = Pathname(bottle_name).realpath
|
||||||
end
|
end
|
||||||
|
|||||||
@ -118,7 +118,7 @@ class Resource
|
|||||||
if block_given?
|
if block_given?
|
||||||
yield ResourceStageContext.new(self, staging)
|
yield ResourceStageContext.new(self, staging)
|
||||||
elsif target
|
elsif target
|
||||||
target = Pathname.new(target) unless target.is_a? Pathname
|
target = Pathname(target)
|
||||||
target.install Pathname.pwd.children
|
target.install Pathname.pwd.children
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user