Skip to content

Commit 63de7ca

Browse files
committed
Added homebrew template
1 parent a8ac25c commit 63de7ca

File tree

2 files changed

+39
-6
lines changed

2 files changed

+39
-6
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,23 @@ jobs:
133133
TAG=${{ steps.get_version.outputs.tag }}
134134
SHA256=${{ steps.sha256.outputs.sha256 }}
135135
136-
# Try Formula/ directory first, then root
137-
if [ -f "homebrew-tap/Formula/swift-mock-generator.rb" ]; then
136+
# Copy template from main repo to homebrew tap
137+
TEMPLATE_FILE="Formula/swift-mock-generator.rb"
138+
139+
if [ ! -f "$TEMPLATE_FILE" ]; then
140+
echo "Error: Template file not found at $TEMPLATE_FILE"
141+
exit 1
142+
fi
143+
144+
# Determine where to place the formula in the tap repo
145+
if [ -d "homebrew-tap/Formula" ]; then
138146
FORMULA_FILE="homebrew-tap/Formula/swift-mock-generator.rb"
139-
elif [ -f "homebrew-tap/swift-mock-generator.rb" ]; then
140-
FORMULA_FILE="homebrew-tap/swift-mock-generator.rb"
141147
else
142-
echo "Error: Formula file not found"
143-
exit 1
148+
FORMULA_FILE="homebrew-tap/swift-mock-generator.rb"
144149
fi
145150
151+
# Copy template and update placeholders
152+
cp "$TEMPLATE_FILE" "$FORMULA_FILE"
146153
sed -i '' "s/VERSION_PLACEHOLDER/${TAG}/g" "$FORMULA_FILE"
147154
sed -i '' "s/SHA256_PLACEHOLDER/${SHA256}/g" "$FORMULA_FILE"
148155

Formula/swift-mock-generator.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# typed: false
2+
# frozen_string_literal: true
3+
4+
# This file was generated automatically by GitHub Actions
5+
# Do not edit this file manually. It will be overwritten on each release.
6+
7+
class SwiftMockGenerator < Formula
8+
desc "Generate Swift mocks from annotated source code"
9+
homepage "https://github.com/manucodin/SwiftMockGenerator"
10+
url "https://github.com/manucodin/SwiftMockGenerator/archive/refs/tags/VERSION_PLACEHOLDER.tar.gz"
11+
sha256 "SHA256_PLACEHOLDER"
12+
license "MIT"
13+
14+
depends_on macos: ">= :monterey"
15+
depends_on xcode: ["15.0", :build]
16+
17+
def install
18+
system "swift", "build", "-c", "release", "--disable-sandbox"
19+
bin.install ".build/release/swift-mock-generator"
20+
end
21+
22+
test do
23+
system "#{bin}/swift-mock-generator", "--help"
24+
end
25+
end
26+

0 commit comments

Comments
 (0)