Ignore errors on prerelease gems
This commit is contained in:
parent
6498c43995
commit
cbc11bcb63
@ -79,6 +79,9 @@ class Downloader
|
|||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
options = options.dup
|
options = options.dup
|
||||||
options[:ssl_ca_cert] = Dir.glob(File.expand_path("../lib/rubygems/ssl_certs/**/*.pem", File.dirname(__FILE__)))
|
options[:ssl_ca_cert] = Dir.glob(File.expand_path("../lib/rubygems/ssl_certs/**/*.pem", File.dirname(__FILE__)))
|
||||||
|
if Gem::Version.new(name[/-\K[^-]*(?=\.gem\z)/]).prerelease?
|
||||||
|
options[:ignore_http_client_errors] = true
|
||||||
|
end
|
||||||
super("https://rubygems.org/downloads/#{name}", name, dir, since, options)
|
super("https://rubygems.org/downloads/#{name}", name, dir, since, options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -237,6 +240,7 @@ class Downloader
|
|||||||
$stdout.flush
|
$stdout.flush
|
||||||
end
|
end
|
||||||
mtime = nil
|
mtime = nil
|
||||||
|
ignore_http_client_errors = options.delete(:ignore_http_client_errors)
|
||||||
options = options.merge(http_options(file, since.nil? ? true : since))
|
options = options.merge(http_options(file, since.nil? ? true : since))
|
||||||
begin
|
begin
|
||||||
data = with_retry(10) do
|
data = with_retry(10) do
|
||||||
@ -247,12 +251,18 @@ class Downloader
|
|||||||
data
|
data
|
||||||
end
|
end
|
||||||
rescue OpenURI::HTTPError => http_error
|
rescue OpenURI::HTTPError => http_error
|
||||||
if http_error.message =~ /^304 / # 304 Not Modified
|
case http_error.message
|
||||||
|
when /^304 / # 304 Not Modified
|
||||||
if $VERBOSE
|
if $VERBOSE
|
||||||
$stdout.puts "#{name} not modified"
|
$stdout.puts "#{name} not modified"
|
||||||
$stdout.flush
|
$stdout.flush
|
||||||
end
|
end
|
||||||
return file.to_path
|
return file.to_path
|
||||||
|
when /^40/ # Net::HTTPClientError: 403 Forbidden, 404 Not Found
|
||||||
|
if ignore_http_client_errors
|
||||||
|
puts "Ignore #{url}: #{http_error.message}"
|
||||||
|
return file.to_path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
raise
|
raise
|
||||||
rescue Timeout::Error
|
rescue Timeout::Error
|
||||||
|
Loading…
x
Reference in New Issue
Block a user