Delete exceptions from homebrew-fork (#22574)

* delete exceptions from homebrew-fork

* paths fix
This commit is contained in:
Anastasia Sulyagina
2016-07-05 01:59:26 -04:00
committed by Josh Hagins
parent 9ba2575c1a
commit fe4dc6f241
8 changed files with 15 additions and 19 deletions
+2
View File
@@ -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
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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
+1 -1
View File
@@ -1,5 +1,5 @@
require 'exceptions'
require 'vendor/homebrew-fork/monkeypatch_pathname'
require 'vendor/homebrew-fork/exceptions'
require 'vendor/homebrew-fork/utils'
def cache
+2 -2
View File
@@ -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
+3
View File
@@ -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!
+3
View File
@@ -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!