homebrew-core/Formula/fzf.rb
2015-12-31 02:06:41 -05:00

61 lines
2 KiB
Ruby

require "language/go"
class Fzf < Formula
desc "Fuzzy finder for your shell"
homepage "https://github.com/junegunn/fzf"
url "https://github.com/junegunn/fzf/archive/0.11.1.tar.gz"
sha256 "611cf1c2da6a7c0d5b582a203774c4d1145c55b601413eb1e7c03e9410bb6733"
head "https://github.com/junegunn/fzf.git"
bottle do
cellar :any_skip_relocation
sha256 "b99e418124d0711751002df86887478d3f964c97c02f44c3cc7fdc4322198d5d" => :el_capitan
sha256 "11e71224d564066cd480dad8278128fc75d295d2773a957e4eab1b92c6a09c32" => :yosemite
sha256 "969cf2e28deba27880684205555ee72c69912c7ba59d88342e66a501e8cd4669" => :mavericks
end
depends_on "go" => :build
go_resource "github.com/junegunn/go-shellwords" do
url "https://github.com/junegunn/go-shellwords.git",
:revision => "35d512af75e283aae4ca1fc3d44b159ed66189a4"
end
go_resource "github.com/junegunn/go-runewidth" do
url "https://github.com/junegunn/go-runewidth.git",
:revision => "63c378b851290989b19ca955468386485f118c65"
end
def install
ENV["GOPATH"] = buildpath
mkdir_p buildpath/"src/github.com/junegunn"
ln_s buildpath, buildpath/"src/github.com/junegunn/fzf"
Language::Go.stage_deps resources, buildpath/"src"
cd buildpath/"src/fzf" do
system "go", "build"
bin.install "fzf"
end
prefix.install %w[install uninstall LICENSE]
(prefix/"shell").install %w[bash zsh fish].map { |s| "shell/key-bindings.#{s}" }
(prefix/"shell").install %w[bash zsh].map { |s| "shell/completion.#{s}" }
(prefix/"plugin").install "plugin/fzf.vim"
man1.install "man/man1/fzf.1"
bin.install "bin/fzf-tmux"
end
def caveats; <<-EOS.undent
To install useful keybindings and fuzzy completion:
#{opt_prefix}/install
To use fzf in Vim, add the following line to your .vimrc:
set rtp+=#{opt_prefix}
EOS
end
test do
(testpath/"list").write %w[hello world].join($/)
assert_equal "world", shell_output("cat #{testpath}/list | #{bin}/fzf -f wld").chomp
end
end