Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac_app_store_installer: workaround mas outdated bug. #1231

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions lib/bundle/mac_app_store_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 9 additions & 7 deletions spec/bundle/mac_app_store_installer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down