Merge pull request #20517 from Homebrew/copilot/fix-20516

Fix conflicts_with stanza odeprecated method call issue
This commit is contained in:
Mike McQuaid 2025-08-19 16:44:04 +00:00 committed by GitHub
commit eae11bfe91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 11 deletions

View File

@ -23,7 +23,7 @@ module Cask
options.assert_valid_keys(*VALID_KEYS, *ODEPRECATED_KEYS) options.assert_valid_keys(*VALID_KEYS, *ODEPRECATED_KEYS)
options.keys.intersection(ODEPRECATED_KEYS).each do |key| options.keys.intersection(ODEPRECATED_KEYS).each do |key|
odeprecated "conflicts_with #{key}:" Kernel.odeprecated "conflicts_with #{key}:"
end end
conflicts = options.transform_values { |v| Set.new(Kernel.Array(v)) } conflicts = options.transform_values { |v| Set.new(Kernel.Array(v)) }

View File

@ -1,10 +0,0 @@
# typed: strict
# frozen_string_literal: true
module Cask
class DSL
class ConflictsWith < SimpleDelegator
include Kernel
end
end
end

View File

@ -501,6 +501,14 @@ RSpec.describe Cask::DSL, :cask, :no_api do
expect { cask }.to raise_error(Cask::CaskInvalidError) expect { cask }.to raise_error(Cask::CaskInvalidError)
end end
end end
context "with deprecated conflicts_with key" do
let(:token) { "conflicts-with-deprecated-key" }
it "loads but shows deprecation warning for deprecated key" do
expect { cask.conflicts_with }.to raise_error(Cask::CaskInvalidError, /is deprecated/)
end
end
end end
describe "installer stanza" do describe "installer stanza" do

View File

@ -0,0 +1,11 @@
cask "conflicts-with-deprecated-key" do
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
homepage "https://brew.sh/conflicts-with-deprecated-key"
conflicts_with formula: "some-formula"
app "Caffeine.app"
end