diff --git a/Casks/buffer.rb b/Casks/buffer.rb new file mode 100644 index 0000000..f7fb366 --- /dev/null +++ b/Casks/buffer.rb @@ -0,0 +1,24 @@ +cask "buffer" do + version "1.6" + + if Hardware::CPU.arm? + sha256 "2c3132215914962631a793164278f2d6290be2e16205266cb3e8a7e8e6ea8b00" + url "https://github.com/samirpatil2000/Buffer/releases/download/buffer-v#{version}/Buffer_Silicon.dmg" + else + sha256 "8c8684be5cada264be865686436e2544e5c4d5e13c506d926094921311832a46" + url "https://github.com/samirpatil2000/Buffer/releases/download/buffer-v#{version}/Buffer_Intel.dmg" + end + + name "Buffer" + desc "Lightweight clipboard manager for macOS" + homepage "https://github.com/samirpatil2000/Buffer" + + depends_on macos: ">= :ventura" + + app "Buffer.app" + + zap trash: [ + "~/Library/Application Support/Buffer", + "~/Library/Preferences/com.samirpatil.Buffer.plist", + ] +end diff --git a/README.md b/README.md index ca1c9e4..8d84fff 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,54 @@ --- +## 🍺 Install with Homebrew + +Buffer is a GUI macOS app, so Homebrew support should be added as a `cask`, not a formula. + +### For users + +If you publish a tap, users can install Buffer with: + +```bash +brew install --cask samirpatil2000/buffer/buffer +``` + +### For maintainers + +The easiest setup is: + +1. Create a tap repo named `homebrew-buffer` +2. Keep the cask file at `Casks/buffer.rb` +3. Continue shipping notarized `.dmg` assets from GitHub Releases + +This repo includes a helper script to generate the cask from your release DMGs: + +```bash +./scripts/generate_homebrew_cask.sh 1.6 Buffer_Silicon.dmg Buffer_Intel.dmg +``` + +That writes `Casks/buffer.rb` using: + +- `https://github.com/samirpatil2000/Buffer/releases/download/buffer-v#{version}/Buffer_Silicon.dmg` +- `https://github.com/samirpatil2000/Buffer/releases/download/buffer-v#{version}/Buffer_Intel.dmg` + +Typical release flow: + +```bash +# 1. Build and notarize both DMGs +./build_dmg.sh + +# 2. Generate the Homebrew cask with real SHA256 values +./scripts/generate_homebrew_cask.sh 1.6 Buffer_Silicon.dmg Buffer_Intel.dmg + +# 3. Commit Casks/buffer.rb to your tap repo +# 4. Push the release assets and the cask update +``` + +If you want to use this repo itself as the tap, users can still install from the full tap name or URL, but a dedicated `homebrew-buffer` repository is the standard Homebrew layout. + +--- + ## 🚀 Getting Started 1. **Download** the `.dmg` file from above diff --git a/scripts/generate_homebrew_cask.sh b/scripts/generate_homebrew_cask.sh new file mode 100755 index 0000000..1927d90 --- /dev/null +++ b/scripts/generate_homebrew_cask.sh @@ -0,0 +1,59 @@ +#!/bin/bash +set -euo pipefail + +if [[ $# -lt 1 || $# -gt 4 ]]; then + echo "Usage: $0 [arm64-dmg] [intel-dmg] [output-path]" + echo "Example: $0 1.6 Buffer_Silicon.dmg Buffer_Intel.dmg Casks/buffer.rb" + exit 1 +fi + +VERSION="$1" +ARM_DMG="${2:-Buffer_Silicon.dmg}" +INTEL_DMG="${3:-Buffer_Intel.dmg}" +OUTPUT_PATH="${4:-Casks/buffer.rb}" + +if [[ ! -f "$ARM_DMG" ]]; then + echo "Missing arm64 DMG: $ARM_DMG" >&2 + exit 1 +fi + +if [[ ! -f "$INTEL_DMG" ]]; then + echo "Missing Intel DMG: $INTEL_DMG" >&2 + exit 1 +fi + +ARM_SHA="$(shasum -a 256 "$ARM_DMG" | awk '{print $1}')" +INTEL_SHA="$(shasum -a 256 "$INTEL_DMG" | awk '{print $1}')" + +mkdir -p "$(dirname "$OUTPUT_PATH")" + +cat > "$OUTPUT_PATH" <= :ventura" + + app "Buffer.app" + + zap trash: [ + "~/Library/Application Support/Buffer", + "~/Library/Preferences/com.samirpatil.Buffer.plist", + ] +end +EOF + +echo "Wrote ${OUTPUT_PATH}" +echo "arm64 sha256: ${ARM_SHA}" +echo "intel sha256: ${INTEL_SHA}"