Skip to content

Commit

Permalink
Merge pull request #5137 from amancevice/fix-deprecated-s3-download-s…
Browse files Browse the repository at this point in the history
…trategy

Fix to deprecated S3DownloadStrategy
  • Loading branch information
MikeMcQuaid committed Oct 20, 2018
2 parents 864be6d + 2e7758b commit 556b339
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Library/Homebrew/compat/download_strategy.rb
Expand Up @@ -26,6 +26,13 @@ def _fetch(url:, resolved_url:)
ENV["AWS_ACCESS_KEY_ID"] = ENV["HOMEBREW_AWS_ACCESS_KEY_ID"]
ENV["AWS_SECRET_ACCESS_KEY"] = ENV["HOMEBREW_AWS_SECRET_ACCESS_KEY"]

begin
require "aws-sdk-s3"
rescue LoadError
Homebrew.install_gem! "aws-sdk-s3", "~> 1.8"
require "aws-sdk-s3"
end

begin
signer = Aws::S3::Presigner.new
s3url = signer.presigned_url :get_object, bucket: bucket, key: key
Expand Down Expand Up @@ -204,12 +211,6 @@ def scp_source
class DownloadStrategyDetector
class << self
module Compat
def detect(url, using = nil)
strategy = super
require_aws_sdk if strategy == S3DownloadStrategy
strategy
end

def detect_from_url(url)
case url
when %r{^s3://}
Expand Down

0 comments on commit 556b339

Please sign in to comment.