From e9e041740f90f8bc6d001e3959dfee035fba944a Mon Sep 17 00:00:00 2001 From: hardworker Date: Wed, 6 Mar 2019 02:36:23 +0300 Subject: [PATCH 1/2] Fixed `update` command options passing by inspecting original `Pod::Installer` (issue #38) --- lib/cocoapods-binary/Main.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/cocoapods-binary/Main.rb b/lib/cocoapods-binary/Main.rb index 2510d3a..8eeafaf 100644 --- a/lib/cocoapods-binary/Main.rb +++ b/lib/cocoapods-binary/Main.rb @@ -64,6 +64,12 @@ def keep_source_code_for_prebuilt_frameworks! Pod::UI.puts "🚀 Prebuild frameworks" + # Looks like this is the most appropriate way to figure out that something should be updated + include ObjectSpace + ObjectSpace.each_object(Pod::Installer) { |installer| + @update = installer.update + @repo_update = installer.repo_update + } # control features Pod.is_prebuild_stage = true @@ -82,11 +88,11 @@ def keep_source_code_for_prebuilt_frameworks! # install binary_installer = Pod::Installer.new(prebuild_sandbox, prebuild_podfile , nil) - if binary_installer.have_exact_prebuild_cache? + if binary_installer.have_exact_prebuild_cache? && !@update binary_installer.install_when_cache_hit! else - binary_installer.repo_update = false - binary_installer.update = false + binary_installer.update = @update + binary_installer.repo_update = @repo_update binary_installer.install! end From 1d1b19396201ac1e2d4210fbd708a03552c96778 Mon Sep 17 00:00:00 2001 From: hardworker Date: Sat, 9 Mar 2019 16:41:04 +0300 Subject: [PATCH 2/2] Added additional explanation comments, moved from instance variables to local ones --- lib/cocoapods-binary/Main.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/cocoapods-binary/Main.rb b/lib/cocoapods-binary/Main.rb index 8eeafaf..4dbcb33 100644 --- a/lib/cocoapods-binary/Main.rb +++ b/lib/cocoapods-binary/Main.rb @@ -64,11 +64,17 @@ def keep_source_code_for_prebuilt_frameworks! Pod::UI.puts "🚀 Prebuild frameworks" + # Fetch original installer (which is running this pre-install hook) options, + # then pass them to our installer to perform update if needed # Looks like this is the most appropriate way to figure out that something should be updated + + update = nil + repo_update = nil + include ObjectSpace ObjectSpace.each_object(Pod::Installer) { |installer| - @update = installer.update - @repo_update = installer.repo_update + update = installer.update + repo_update = installer.repo_update } # control features @@ -88,11 +94,11 @@ def keep_source_code_for_prebuilt_frameworks! # install binary_installer = Pod::Installer.new(prebuild_sandbox, prebuild_podfile , nil) - if binary_installer.have_exact_prebuild_cache? && !@update + if binary_installer.have_exact_prebuild_cache? && !update binary_installer.install_when_cache_hit! else - binary_installer.update = @update - binary_installer.repo_update = @repo_update + binary_installer.update = update + binary_installer.repo_update = repo_update binary_installer.install! end