Repository navigation
Expand file tree
/
Copy pathoffshoot.rb
More file actions
42 lines (38 loc) · 1.66 KB
/
Copy pathoffshoot.rb
File metadata and controls
42 lines (38 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Homebrew formula for offshoot, served straight from this repo as a tap:
#
# brew tap sricola/offshoot https://github.com/sricola/offshoot
# brew install offshoot
#
# The explicit URL form of `brew tap` accepts a repo that is not named
# homebrew-*, and brew picks up formulae from the tap's Formula/ directory.
# Source build (depends_on "go" => :build) rather than per-arch bottles:
# it version-bumps by editing url+sha256 only, and mattn/go-sqlite3 compiles
# its bundled SQLite amalgamation via cgo, so no sqlite dependency is needed.
class Offshoot < Formula
desc "Branch SQLite like git: fork, checkpoint, rollback, promote"
homepage "https://github.com/sricola/offshoot"
url "https://github.com/sricola/offshoot/archive/refs/tags/v0.2.22.tar.gz"
sha256 "ca0f6a5ac5b02215d7cdb2584aef0c0c2e85f8e54e83f531588a17630321b665"
license "Apache-2.0"
head "https://github.com/sricola/offshoot.git", branch: "main"
depends_on "go" => :build
def install
ENV["CGO_ENABLED"] = "1"
# release.yml embeds the tag name (v-prefixed) as main.version; match it.
system "go", "build", *std_go_args(ldflags: "-s -w -X main.version=v#{version}"), "./cmd/offshoot"
end
def caveats
<<~EOS
`offshoot diff` shells out to sqldiff, which Homebrew ships as its
own formula (not part of `sqlite`):
brew install sqldiff
Everything else, including `offshoot diff --summary`, works without it.
EOS
end
test do
assert_match version.to_s, shell_output("#{bin}/offshoot version")
# `brew test` runs in a private tmpdir; init creates ./.offshoot there.
system bin/"offshoot", "init"
assert_path_exists testpath/".offshoot"
end
end