Skip to content

fix(cask): replace postflight with postflight_steps - #74

Open
lesleslie wants to merge 1 commit into
redis-stack:masterfrom
lesleslie:fix/postflight-steps-deprecation
Open

lesleslie wants to merge 1 commit into
redis-stack:masterfrom
lesleslie:fix/postflight-steps-deprecation

Conversation

@lesleslie

Copy link
Copy Markdown

Summary

Companion to #73. Fixes the matching deprecation warning on the install side:

Warning: Calling `postflight` is deprecated! Use `postflight_steps` instead.
Please report this issue to the redis-stack/homebrew-redis-stack tap (not Homebrew/* repositories), or even better, submit a PR to fix it:
  /usr/local/Homebrew/Library/Taps/redis-stack/homebrew-redis-stack/Casks/redis-stack-server.rb:18

What changed

Replaced the deprecated postflight block with the structured postflight_steps block. Each existing operation maps cleanly onto a curated step call:

Original (deprecated) Replacement (steps DSL)
FileUtils.mkdir_p(confdir) mkdir_p "{{HOMEBREW_PREFIX}}/etc"
FileUtils.cp(src, conffile) unless File.exist?(conffile) unless_path_exists ... do copy ... end
binaries.each + File.symlink ... unless File.exist?(dest) one symlink ... remove_on_uninstall: true per binary
Dir[".../*.so"].each + File.basename + File.symlink symlink ... source_glob: true, remove_on_uninstall: true

Paths use the {{HOMEBREW_PREFIX}} / {{caskroom_path}} / {{version}} template syntax (steps-DSL requires this in place of Ruby interpolation).

Every symlink carries remove_on_uninstall: true, so Homebrew tracks and removes the symlinks it created on uninstall — preserving the original safety property of never touching user-installed files at the same paths.

Relationship to #73

The uninstall_postflight block on the uninstall side has the same deprecation (#73). Once both PRs land, install/uninstall use the same tracked symlink lifecycle (postflight_steps → auto-cleanup on uninstall). I left that block alone on this branch to keep the diffs small and reviewable; #73 supersedes it.

Companion to redis-stack#73. The legacy `postflight` block on the install side is
deprecated and prints the matching warning on every install:

    Warning: Calling `postflight` is deprecated! Use `postflight_steps`
    instead.

`postflight_steps` requires structured step calls with literal
arguments — no arbitrary Ruby. This commit maps each existing operation:

| Original (deprecated) | Replacement (steps DSL) |
| --- | --- |
| `FileUtils.mkdir_p(confdir)` | `mkdir_p "{{HOMEBREW_PREFIX}}/etc"` |
| `FileUtils.cp(src, conffile) unless File.exist?(conffile)` | `unless_path_exists ... do copy ... end` |
| `binaries.each` + `File.symlink ... unless File.exist?(dest)` | one `symlink ... remove_on_uninstall: true` per binary |
| `Dir[".../*.so"].each` + `File.basename` + `File.symlink` | `symlink ... source_glob: true, remove_on_uninstall: true` |
| Ruby interpolation `#{HOMEBREW_PREFIX}` | template substitution `{{HOMEBREW_PREFIX}}` (required inside steps blocks) |
| Ruby interpolation `#{caskroom_path}/#{version}` | template substitution `{{caskroom_path}}/{{version}}` |

Each `symlink` carries `remove_on_uninstall: true` so Homebrew tracks
and removes the symlinks it created on uninstall — preserving the
original safety property of never touching user-installed files at the
same paths. The matching `uninstall_postflight` block is left for
redis-stack#73; once both land the install/uninstall sides use the same tracked
symlink lifecycle.
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.

1 participant