homebrew-core/Formula/legit.rb

95 lines
4.4 KiB
Ruby

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 3
head "https://github.com/frostming/legit.git", branch: "master"
bottle do
rebuild 1
sha256 cellar: :any_skip_relocation, arm64_ventura: "f4a2b7df7b4eb30d69b9e02efa46e5a1bc27482b8d27dfdac51b05bada80a3e2"
sha256 cellar: :any_skip_relocation, arm64_monterey: "61bdf4d2367da08fe2f4fe316f03242725de6ac46e4d0e9b69572d9e12affe67"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "e11124b41954a35784ba268114952d30738b5db6fef6beef8ba7dc5ef4523b26"
sha256 cellar: :any_skip_relocation, ventura: "b7fcd3cb170762d0b55e6fa7c2b0c5aabf574bf7efd4ee233973e9fe859f75c1"
sha256 cellar: :any_skip_relocation, monterey: "9e09bba4b62da8a3c7db65b3b975d3ffec2957dbab000e3d5cd8eac441c20390"
sha256 cellar: :any_skip_relocation, big_sur: "301fca4bdf92f6b9f72e115158ed9db588319e3eeb0965a911552e143bbb18cc"
sha256 cellar: :any_skip_relocation, catalina: "2b902ec1395bf89ebdf0e65d46fb5d8b337043a019aa4abc1e898c245cc9f44f"
sha256 cellar: :any_skip_relocation, x86_64_linux: "df1cc671bd12cf8063ca5d924661b706fb9a71e249e6f3cc271fc81b73297cc8"
end
depends_on "python@3.11"
depends_on "six"
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/59/87/84326af34517fca8c58418d148f2403df25303e02736832403587318e9e8/click-8.1.3.tar.gz"
sha256 "7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"
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/fc/44/64e02ef96f20b347385f0e9c03098659cb5a1285d36c3d17c56e534d80cf/gitdb-4.0.9.tar.gz"
sha256 "bac2fd45c0a1c9cf619e63a90d62bdc63892ef92387424b855792a6cabe789aa"
end
resource "GitPython" do
url "https://files.pythonhosted.org/packages/22/ab/3dd8b8a24399cee9c903d5f7600d20e8703d48904020f46f7fa5ac5474e9/GitPython-3.1.29.tar.gz"
sha256 "cc36bfc4a3f913e66805a28e84703e419d9c264c1077e537b54f0e1af85dbefd"
end
resource "smmap" do
url "https://files.pythonhosted.org/packages/21/2d/39c6c57032f786f1965022563eec60623bb3e1409ade6ad834ff703724f3/smmap-5.0.0.tar.gz"
sha256 "c840e62059cd3be204b0c9c9f74be2c09d5648eddd4580d9314c3ecde0b30936"
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