diff options
| author | Scott Abernethy | 2015-04-22 17:43:27 +1200 |
|---|---|---|
| committer | Xu Cheng | 2015-04-22 20:21:12 +0800 |
| commit | 9e28e25e6dbd24fa17e178db05ca889e3a521bd5 (patch) | |
| tree | abf8f05794d56c137e1757018ce627f7e4d4ab8d /Library | |
| parent | 6ca8bd31b1bd037c5f12ec6168eab555efbff290 (diff) | |
| download | homebrew-9e28e25e6dbd24fa17e178db05ca889e3a521bd5.tar.bz2 | |
thefuck 1.26
Closes #38927.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/thefuck.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Library/Formula/thefuck.rb b/Library/Formula/thefuck.rb new file mode 100644 index 000000000..7a6beba76 --- /dev/null +++ b/Library/Formula/thefuck.rb @@ -0,0 +1,47 @@ +class Thefuck < Formula + homepage "https://github.com/nvbn/thefuck" + url "https://pypi.python.org/packages/source/t/thefuck/thefuck-1.26.tar.gz" + sha256 "b81e0d4ac5eb3e3aec1014d948d26419a60a39cc1e20f20d82f7be652ed3b8c8" + + depends_on :python if MacOS.version <= :snow_leopard + + resource "psutil" do + url "https://pypi.python.org/packages/source/p/psutil/psutil-2.2.1.tar.gz" + sha256 "a0e9b96f1946975064724e242ac159f3260db24ffa591c3da0a355361a3a337f" + end + + resource "pathlib" do + url "https://pypi.python.org/packages/source/p/pathlib/pathlib-1.0.1.tar.gz" + sha256 "6940718dfc3eff4258203ad5021090933e5c04707d5ca8cc9e73c94a7894ea9f" + end + + def install + ENV["PYTHONPATH"] = libexec/"vendor/lib/python2.7/site-packages" + ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python2.7/site-packages" + + %w[psutil pathlib].each do |r| + resource(r).stage do + system "python", *Language::Python.setup_install_args(libexec/"vendor") + end + end + system "python", *Language::Python.setup_install_args(libexec) + + bin.install Dir["#{libexec}/bin/*"] + bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"]) + end + + test do + output = shell_output(bin/"thefuck echho") + assert output.include? "echo" + end + + def caveats; <<-EOS.undent + Add the following to your .bash_profile or .zshrc: + alias fuck='$(thefuck $(fc -ln -1))' + Or in config.fish: + function fuck + eval (thefuck $history[1]) + end + EOS + end +end |
