Repository navigation
Expand file tree
/
Copy pathgitstatus.rb
More file actions
79 lines (65 loc) · 3.06 KB
/
Copy pathgitstatus.rb
File metadata and controls
79 lines (65 loc) · 3.06 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
class Gitstatus < Formula
desc "Status daemon used by shell prompts"
homepage "https://github.com/simnalamburt/gitstatus"
url "https://github.com/simnalamburt/gitstatus/archive/fbca4a5a589b991f9cc4b24306d270558f56812d.tar.gz"
version "1.5.5-fbca4a5"
sha256 "f17a20ddb28166c7760cfccc73ab19fd20eb9542dbfed3c3eb647588f8496d70"
license "GPL-3.0-or-later"
head "https://github.com/simnalamburt/gitstatus.git", branch: "master"
bottle do
root_url "https://github.com/simnalamburt/homebrew-x/releases/download/gitstatus-1.5.5-fbca4a5"
sha256 cellar: :any_skip_relocation, arm64_tahoe: "e2d50fdf276ee61e53a9dd912eceb431b5dfdbbeaf38a5f662d343963efa7429"
sha256 cellar: :any_skip_relocation, arm64_sequoia: "f242643d5b821baf551d217f05572c23c3acff3cf16462add21fbcd7f021ec5c"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "612a7c9ee52bd3b4f1bd26e49c09b9a8d724646575887f6806d2392a5fdb2495"
sha256 cellar: :any, x86_64_linux: "47c37b3aabf65b42264febc8f23a7c99597902bd99ba15320130e6765f446e25"
end
depends_on "cmake" => :build
depends_on "libiconv" => :build if OS.mac?
uses_from_macos "zlib"
resource "libgit2" do
url "https://github.com/libgit2/libgit2/archive/44c05e5d12f2b8b86b9730bb50f27daf74143782.tar.gz"
sha256 "5217ab829229b8435970a76a41e17ba5538926d7cd6cb95a948e761dea72e3c0"
end
def install
if OS.mac?
inreplace "build",
'brew_prefix="$(command brew --prefix)"',
"brew_prefix=\"#{HOMEBREW_PREFIX}\""
end
if OS.linux?
# glibc static PIE can crash in Homebrew's Linux sandbox during the
# build script's smoke test; keep Homebrew's system runtime dynamic.
inreplace "build" do |s|
s.sub!(
" linux)\n gitstatus_ldflags=\"$gitstatus_ldflags ${static_pie:--static}\"",
" linux)\n gitstatus_ldflags=\"$gitstatus_ldflags\"",
)
end
end
(buildpath/"deps").mkpath
cp resource("libgit2").cached_download,
buildpath/"deps/libgit2-44c05e5d12f2b8b86b9730bb50f27daf74143782.tar.gz"
system "./build"
bin.install "usrbin/gitstatusd"
pkgshare.install "gitstatus.plugin.sh", "gitstatus.plugin.zsh"
pkgshare.install "gitstatus.prompt.sh", "gitstatus.prompt.zsh"
end
def caveats
<<~EOS
Add this to your shell startup file, such as ~/.zshrc or ~/.bashrc:
export GITSTATUS_DAEMON=#{HOMEBREW_PREFIX}/bin/gitstatusd
EOS
end
test do
assert_match version.to_s.split("-").first, shell_output("#{bin}/gitstatusd --version")
system "git", "init", "--initial-branch=main", testpath/"repo"
system "git", "-C", testpath/"repo", "config", "user.name", "Your Name"
system "git", "-C", testpath/"repo", "config", "user.email", "[email protected]"
system "git", "-C", testpath/"repo", "commit", "--allow-empty",
"--allow-empty-message", "--no-gpg-sign", "-m", ""
response = pipe_output(bin/"gitstatusd", "hello\037#{testpath}/repo\036")
assert_match "hello", response
assert_match "#{testpath}/repo", response
assert_match "main", response
end
end