mirror of
https://github.com/Homebrew/brew.git
synced 2026-08-12 22:29:27 +04:00
Report unavailable cask platforms accurately
- `outdated_casks` treated a missing `version` as non-latest but then reported that the latest version was already installed. - Handle the missing version explicitly and reuse the narrowed value so non-quiet output identifies the unavailable current platform. - Strengthen the regression coverage for the warning path.
This commit is contained in:
@@ -62,9 +62,13 @@ module Cask
|
||||
next false
|
||||
end
|
||||
|
||||
if cask.outdated?(greedy: true)
|
||||
version = cask.version
|
||||
if version.nil?
|
||||
opoo "Not upgrading #{cask.token}, no version is available for the current platform" unless quiet
|
||||
false
|
||||
elsif cask.outdated?(greedy: true)
|
||||
true
|
||||
elsif cask.version&.latest?
|
||||
elsif version.latest?
|
||||
opoo "Not upgrading #{cask.token}, the downloaded artifact has not changed" unless quiet
|
||||
false
|
||||
else
|
||||
|
||||
@@ -47,7 +47,7 @@ RSpec.describe Cask::Upgrade, :cask do
|
||||
allow(Homebrew::EnvConfig).to receive(:upgrade_auto_updates_casks?).and_return(true)
|
||||
end
|
||||
|
||||
it "excludes casks with no version for the current OS" do
|
||||
it "warns and excludes casks with no version for the current platform" do
|
||||
cask = Homebrew::SimulateSystem.with(os: :linux) do
|
||||
Cask::Cask.new("macos-only") do
|
||||
on_macos do
|
||||
@@ -56,7 +56,9 @@ RSpec.describe Cask::Upgrade, :cask do
|
||||
end
|
||||
end
|
||||
|
||||
expect(described_class.outdated_casks([cask], args:, force: true, quiet: true)).to be_empty
|
||||
expect do
|
||||
expect(described_class.outdated_casks([cask], args:, force: true, quiet: false)).to be_empty
|
||||
end.to output(/Not upgrading macos-only, no version is available for the current platform/).to_stderr
|
||||
end
|
||||
|
||||
context "when the upgrade is a dry run" do
|
||||
|
||||
Reference in New Issue
Block a user