mirror of
https://github.com/wavetermdev/homebrew-cask.git
synced 2026-08-05 13:43:24 -07:00
Delete exceptions from homebrew-fork (#22574)
* delete exceptions from homebrew-fork * paths fix
This commit is contained in:
committed by
Josh Hagins
parent
9ba2575c1a
commit
fe4dc6f241
@@ -3,6 +3,8 @@ require 'rake/testtask'
|
||||
require 'rspec/core/rake_task'
|
||||
require 'rubocop/rake_task'
|
||||
|
||||
homebrew_repo = `brew --repository`
|
||||
$LOAD_PATH.unshift(File.expand_path("#{homebrew_repo.chomp}/Library/Homebrew"))
|
||||
$LOAD_PATH.unshift(File.expand_path('../lib', __FILE__))
|
||||
|
||||
namespace :test do
|
||||
|
||||
@@ -16,7 +16,7 @@ class Hbc::Source::URI
|
||||
odebug "Download target -> #{path.to_s}"
|
||||
begin
|
||||
curl(uri, '-o', path.to_s)
|
||||
rescue Hbc::ErrorDuringExecution
|
||||
rescue ErrorDuringExecution
|
||||
raise Hbc::CaskUnavailableError.new uri
|
||||
end
|
||||
Hbc::Source::PathSlashOptional.new(path).load
|
||||
|
||||
+3
-3
@@ -63,7 +63,7 @@ class Hbc::HbCurlDownloadStrategy < Hbc::AbstractDownloadStrategy
|
||||
had_incomplete_download = temporary_path.exist?
|
||||
begin
|
||||
_fetch
|
||||
rescue Hbc::ErrorDuringExecution
|
||||
rescue ErrorDuringExecution
|
||||
# 33 == range not supported
|
||||
# try wiping the incomplete download and retrying once
|
||||
if $?.exitstatus == 33 && had_incomplete_download
|
||||
@@ -78,14 +78,14 @@ class Hbc::HbCurlDownloadStrategy < Hbc::AbstractDownloadStrategy
|
||||
msg = "Download failed: #{@url}"
|
||||
msg << "\nThe incomplete download is cached at #{tarball_path}"
|
||||
end
|
||||
raise Hbc::CurlDownloadStrategyError, msg
|
||||
raise CurlDownloadStrategyError, msg
|
||||
end
|
||||
end
|
||||
Hbc::Utils.ignore_interrupts { temporary_path.rename(tarball_path) }
|
||||
else
|
||||
puts "Already downloaded: #{tarball_path}"
|
||||
end
|
||||
rescue Hbc::CurlDownloadStrategyError
|
||||
rescue CurlDownloadStrategyError
|
||||
raise if mirrors.empty?
|
||||
puts "Trying a mirror..."
|
||||
@url = mirrors.shift
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
module Hbc; end
|
||||
|
||||
# raised by safe_system in utils.rb
|
||||
class Hbc::ErrorDuringExecution < RuntimeError
|
||||
def initialize(cmd, args=[])
|
||||
args = args.map { |a| a.to_s.gsub " ", "\\ " }.join(" ")
|
||||
super "Failure while executing: #{cmd} #{args}"
|
||||
end
|
||||
end
|
||||
|
||||
# raised in Hbc::HbCurlDownloadStrategy.fetch
|
||||
class Hbc::CurlDownloadStrategyError < RuntimeError; end
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
require 'exceptions'
|
||||
require 'vendor/homebrew-fork/monkeypatch_pathname'
|
||||
require 'vendor/homebrew-fork/exceptions'
|
||||
require 'vendor/homebrew-fork/utils'
|
||||
|
||||
def cache
|
||||
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
require 'pathname'
|
||||
require 'vendor/homebrew-fork/exceptions'
|
||||
require 'exceptions'
|
||||
|
||||
def homebrew_fork_system cmd, *args
|
||||
puts "#{cmd} #{args*' '}" if Hbc.verbose
|
||||
@@ -15,7 +15,7 @@ end
|
||||
|
||||
# Kernel.system but with exceptions
|
||||
def safe_system cmd, *args
|
||||
homebrew_fork_system(cmd, *args) or raise Hbc::ErrorDuringExecution.new(cmd, args)
|
||||
homebrew_fork_system(cmd, *args) or raise ErrorDuringExecution.new(cmd, args)
|
||||
end
|
||||
|
||||
# prints no output
|
||||
|
||||
@@ -2,6 +2,9 @@ require 'pathname'
|
||||
require 'rspec/its'
|
||||
require 'rspec/wait'
|
||||
|
||||
homebrew_repo = `brew --repository`
|
||||
$LOAD_PATH.unshift(File.expand_path("#{homebrew_repo.chomp}/Library/Homebrew"))
|
||||
|
||||
if ENV['COVERAGE']
|
||||
require 'coveralls'
|
||||
Coveralls.wear_merged!
|
||||
|
||||
@@ -2,6 +2,9 @@ require 'bundler'
|
||||
require 'bundler/setup'
|
||||
require 'pathname'
|
||||
|
||||
homebrew_repo = `brew --repository`
|
||||
$LOAD_PATH.unshift(File.expand_path("#{homebrew_repo.chomp}/Library/Homebrew"))
|
||||
|
||||
if ENV['COVERAGE']
|
||||
require 'coveralls'
|
||||
Coveralls.wear_merged!
|
||||
|
||||
Reference in New Issue
Block a user