homebrew-core/Formula/legit.rb

92 lines
4.1 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
sha256 cellar: :any_skip_relocation, arm64_monterey: "847baf64af8d13e960572ecfe5e4aac56e011f4d8311a49b78ac8d1f83db34e3"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "45fe51b376a34449cd93199646182637bd355132b276150a0ff0dab5cb305ed3"
sha256 cellar: :any_skip_relocation, monterey: "138610115001e54555a0ca056678dea41bb0f748b69196e4e5b0f90c73d79dbb"
sha256 cellar: :any_skip_relocation, big_sur: "c1680d88e27172e7952ee5c3cc0636c69ecc4bd93bbf1b1d3dc2f7d9de034009"
sha256 cellar: :any_skip_relocation, catalina: "15f21ba855fb569cd3d71a6afd8eb251c9ff9543a7259b064095a5a81d911da9"
sha256 cellar: :any_skip_relocation, x86_64_linux: "365418618f6dd01471cd8f7e96666f30df2245056313fb0b406b462cd73f78d1"
end
depends_on "python@3.10"
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/1f/bb/5d3246097ab77fa083a61bd8d3d527b7ae063c7d8e8671b1cf8c4ec10cbe/colorama-0.4.4.tar.gz"
sha256 "5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"
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/d6/39/5b91b6c40570dc1c753359de7492404ba8fe7d71af40b618a780c7ad1fc7/GitPython-3.1.27.tar.gz"
sha256 "1c885ce809e8ba2d88a29befeb385fcea06338d3640712b59ca623c220bb5704"
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