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

output-factory: update livecheck #172520

Merged
merged 3 commits into from
May 2, 2024

Conversation

adithyasunil26
Copy link
Contributor

Created with brew bump-cask-pr.

@BrewTestBot BrewTestBot added the bump-cask-pr PR was created using `brew bump-cask-pr` label Apr 30, 2024
@bevanjkay bevanjkay added the upstream Issue which needs to be resolved by the upstream project. label Apr 30, 2024
@bevanjkay bevanjkay marked this pull request as draft April 30, 2024 11:10
@bevanjkay
Copy link
Member

Version is a beta. Keeping open to stop the version from being merged.

@bevanjkay bevanjkay changed the title output-factory 3.0 output-factory: update livecheck May 1, 2024
Comment on lines 10 to 16
livecheck do
url "https://zevrix.com/zsversioncontrol/ZSVersionControl.xml"
strategy :xml do |xml|
elements = xml.get_elements("//dict/key[text()='Output Factory']/following-sibling::dict/key[text()='version']/following-sibling::string")
elements.first.text unless elements.empty?
end
end
Copy link
Member

@bevanjkay bevanjkay May 1, 2024

Choose a reason for hiding this comment

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

@samford I have no idea what I'm doing with REXML - Copilot gave me this example that works, but hopefully you have a simpler way to do the same thing (except for the line-length style offence)?

Copy link
Member

@samford samford May 1, 2024

Choose a reason for hiding this comment

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

Nice timing. I was working on a livecheck block yesterday that checks a plist file and I ended up with some verbose Ruby code because I wasn't aware that you could do so much with an XPath (I'm used to CSS selectors, so this was a nice reference: https://devhints.io/xpath).

This XPath is a good start. The main thing I would change is to use [1] to make sure we're only selecting the first dict after <key>Output Factory 2</key>. We use an #elements/#next_element approach in some other Xml strategy blocks (when we only want the first match), so we can follow suit here. [We can technically use /following-sibling::*[1] at the end of the XPath and omit #next_element but the latter is a little tidier.]

Past that, we can rework the strategy block code to avoid the intermediate elements variable.

One moment and I'll push a commit to take care of these changes (edit: done).

Copy link
Member

Choose a reason for hiding this comment

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

That cheat sheet is gold. Thanks for the link!

@samford samford added the livecheck Issues or PRs related to livecheck label May 1, 2024
@samford samford force-pushed the bump-output-factory-3.0 branch from 8c2540c to bf49015 Compare May 1, 2024 14:28
@bevanjkay bevanjkay marked this pull request as ready for review May 2, 2024 11:36
@bevanjkay bevanjkay merged commit 08dbcbe into Homebrew:master May 2, 2024
10 checks passed
@adithyasunil26 adithyasunil26 deleted the bump-output-factory-3.0 branch May 2, 2024 20:14
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bump-cask-pr PR was created using `brew bump-cask-pr` livecheck Issues or PRs related to livecheck outdated upstream Issue which needs to be resolved by the upstream project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants