Merge pull request #18438 from bevanjkay/extract_plist_url_fix
cask/cask: pass args when initalising methods
This commit is contained in:
commit
a25a541d26
@ -118,7 +118,7 @@ module Cask
|
||||
end
|
||||
|
||||
::Cask::DSL::DSL_METHODS.each do |method_name|
|
||||
define_method(method_name) { |&block| @dsl.send(method_name, &block) }
|
||||
define_method(method_name) { |*args, &block| @dsl.send(method_name, *args, &block) }
|
||||
end
|
||||
|
||||
sig { params(caskroom_path: Pathname).returns(T::Array[[String, String]]) }
|
||||
|
||||
@ -104,7 +104,7 @@ module Homebrew
|
||||
# Create a copy of the `cask` that uses the `livecheck` block URL
|
||||
cask_copy = Cask::CaskLoader.load(cask.sourcefile_path)
|
||||
cask_copy.allow_reassignment = true
|
||||
cask_copy.url { url }
|
||||
cask_copy.url url
|
||||
UnversionedCaskChecker.new(cask_copy)
|
||||
else
|
||||
UnversionedCaskChecker.new(cask)
|
||||
|
||||
@ -114,5 +114,15 @@ RSpec.describe Homebrew::Livecheck::Strategy::ExtractPlist do
|
||||
expect(installer_artifact).to be_a(Cask::Artifact::Installer)
|
||||
expect(installer_artifact.path).to be_a(Pathname)
|
||||
end
|
||||
|
||||
it "uses the provided livecheck url", :needs_macos do
|
||||
cask = Cask::CaskLoader.load(cask_path("livecheck/livecheck-extract-plist"))
|
||||
livecheck_url = "file://#{TEST_FIXTURE_DIR}/cask/caffeine-with-plist.zip"
|
||||
|
||||
expect(Homebrew::UnversionedCaskChecker).to receive(:new).with(cask).and_call_original
|
||||
result = described_class.find_versions(cask:, url: livecheck_url)
|
||||
expect(result)
|
||||
.to eq({ matches: { "1.2.3"=> @version="1.2.3" }, regex: nil, url: livecheck_url })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
cask "livecheck-extract-plist" do
|
||||
version "1.2.3"
|
||||
sha256 "78c670559a609f5d89a5d75eee49e2a2dab48aa3ea36906d14d5f7104e483bb9"
|
||||
|
||||
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine-suite.zip"
|
||||
name "With Extract Plist Livecheck"
|
||||
desc "Cask with a an ExtractPlist livecheck strategy"
|
||||
homepage "https://brew.sh/"
|
||||
|
||||
livecheck do
|
||||
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine-with-plist.zip"
|
||||
strategy :extract_plist
|
||||
end
|
||||
|
||||
app "Caffeine.app"
|
||||
end
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user