homebrew-core/Formula/fzf.rb

56 lines
1.6 KiB
Ruby
Raw Normal View History

require "formula"
require "language/go"
class Fzf < Formula
homepage "https://github.com/junegunn/fzf"
url "https://github.com/junegunn/fzf/archive/0.9.0.tar.gz"
sha1 "ccf8315fa092f59bd859eaeafd72bc86afdc91cc"
2015-01-13 17:08:56 +00:00
bottle do
sha1 "279c90b368719c32dc4573cbe1b61eeae9476eec" => :yosemite
sha1 "78a43ee898cebef1166b96cbd0964cc69fd1d0a7" => :mavericks
sha1 "048bd537360330b20ba03e77f2a58bf2157d10a3" => :mountain_lion
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 fzf-completion.bash fzf-completion.zsh LICENSE]
(prefix/"plugin").install "plugin/fzf.vim"
end
def caveats; <<-EOS.undent
To install useful keybindings and fuzzy completion:
#{prefix}/install
To use fzf in Vim, add the following line to your .vimrc:
set rtp+=#{prefix}
EOS
end
test do
(testpath/"list").write %w[hello world].join($/)
2014-05-04 19:12:41 +00:00
assert_equal "world", shell_output("cat #{testpath}/list | #{bin}/fzf -f wld").chomp
end
end