From 3b6baa953e72f9908fc145680d36bc3d87c2ae0e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 21 Jul 2023 17:13:10 +0100 Subject: [PATCH] mac_app_store_installer: workaround `mas outdated` bug. Until `mas outdated` is fixed, we can't trust its output. We're waiting on the PR to be merged upstream and then this can be reverted. --- lib/bundle/mac_app_store_installer.rb | 18 +++++++++++------- spec/bundle/mac_app_store_installer_spec.rb | 16 +++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/bundle/mac_app_store_installer.rb b/lib/bundle/mac_app_store_installer.rb index 4708c6418..60b561c80 100644 --- a/lib/bundle/mac_app_store_installer.rb +++ b/lib/bundle/mac_app_store_installer.rb @@ -70,13 +70,17 @@ def installed_app_ids end def outdated_app_ids - @outdated_app_ids ||= if Bundle.mas_installed? - `mas outdated 2>/dev/null`.split("\n").map do |app| - app.split(" ", 2).first.to_i - end - else - [] - end + [] + + # TODO: can't be trusted right now. + # Uncomment when https://github.com/mas-cli/mas/pull/496 is merged. + # @outdated_app_ids ||= if Bundle.mas_installed? + # `mas outdated 2>/dev/null`.split("\n").map do |app| + # app.split(" ", 2).first.to_i + # end + # else + # [] + # end end end end diff --git a/spec/bundle/mac_app_store_installer_spec.rb b/spec/bundle/mac_app_store_installer_spec.rb index 4621d3b9a..b304b0874 100644 --- a/spec/bundle/mac_app_store_installer_spec.rb +++ b/spec/bundle/mac_app_store_installer_spec.rb @@ -42,13 +42,15 @@ allow(Bundle).to receive(:mas_installed?).and_return(true) end - describe ".outdated_app_ids" do - it "returns app ids" do - expect(described_class).to receive(:`).and_return("foo 123") - described_class.reset! - described_class.outdated_app_ids - end - end + # TODO: can't be trusted right now. + # Uncomment when https://github.com/mas-cli/mas/pull/496 is merged. + # describe ".outdated_app_ids" do + # it "returns app ids" do + # expect(described_class).to receive(:`).and_return("foo 123") + # described_class.reset! + # described_class.outdated_app_ids + # end + # end context "when mas is not signed in" do it "outputs an error" do