homebrew-core/Formula/thefuck.rb

81 lines
3.1 KiB
Ruby

class Thefuck < Formula
include Language::Python::Virtualenv
desc "Programatically correct mistyped console commands"
homepage "https://github.com/nvbn/thefuck"
url "https://files.pythonhosted.org/packages/01/1a/10e676e130e6b1d7f59905074da19bb4b85f901d8c62cee8cf90f7e5d168/thefuck-3.16.tar.gz"
sha256 "4d33b30db8e1496148a558494f3a3508677ff58214da1c024a5201c899ec7c75"
head "https://github.com/nvbn/thefuck.git"
bottle do
cellar :any_skip_relocation
sha256 "18b6fbb95e163593386c6813dd4e235c33312660fdc5985db3c5cb219e376f03" => :sierra
sha256 "ecb4ebadb1431e531f70aa9b3b68d7fa2e88641d462322227c94daeda53d07ed" => :el_capitan
sha256 "fca3ab9b25c4295e7fddb2497da715a67b7d5d20fdc77d963d780fb62c8c7a21" => :yosemite
end
depends_on :python if MacOS.version <= :snow_leopard
resource "colorama" do
url "https://files.pythonhosted.org/packages/f0/d0/21c6449df0ca9da74859edc40208b3a57df9aca7323118c913e58d442030/colorama-0.3.7.tar.gz"
sha256 "e043c8d32527607223652021ff648fbb394d5e19cba9f1a698670b338c9d782b"
end
resource "decorator" do
url "https://files.pythonhosted.org/packages/cc/ac/5a16f1fc0506ff72fcc8fd4e858e3a1c231f224ab79bb7c4c9b2094cc570/decorator-4.0.11.tar.gz"
sha256 "953d6bf082b100f43229cf547f4f97f97e970f5ad645ee7601d55ff87afdfe76"
end
resource "pathlib2" do
url "https://files.pythonhosted.org/packages/ab/d8/ac7489d50146f29d0a14f65545698f4545d8a6b739b24b05859942048b56/pathlib2-2.2.1.tar.gz"
sha256 "ce9007df617ef6b7bd8a31cd2089ed0c1fed1f7c23cf2bf1ba140b3dd563175d"
end
resource "psutil" do
url "https://files.pythonhosted.org/packages/57/93/47a2e3befaf194ccc3d05ffbcba2cdcdd22a231100ef7e4cf63f085c900b/psutil-5.2.2.tar.gz"
sha256 "44746540c0fab5b95401520d29eb9ffe84b3b4a235bd1d1971cbe36e1f38dd13"
end
resource "scandir" do
url "https://files.pythonhosted.org/packages/bd/f4/3143e0289faf0883228017dbc6387a66d0b468df646645e29e1eb89ea10e/scandir-1.5.tar.gz"
sha256 "c2612d1a487d80fb4701b4a91ca1b8f8a695b1ae820570815e85e8c8b23f1283"
end
resource "six" do
url "https://files.pythonhosted.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz"
sha256 "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a"
end
def install
virtualenv_install_with_resources
end
def caveats; <<-EOS.undent
Add the following to your .bash_profile, .bashrc or .zshrc:
eval "$(thefuck --alias)"
For other shells, check https://github.com/nvbn/thefuck/wiki/Shell-aliases
EOS
end
test do
ENV["THEFUCK_REQUIRE_CONFIRMATION"] = "false"
output = shell_output("#{bin}/thefuck --version 2>&1")
assert_match "The Fuck #{version} using Python", output
output = shell_output("#{bin}/thefuck --alias")
assert_match "TF_ALIAS=fuck", output
output = shell_output("#{bin}/thefuck git branchh")
assert_equal "git branch", output.chomp
output = shell_output("#{bin}/thefuck echho ok")
assert_equal "echo ok", output.chomp
output = shell_output("#{bin}/fuck")
assert_match "Seems like fuck alias isn't configured!", output
end
end