From 73079a5ca73d6c67eb5da99a1de7db260f6d0f9e Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Mon, 27 Jul 2026 14:29:58 -0400 Subject: [PATCH] fix(release): hoist install out of the formula's on_arm blocks Homebrew 6.0 enforces RuboCop's Sorbet/BlockMethodDefinition, which rejects `def` inside a block. The generated formula put a `def install` in each on_arm/on_intel stanza, so `brew style workos/tap` now fails with four offenses and takes `brew test-bot --only-tap-syntax` red on every homebrew-tap pull request. Emit a single class-level `def install` that globs the one asset the current platform downloaded, matching Formula/workos-emulate.rb in the same tap. Verified with brew 6.0.13: style, readall, and audit are all clean against a scratch tap built from the patched formula. Co-Authored-By: Claude Opus 5 (1M context) --- scripts/gen-homebrew-formula.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/gen-homebrew-formula.ts b/scripts/gen-homebrew-formula.ts index dd0c4f65..33a0b7fa 100644 --- a/scripts/gen-homebrew-formula.ts +++ b/scripts/gen-homebrew-formula.ts @@ -61,17 +61,15 @@ for (const platform of PLATFORMS) { shas.set(platform.asset, await sha256(platform.asset)); } -// One `on_arm`/`on_intel` stanza; each pins the URL + sha and installs the raw -// binary (named after the URL's basename) as `workos`. +// One `on_arm`/`on_intel` stanza; each pins only the URL + sha. `install` is +// deliberately NOT defined in here: RuboCop's Sorbet/BlockMethodDefinition +// (enforced by `brew style` since Homebrew 6.0) rejects `def` inside a block, +// so a single class-level `def install` globs whichever asset was downloaded. function stanza(cpu: 'arm' | 'intel', asset: string): string { return [ ` on_${cpu} do`, ` url "${DOWNLOAD_BASE}/${asset}"`, ` sha256 "${shas.get(asset)}"`, - '', - ' def install', - ` bin.install "${asset}" => "workos"`, - ' end', ' end', ].join('\n'); } @@ -98,6 +96,14 @@ ${macos.map((p) => stanza(p.cpu, p.asset)).join('\n')} ${linux.map((p) => stanza(p.cpu, p.asset)).join('\n')} end + # Exactly one of the four assets above is downloaded, so the glob resolves to + # that platform's binary; matches Formula/workos-emulate.rb in the same tap. + def install + binary = Dir["workos-*"].first + odie "No workos-* binary in the staging directory" if binary.nil? + bin.install binary => "workos" + end + test do assert_match version.to_s, shell_output("#{bin}/workos --version") end