Merge pull request #13311 from bevanjkay/fix-outdated-greedy

cask: fix greedy outdated command
This commit is contained in:
Mike McQuaid 2022-06-06 10:05:24 +01:00 committed by GitHub
commit 845925bf56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View File

@ -173,13 +173,11 @@ module Cask
version
end
if greedy || greedy_latest || (greedy_auto_updates && auto_updates)
if latest_version.latest?
return versions if outdated_download_sha?
if latest_version.latest?
return versions if (greedy || greedy_latest) && outdated_download_sha?
return []
end
elsif auto_updates
return []
elsif auto_updates && !greedy && !greedy_auto_updates
return []
end

View File

@ -134,7 +134,7 @@ describe Cask::Cask, :cask do
shared_examples ":latest cask" do |greedy, outdated_sha, tap_version, expectations|
expectations.each do |installed_version, expected_output|
context "when versions #{installed_version} are installed and the " \
"tap version is #{tap_version}, #{"not " unless greedy}greedy" \
"tap version is #{tap_version}, #{"not " unless greedy}greedy " \
"and sha is #{"not " unless outdated_sha}outdated" do
subject { cask.outdated_versions(greedy: greedy) }
@ -160,7 +160,7 @@ describe Cask::Cask, :cask do
describe "numbered version installed, :latest version in tap" do
include_examples ":latest cask", false, false, "latest",
["1.2.3"] => ["1.2.3"]
["1.2.3"] => []
include_examples ":latest cask", true, false, "latest",
["1.2.3"] => []
include_examples ":latest cask", true, true, "latest",