-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
anycubic-slicer-next 1.3.7.3 (new cask) #234863
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
base: main
Are you sure you want to change the base?
Conversation
| strategy :page_match do |page| | ||
| page.scan(/V(\d+(?:\.\d+)+)/i).flatten.first | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| strategy :page_match do |page| | |
| page.scan(/V(\d+(?:\.\d+)+)/i).flatten.first | |
| end | |
| regex(V(\d+(?:\.\d+)+)/i) |
We will need a regex that is more closely anchored to a url or something, not just any number after "V". But you also don't need to do block here.
| sha256 :no_check | ||
|
|
||
| on_arm do | ||
| url "https://cdn.cloud-platform.anycubic.com/file/2025/09/28/dmg/68d905e851e28229897aa0a118a4ba56/codesign_20250928_152423_AnycubicSlicerNext_arm64.dmg" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of variable parts in this url that will change between versions, these will need to be captured somehow and stored in the version, so that the cask can be updated systematically.
| latest_version_block = page.match(%r{<h3 class="toc-header"[^>]*>.*?V?(\d+(?:\.\d+)+)</h3>.*?<ul>(.*?)</ul>}m) | ||
| next if latest_version_block.blank? | ||
|
|
||
| version = latest_version_block.captures[0] | ||
| links_html = latest_version_block.captures[1] | ||
|
|
||
| arm_url_match = links_html.match(/href="([^"]*?arm64\.dmg)"/) | ||
| intel_url_match = links_html.match(/href="([^"]*?x86_64\.dmg)"/) | ||
|
|
||
| next if arm_url_match.blank? || intel_url_match.blank? | ||
|
|
||
| version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I shouldn't have to point this out but this does not include the URL parts in the returned version string.
This regex is used to match the version parts, so it should be set using a regex() call and passed into the strategy block (not inline in the strategy block).
This is also capturing the full href attributes for the arch-specific files instead of capturing only the distinct parts from each URL that will vary. To say the least, this isn't doing what was asked in #234863 (comment). There are many examples in existing casks that you can refer to for inspiration (e.g., sq-mixpad).
Besides that, we use match[1] instead of match.captures[0] (for the sake of brevity), so this doesn't adhere to typical strategy block code patterns. Again, there are thousands of existing strategy blocks for you to refer to (some are better than others but typical patterns start to become clear after looking through a few).
Important: Do not tick a checkbox if you haven’t performed its action. Honesty is indispensable for a smooth review process.
In the following questions
<cask>is the token of the cask you're submitting.After making any changes to a cask, existing or new, verify:
brew audit --cask --online <cask>is error-free.brew style --fix <cask>reports no offenses.Additionally, if adding a new cask:
brew audit --cask --new <cask>worked successfully.HOMEBREW_NO_INSTALL_FROM_API=1 brew install --cask <cask>worked successfully.brew uninstall --cask <cask>worked successfully.