Merge pull request #13358 from apainintheneck/fix-latest-svn
Fix :svn download errors with :latest casks
This commit is contained in:
commit
9b2f2e41e8
@ -129,6 +129,10 @@ module Cask
|
|||||||
metadata_main_container_path/"config.json"
|
metadata_main_container_path/"config.json"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def checksumable?
|
||||||
|
url.using.blank? || url.using == :post
|
||||||
|
end
|
||||||
|
|
||||||
def download_sha_path
|
def download_sha_path
|
||||||
metadata_main_container_path/"LATEST_DOWNLOAD_SHA256"
|
metadata_main_container_path/"LATEST_DOWNLOAD_SHA256"
|
||||||
end
|
end
|
||||||
@ -136,12 +140,15 @@ module Cask
|
|||||||
def new_download_sha
|
def new_download_sha
|
||||||
require "cask/installer"
|
require "cask/installer"
|
||||||
|
|
||||||
|
# Call checksumable? before hashing
|
||||||
@new_download_sha ||= Installer.new(self, verify_download_integrity: false)
|
@new_download_sha ||= Installer.new(self, verify_download_integrity: false)
|
||||||
.download(quiet: true)
|
.download(quiet: true)
|
||||||
.instance_eval { |x| Digest::SHA256.file(x).hexdigest }
|
.instance_eval { |x| Digest::SHA256.file(x).hexdigest }
|
||||||
end
|
end
|
||||||
|
|
||||||
def outdated_download_sha?
|
def outdated_download_sha?
|
||||||
|
return true unless checksumable?
|
||||||
|
|
||||||
current_download_sha = download_sha_path.read if download_sha_path.exist?
|
current_download_sha = download_sha_path.read if download_sha_path.exist?
|
||||||
current_download_sha.blank? || current_download_sha != new_download_sha
|
current_download_sha.blank? || current_download_sha != new_download_sha
|
||||||
end
|
end
|
||||||
|
|||||||
@ -397,7 +397,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
def save_download_sha
|
def save_download_sha
|
||||||
@cask.download_sha_path.atomic_write(@cask.new_download_sha)
|
@cask.download_sha_path.atomic_write(@cask.new_download_sha) if @cask.checksumable?
|
||||||
end
|
end
|
||||||
|
|
||||||
def uninstall
|
def uninstall
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user