/
legit.rb
97 lines (83 loc) 路 4.48 KB
/
legit.rb
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
class Legit < Formula
include Language::Python::Virtualenv
desc "Command-line interface for Git, optimized for workflow simplicity"
homepage "https://frostming.github.io/legit/"
url "https://files.pythonhosted.org/packages/cb/e4/8cc5904c486241bf2edc4dd84f357fa96686dc85f48eedb835af65f821bf/legit-1.2.0.post0.tar.gz"
sha256 "949396b68029a8af405ab20c901902341ef6bd55c7fec6dab71141d63d406b11"
license "BSD-3-Clause"
revision 8
head "https://github.com/frostming/legit.git", branch: "master"
bottle do
rebuild 1
sha256 cellar: :any_skip_relocation, arm64_sonoma: "3a694b62cae123be0074315a42a4d6aac727c0e4f7fc8e1dd035a132a68f877e"
sha256 cellar: :any_skip_relocation, arm64_ventura: "5863ed078e9520d479ef59f271b8ccef53ea958df0e3d29a3fb9195b80bb21d9"
sha256 cellar: :any_skip_relocation, arm64_monterey: "1a7c8d69febea84183c6ac0c1192c6c56ef1e64c0302caef48a856f6ac34ee55"
sha256 cellar: :any_skip_relocation, sonoma: "964aae9af610c78e8b67f583f706423d728a1e43cf445f2ac47197139a041850"
sha256 cellar: :any_skip_relocation, ventura: "d90b973337c000dd1c0ea97a3674e7b4f1c78a37db7c1c0379723502349c5849"
sha256 cellar: :any_skip_relocation, monterey: "15db44657ad3300a55807e9eaae574c7cf9867f27a5f4fe45f404e4b14fad637"
sha256 cellar: :any_skip_relocation, x86_64_linux: "d93a2cc40905da123326fa7550996bc88a9e2bc08f04d074c574896242cf20fc"
end
depends_on "python@3.12"
resource "args" do
url "https://files.pythonhosted.org/packages/e5/1c/b701b3f4bd8d3667df8342f311b3efaeab86078a840fb826bd204118cc6b/args-0.1.0.tar.gz"
sha256 "a785b8d837625e9b61c39108532d95b85274acd679693b71ebb5156848fcf814"
end
resource "click" do
url "https://files.pythonhosted.org/packages/96/d3/f04c7bfcf5c1862a2a5b845c6b2b360488cf47af55dfa79c98f6a6bf98b5/click-8.1.7.tar.gz"
sha256 "ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"
end
resource "clint" do
url "https://files.pythonhosted.org/packages/3d/b4/41ecb1516f1ba728f39ee7062b9dac1352d39823f513bb6f9e8aeb86e26d/clint-0.5.1.tar.gz"
sha256 "05224c32b1075563d0b16d0015faaf9da43aa214e4a2140e51f08789e7a4c5aa"
end
resource "colorama" do
url "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz"
sha256 "08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"
end
resource "crayons" do
url "https://files.pythonhosted.org/packages/b8/6b/12a1dea724c82f1c19f410365d3e25356625b48e8009a7c3c9ec4c42488d/crayons-0.4.0.tar.gz"
sha256 "bd33b7547800f2cfbd26b38431f9e64b487a7de74a947b0fafc89b45a601813f"
end
resource "gitdb" do
url "https://files.pythonhosted.org/packages/19/0d/bbb5b5ee188dec84647a4664f3e11b06ade2bde568dbd489d9d64adef8ed/gitdb-4.0.11.tar.gz"
sha256 "bf5421126136d6d0af55bc1e7c1af1c397a34f5b7bd79e776cd3e89785c2b04b"
end
resource "gitpython" do
url "https://files.pythonhosted.org/packages/8f/12/71a40ffce4aae431c69c45a191e5f03aca2304639264faf5666c2767acc4/GitPython-3.1.42.tar.gz"
sha256 "2d99869e0fef71a73cbd242528105af1d6c1b108c60dfabd994bf292f76c3ceb"
end
resource "six" do
url "https://files.pythonhosted.org/packages/71/39/171f1c67cd00715f190ba0b100d606d440a28c93c7714febeca8b79af85e/six-1.16.0.tar.gz"
sha256 "1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"
end
resource "smmap" do
url "https://files.pythonhosted.org/packages/88/04/b5bf6d21dc4041000ccba7eb17dd3055feb237e7ffc2c20d3fae3af62baa/smmap-5.0.1.tar.gz"
sha256 "dceeb6c0028fdb6734471eb07c0cd2aae706ccaecab45965ee83f11c8d3b1f62"
end
def install
virtualenv_install_with_resources
bash_completion.install "extra/bash-completion/legit"
zsh_completion.install "extra/zsh-completion/_legit"
man1.install "extra/man/legit.1"
end
test do
(testpath/".gitconfig").write <<~EOS
[user]
name = Real Person
email = notacat@hotmail.cat
EOS
system "git", "init"
(testpath/"foo").write("woof")
system "git", "add", "foo"
system "git", "commit", "-m", "init"
system "git", "remote", "add", "origin", "https://github.com/git/git.git"
system "git", "branch", "test"
inreplace "foo", "woof", "meow"
assert_match "test", shell_output("#{bin}/legit branches")
output = shell_output("#{bin}/legit switch test")
assert_equal "Switched to branch 'test'", output.strip.lines.last
assert_equal "woof", (testpath/"foo").read
system "git", "stash", "pop"
assert_equal "meow", (testpath/"foo").read
end
end