2015-04-22 05:43:27 +00:00
|
|
|
class Thefuck < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Programatically correct mistyped console commands"
|
2015-04-22 05:43:27 +00:00
|
|
|
homepage "https://github.com/nvbn/thefuck"
|
2015-08-25 02:59:01 +00:00
|
|
|
url "https://pypi.python.org/packages/source/t/thefuck/thefuck-2.8.tar.gz"
|
|
|
|
sha256 "40ac6c27974fc749557fe37f00e29100c26f25f038f3e63034f721442ac0b489"
|
2015-05-25 01:15:33 +00:00
|
|
|
|
|
|
|
head "https://github.com/nvbn/thefuck.git"
|
2015-04-22 05:43:27 +00:00
|
|
|
|
2015-04-22 06:03:40 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2015-08-25 03:10:39 +00:00
|
|
|
sha256 "bfaf5babb508ca12c22c87f62784051a1b0528959df403ccf788e374332c47a8" => :yosemite
|
|
|
|
sha256 "a206c186fa553ce3ea1f40eb4ed4160e12df5c630103a4d1f7d644815005430d" => :mavericks
|
|
|
|
sha256 "fedbc94b2769e205f64ea41b52942be1f4647e30dd4148365d518933927fa7c8" => :mountain_lion
|
2015-04-22 06:03:40 +00:00
|
|
|
end
|
|
|
|
|
2015-04-22 05:43:27 +00:00
|
|
|
depends_on :python if MacOS.version <= :snow_leopard
|
|
|
|
|
|
|
|
resource "psutil" do
|
2015-08-25 02:59:01 +00:00
|
|
|
url "https://pypi.python.org/packages/source/p/psutil/psutil-3.1.1.tar.gz"
|
|
|
|
sha256 "d3290bd4a027fa0b3a2e2ee87728056fe49d4112640e2b8c2ea4dd94ba0cf057"
|
2015-04-22 05:43:27 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "pathlib" do
|
|
|
|
url "https://pypi.python.org/packages/source/p/pathlib/pathlib-1.0.1.tar.gz"
|
|
|
|
sha256 "6940718dfc3eff4258203ad5021090933e5c04707d5ca8cc9e73c94a7894ea9f"
|
|
|
|
end
|
|
|
|
|
2015-04-24 06:09:35 +00:00
|
|
|
resource "colorama" do
|
|
|
|
url "https://pypi.python.org/packages/source/c/colorama/colorama-0.3.3.tar.gz"
|
|
|
|
sha256 "eb21f2ba718fbf357afdfdf6f641ab393901c7ca8d9f37edd0bee4806ffa269c"
|
|
|
|
end
|
|
|
|
|
|
|
|
resource "six" do
|
|
|
|
url "https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz"
|
|
|
|
sha256 "e24052411fc4fbd1f672635537c3fc2330d9481b18c0317695b46259512c91d5"
|
|
|
|
end
|
|
|
|
|
2015-07-22 01:58:13 +00:00
|
|
|
resource "setuptools" do
|
2015-08-25 02:59:01 +00:00
|
|
|
url "https://pypi.python.org/packages/source/s/setuptools/setuptools-18.2.tar.gz"
|
|
|
|
sha256 "0994a58df27ea5dc523782a601357a2198b7493dcc99a30d51827a23585b5b1d"
|
2015-07-22 01:58:13 +00:00
|
|
|
end
|
2015-04-22 05:43:27 +00:00
|
|
|
|
2015-07-22 01:58:13 +00:00
|
|
|
def install
|
|
|
|
xy = Language::Python.major_minor_version "python"
|
|
|
|
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{xy}/site-packages"
|
|
|
|
%w[setuptools pathlib psutil colorama six].each do |r|
|
|
|
|
resource(r).stage do
|
|
|
|
system "python", *Language::Python.setup_install_args(libexec/"vendor")
|
|
|
|
end
|
2015-04-22 05:43:27 +00:00
|
|
|
end
|
2015-07-22 01:58:13 +00:00
|
|
|
|
|
|
|
ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{xy}/site-packages"
|
2015-04-22 05:43:27 +00:00
|
|
|
system "python", *Language::Python.setup_install_args(libexec)
|
|
|
|
|
|
|
|
bin.install Dir["#{libexec}/bin/*"]
|
|
|
|
bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"])
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
2015-07-22 01:58:13 +00:00
|
|
|
Add the following to your .bash_profile, .bashrc or .zshrc:
|
2015-05-12 01:56:42 +00:00
|
|
|
|
2015-08-13 18:18:38 +00:00
|
|
|
eval "$(thefuck --alias)"
|
2015-07-29 17:57:19 +00:00
|
|
|
|
|
|
|
For other shells, check https://github.com/nvbn/thefuck/wiki/Shell-aliases
|
2015-04-22 05:43:27 +00:00
|
|
|
EOS
|
|
|
|
end
|
2015-07-11 20:39:28 +00:00
|
|
|
|
|
|
|
test do
|
2015-08-11 01:31:33 +00:00
|
|
|
assert_equal "The Fuck #{version}", shell_output("#{bin}/thefuck --version 2>&1").chomp
|
|
|
|
assert_match /.+TF_ALIAS.+thefuck.+/, shell_output("#{bin}/thefuck --alias").chomp
|
|
|
|
IO.popen("#{bin}/thefuck git branchh 2>&1", "r+") do |pipe|
|
|
|
|
pipe.puts "\n"
|
|
|
|
pipe.close_write
|
|
|
|
assert_match /git branch.+/, pipe.gets.chomp
|
|
|
|
pipe.close
|
|
|
|
end
|
2015-07-11 20:39:28 +00:00
|
|
|
end
|
2015-04-22 05:43:27 +00:00
|
|
|
end
|