Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Casks/buffer.rb
Original file line number Diff line number Diff line change
@@ -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
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
59 changes: 59 additions & 0 deletions scripts/generate_homebrew_cask.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash
set -euo pipefail

if [[ $# -lt 1 || $# -gt 4 ]]; then
echo "Usage: $0 <version> [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" <<EOF
cask "buffer" do
version "${VERSION}"

if Hardware::CPU.arm?
sha256 "${ARM_SHA}"
url "https://github.com/samirpatil2000/Buffer/releases/download/buffer-v#{version}/Buffer_Silicon.dmg"
else
sha256 "${INTEL_SHA}"
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
EOF

echo "Wrote ${OUTPUT_PATH}"
echo "arm64 sha256: ${ARM_SHA}"
echo "intel sha256: ${INTEL_SHA}"