72 lines
2.3 KiB
Ruby
72 lines
2.3 KiB
Ruby
require "language/go"
|
|
|
|
class Fzf < Formula
|
|
desc "Command-line fuzzy finder written in Go"
|
|
homepage "https://github.com/junegunn/fzf"
|
|
url "https://github.com/junegunn/fzf/archive/0.16.6.tar.gz"
|
|
sha256 "6be4f32decc2e50b24a4b120a1e2217b437a2eaa77063435b0eb3268fc3f6573"
|
|
head "https://github.com/junegunn/fzf.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "f5db19214d8b6b03e752105978a82f5543a19908c02ee9cf7088765b66ab6aba" => :sierra
|
|
sha256 "57b1396a3241daf95b33637868d33153c42de8ad538b161a061352fe8e9645b6" => :el_capitan
|
|
sha256 "90d0e50a039e38f38c834440c1fe4c30151b970ccfe7c2c0871c10d2661b3a96" => :yosemite
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
go_resource "github.com/junegunn/go-isatty" do
|
|
url "https://github.com/junegunn/go-isatty.git",
|
|
:revision => "66b8e73f3f5cda9f96b69efd03dd3d7fc4a5cdb8"
|
|
end
|
|
|
|
go_resource "github.com/junegunn/go-runewidth" do
|
|
url "https://github.com/junegunn/go-runewidth.git",
|
|
:revision => "14207d285c6c197daabb5c9793d63e7af9ab2d50"
|
|
end
|
|
|
|
go_resource "github.com/junegunn/go-shellwords" do
|
|
url "https://github.com/junegunn/go-shellwords.git",
|
|
:revision => "33bd8f1ebe16d6e5eb688cc885749a63059e9167"
|
|
end
|
|
|
|
go_resource "golang.org/x/crypto" do
|
|
url "https://go.googlesource.com/crypto.git",
|
|
:revision => "453249f01cfeb54c3d549ddb75ff152ca243f9d8"
|
|
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", "man/man1/fzf-tmux.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
|