From 69f04bc069bd5cac9cc5797eee151c4abcbb3471 Mon Sep 17 00:00:00 2001 From: Bevan Kay Date: Mon, 7 Oct 2024 22:04:24 +1100 Subject: [PATCH 1/5] cask/cask: pass args when initialising dsl --- Library/Homebrew/cask/cask.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/cask.rb b/Library/Homebrew/cask/cask.rb index a939c4512a847..118358a9d93a2 100644 --- a/Library/Homebrew/cask/cask.rb +++ b/Library/Homebrew/cask/cask.rb @@ -118,7 +118,7 @@ def refresh 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]]) } From 25e34919cba1a4971570d93ab94cf963254c40ec Mon Sep 17 00:00:00 2001 From: Bevan Kay Date: Wed, 9 Oct 2024 11:35:32 +1100 Subject: [PATCH 2/5] livecheck/strategy/extract_plist: pass livecheck url as string --- Library/Homebrew/livecheck/strategy/extract_plist.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/livecheck/strategy/extract_plist.rb b/Library/Homebrew/livecheck/strategy/extract_plist.rb index b649bef0be0a5..e0778d01bc981 100644 --- a/Library/Homebrew/livecheck/strategy/extract_plist.rb +++ b/Library/Homebrew/livecheck/strategy/extract_plist.rb @@ -104,7 +104,7 @@ def self.find_versions(cask:, url: nil, regex: nil, **_unused, &block) # 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) From 0211a23c1f04f200f3d2a1006dd6b2096218918d Mon Sep 17 00:00:00 2001 From: Bevan Kay Date: Wed, 9 Oct 2024 13:31:43 +1100 Subject: [PATCH 3/5] test/livecheck: add extract_plist livecheck url test --- .../test/livecheck/strategy/extract_plist_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Library/Homebrew/test/livecheck/strategy/extract_plist_spec.rb b/Library/Homebrew/test/livecheck/strategy/extract_plist_spec.rb index 039cdc25073b7..6f714b9fe7942 100644 --- a/Library/Homebrew/test/livecheck/strategy/extract_plist_spec.rb +++ b/Library/Homebrew/test/livecheck/strategy/extract_plist_spec.rb @@ -114,5 +114,15 @@ 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 From 8852f024a63b2d5c10dc67c380b6f59abeb89aa5 Mon Sep 17 00:00:00 2001 From: Bevan Kay Date: Wed, 9 Oct 2024 13:32:08 +1100 Subject: [PATCH 4/5] test/fixtures: add livecheck-extract-plist cask --- .../Casks/livecheck/livecheck-extract-plist.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Library/Homebrew/test/support/fixtures/cask/Casks/livecheck/livecheck-extract-plist.rb diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/livecheck/livecheck-extract-plist.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/livecheck/livecheck-extract-plist.rb new file mode 100644 index 0000000000000..f5cf411aa62cf --- /dev/null +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/livecheck/livecheck-extract-plist.rb @@ -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 From 8b33aa048aa4a872e133cadaaaccaca86d5dc0f9 Mon Sep 17 00:00:00 2001 From: Bevan Kay Date: Thu, 10 Oct 2024 10:37:37 +1100 Subject: [PATCH 5/5] test/fixtures: add app binary with valid info.plist file --- .../fixtures/cask/caffeine-with-plist.zip | Bin 0 -> 2296 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Library/Homebrew/test/support/fixtures/cask/caffeine-with-plist.zip diff --git a/Library/Homebrew/test/support/fixtures/cask/caffeine-with-plist.zip b/Library/Homebrew/test/support/fixtures/cask/caffeine-with-plist.zip new file mode 100644 index 0000000000000000000000000000000000000000..646884181a72c87a77df1e73dbe6dd7be9937f18 GIT binary patch literal 2296 zcmWIWW@Zs#00EC|5l=7!O7Jo$FgPcsrKM)(rRpUX6zGSB@G`L9Ji9%d_1yMwwWQwU z(h6<{MwYLP3=Ci+0&p57hHjK|eqKpxUP&>+Og2)@l)-7HZ(_24Fa;(n;50cXwK%`D zC^?l_cXKdsFuW~l4TS~ke_&AIHr+EXEnlx7C$qQ&9MbwJy~!|)7Sc;6IC>v35NLh> zSJd!(TA8Se%I%}MWeWqYHN_rG&J5yR=IOC$>;HRKsshTcHg8XSw)Z`6|GN8Ct#PfN zFTD_ro5bqow7t#y?~X(5Rny}hmQK51TsHeU|5dR_)mn$EiNRu)hcplLZuMf=Fl*r| zop)Ixk_@+P-F|4YRP!3}FlVZXX8PK5+J>Bqcz7tnEkcU7g}pENjL-jXe$y0OcIF&5 zIr1^GCvxBIJsIm*Cf{3?cE^100t4B!PJX?8^Pl=&=Un;tWpN>oMoD@^%JD77dcPOH z`eUwxTPkMUsI0D=f81QHTo}3_>oSu-B@WIz7 z>;r#TM?eG91PNw!0cpmMUJ7g<^Nj^qWt^Rw7Who)V|LK#UDm>>rFYRG<8FYNu99QzZb_zGpo9rAgOVbuTt literal 0 HcmV?d00001