Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

livecheck/strategy/extract_plist: fix extract_plist url #18438

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bevanjkay
Copy link
Member

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

When a custom url is passed to the ExtractPlist livecheck strategy, we were creating a copy of the cask and replacing the url. This was being parsed as a block, which was causing a deprecation error now that url do blocks are deprecated.

This PR instead creates a minimal copy of the cask and passes it to CaskLoader as content instead of copying the entire cask.

@@ -102,9 +102,16 @@ def self.find_versions(cask:, url: nil, regex: nil, **_unused, &block)

unversioned_cask_checker = if url.present? && url != cask.url.to_s
# 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 }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you not just do cask_copy.url url?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that first.

Error: google-earth-pro: wrong number of arguments (given 1, expected 0)
/opt/homebrew/Library/Homebrew/cask/cask.rb:121:in `block (2 levels) in <class:Cask>'
/opt/homebrew/Library/Homebrew/livecheck/strategy/extract_plist.rb:107:in `find_versions'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's because we define the DSL methods without forwarding arguments here:

define_method(method_name) { |&block| @dsl.send(method_name, &block) }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants