diff --git a/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb b/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb index 3b43d96d..a4431d18 100644 --- a/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb +++ b/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb @@ -18,6 +18,7 @@ require 'yaml' require 'json' require 'pathname' +require 'fileutils' module CocoapodsXCRemoteCacheModifier @@ -275,7 +276,7 @@ def self.download_xcrc_if_needed(local_location) download_latest_xcrc_release(local_package_location) - if !system("unzip #{local_package_location} -d #{local_location}") + if !system("unzip", local_package_location, "-d", local_location) throw "Unzipping XCRemoteCache failed" end end @@ -295,11 +296,11 @@ def self.download_latest_xcrc_release(local_package_location) throw "Downloading XCRemoteCache failed" end - URI.open(asset_url, "accept" => 'application/octet-stream') do |f| - File.open(local_package_location, "wb") do |file| - file.puts f.read - end - end + uri = URI(asset_url) + options = { 'accept' => 'application/octet-stream' } + # File is > 10KB so Tempfile will be returned + downloaded_file = uri.open(options) + FileUtils.cp(downloaded_file, local_package_location) end def self.add_cflags!(options, key, value, exclude_sdks_configurations)