Skip to content

fix: migrate poke-token-bar to structured postflight steps - #2

Open
DwennK wants to merge 1 commit into
chattymin:mainfrom
DwennK:fix/poke-token-bar-postflight-steps
Open

DwennK wants to merge 1 commit into
chattymin:mainfrom
DwennK:fix/poke-token-bar-postflight-steps

Conversation

@DwennK

@DwennK DwennK commented Sep 15, 2026

Copy link
Copy Markdown

Summary

Homebrew prints a deprecation warning whenever it loads the poke-token-bar cask. Migrate its post-install hook to the structured postflight_steps DSL, using run and the deferred {{appdir}} token so the existing /usr/bin/xattr -cr command targets the configured application directory at installation time.

The command arguments, unprivileged execution and failure handling are preserved. Also remove an extra blank line and add the missing final newline flagged by brew style.

Related to #1: renaming the stanza alone fails to load on Homebrew 7.0.1-15-g82ea9cb with undefined local variable or method 'appdir' for an instance of Homebrew::InstallSteps::DSL. The block also needs run in place of the legacy system_command helper.

Reference: Homebrew's structured flight steps and interpolation documentation.

Validation

  • Loaded the changed cask with Homebrew's Cask::CaskLoader::FromContentLoader: no deprecation warning.
  • Round-tripped its structured steps through JSON, then ran the Homebrew install-step runner with a recording command adapter: verified /usr/bin/xattr, -cr, default /Applications and a custom application directory containing a space, sudo: false, and fail-on-error behavior. No application installation or real xattr command was performed.
  • Reproduced the load failure of the stanza-only rename in fix: use postflight_steps instead of deprecated postflight #1.
  • brew style Casks/poke-token-bar.rb: the install-step offense is resolved; two pre-existing offenses remain (Homebrew/OSDependsOn and Cask/ArrayAlphabetization). The original cask has five offenses; this patch introduces none.
  • git diff --check: passed.

Replace the legacy hook and system_command with postflight_steps and run.
Expand the application directory at install time with the appdir token.
Preserve xattr arguments, unprivileged execution and failure handling.
@Borisserz

Copy link
Copy Markdown

I verified this locally on Homebrew 7.0.7 using a throwaway local tap:

  • main: brew info --cask poke-token-bar prints Warning: Calling postflight is deprecated! Use postflight_steps instead. (the report in postflight deprecated in poke-token-bar cask PokeTokenBar#385).
  • This PR: no warning. brew cat shows the postflight_steps / run block parsed as written, and the xattr -cr target still resolves to {{appdir}}/PokeTokenBar.app.

It also works with the release automation. scripts/release.sh step 7/8 only rewrites the version "x.y.z" line with a regex, so it leaves the new block alone. The PR is still mergeable on top of the 2.5.5 bump.

LGTM from a downstream user. It fixes chattymin/PokeTokenBar#385.

@hanwoong89

Copy link
Copy Markdown

Still seeing the postflight deprecation warning on Homebrew 7.0.13 with poke-token-bar 2.5.7. This PR fixes it — would appreciate a merge when you get a chance. Thanks!

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.

4 participants