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/6b/65/819f84ef3caa4743c834122acb897df29167f6178c9c095d7896f2181387/legit-1.1.0.tar.gz" sha256 "25bd3809d657c9b0bd45a6a230dc7f58a56e6e068159d471ffeadb0cf4677b4d" head "https://github.com/frostming/legit.git", :branch => "master" bottle do cellar :any_skip_relocation sha256 "1f688323badcbca7aabde7b3d6714c143d40a5306de059ecdf7dbf815157143e" => :catalina sha256 "81ff474f13586a2e6e543e24d8bc2c40f29c671fa8fb194de3d5e501fcf2b7a2" => :mojave sha256 "b2b05bde239b036eec589a445c27ada95aca2330b76113bba72c7ad20e482d10" => :high_sierra end depends_on "python" 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/95/d9/c3336b6b5711c3ab9d1d3a80f1a3e2afeb9d8c02a7166462f6cc96570897/click-6.7.tar.gz" sha256 "f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b" 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/76/53/e785891dce0e2f2b9f4b4ff5bc6062a53332ed28833c7afede841f46a5db/colorama-0.4.1.tar.gz" sha256 "05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d" end resource "crayons" do url "https://files.pythonhosted.org/packages/14/fa/635fdd47686a0f29692d927333fcf39e0279fc39c81704866c97adc34053/crayons-0.1.2.tar.gz" sha256 "5e17691605e564d63482067eb6327d01a584bbaf870beffd4456a3391bd8809d" end resource "gitdb2" do url "https://files.pythonhosted.org/packages/c5/62/ed7205331e8d7cc377e2512cb32f8f8f075c0defce767551d0a76e102ce2/gitdb2-2.0.6.tar.gz" sha256 "1b6df1433567a51a4a9c1a5a0de977aa351a405cc56d7d35f3388bad1f630350" end resource "GitPython" do url "https://files.pythonhosted.org/packages/1c/08/a2b5ba4ad43c4c33066ced2c45958593ab2554bb0d09f7ecb9bf9092e5f6/GitPython-2.1.8.tar.gz" sha256 "ad61bc25deadb535b047684d06f3654c001d9415e1971e51c9c20f5b510076e9" end resource "six" do url "https://files.pythonhosted.org/packages/16/d8/bc6316cf98419719bd59c91742194c111b6f2e85abac88e496adefaf7afe/six-1.11.0.tar.gz" sha256 "70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9" end resource "smmap2" do url "https://files.pythonhosted.org/packages/3b/ba/e49102b3e8ffff644edded25394b2d22ebe3e645f3f6a8139129c4842ffe/smmap2-2.0.5.tar.gz" sha256 "29a9ffa0497e7f2be94ca0ed1ca1aa3cd4cf25a1f6b4f5f87f74b46ed91d609a" 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