Skip to content

Fix cask page rendering macOS requirements#2187

Closed
hangone wants to merge 2 commits into
Homebrew:mainfrom
hangone:fix-cask-macos-requirements
Closed

Fix cask page rendering macOS requirements#2187
hangone wants to merge 2 commits into
Homebrew:mainfrom
hangone:fix-cask-macos-requirements

Conversation

@hangone

@hangone hangone commented May 4, 2026

Copy link
Copy Markdown

When a cask has macOS requirements without specific version numbers(with depends_on :macos), the page was rendering Requirements: macOS >= such as https://formulae.brew.sh/cask/zed.
image
This fix adds a check to only display the requirement if version information is present.
And, I think this is an issue with Brew, see Homebrew/brew#22137.

$ curl -s https://formulae.brew.sh/api/cask/zed.json|jq .depends_on
{
  "macos": {
    ">=": [
      ""
    ]
  }
}

When a cask has macOS requirements without specific version numbers,
the page was rendering empty parentheses. This fix adds a check to
only display the requirement if version information is present.
Copilot AI review requested due to automatic review settings May 4, 2026 16:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes the cask page “Requirements” rendering when depends_on :macos is present but the generated JSON contains blank version entries (e.g., showing macOS >=).

Changes:

  • Add a guard in the macOS requirements rendering loop to skip entries whose version list is effectively empty.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread _layouts/cask.html
Comment on lines 70 to +76
{%- capture requirements -%}
macOS {% for x in c.depends_on.macos -%}
{{ x.first | escape }} <strong>{{ c.depends_on.macos[x.first] | join: "</strong> / <strong>" }}</strong>
{%- unless forloop.last %} and {% endunless -%}
{%- assign versions = x.last | join: "" | strip -%}
{%- if versions.size > 0 -%}
{{ x.first | escape }} <strong>{{ c.depends_on.macos[x.first] | join: "</strong> / <strong>" }}</strong>
{%- unless forloop.last %} and {% endunless -%}
{%- endif -%}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread _layouts/cask.html
Comment on lines +83 to +84
{%- else -%}
macOS

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think that if depends_on :macos is specified, macOS needs to be added.

@MikeMcQuaid

Copy link
Copy Markdown
Member

Does Homebrew/brew#22137 need merged first or second?

@hangone

hangone commented May 5, 2026

Copy link
Copy Markdown
Author

Does Homebrew/brew#22137 need merged first or second?

If that one is merged first, this PR won't be needed.

@hangone

hangone commented May 7, 2026

Copy link
Copy Markdown
Author

fixed via Homebrew/brew#22137

@hangone hangone closed this May 7, 2026
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