55 lines
1.6 KiB
Ruby
55 lines
1.6 KiB
Ruby
require "formula"
|
|
require "language/go"
|
|
|
|
class Fzf < Formula
|
|
homepage "https://github.com/junegunn/fzf"
|
|
url "https://github.com/junegunn/fzf/archive/0.9.1.tar.gz"
|
|
sha1 "bf912638def189729a4be8455855469b8559f49b"
|
|
|
|
bottle do
|
|
sha1 "79538bea4c6fc3d2542ea0faf8df17c74327a055" => :yosemite
|
|
sha1 "ee2b759ecb4e8808f6007760846fec48ac23a982" => :mavericks
|
|
sha1 "043cd9c8578d26042d6bbb8de76aeebb18c714de" => :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($/)
|
|
assert_equal "world", shell_output("cat #{testpath}/list | #{bin}/fzf -f wld").chomp
|
|
end
|
|
end
|