2015-01-13 15:47:27 +00:00
|
|
|
require "language/go"
|
2014-03-08 00:59:40 +00:00
|
|
|
|
|
|
|
class Fzf < Formula
|
2016-01-16 12:23:26 +00:00
|
|
|
desc "Command-line fuzzy finder written in Go"
|
2014-03-08 00:59:40 +00:00
|
|
|
homepage "https://github.com/junegunn/fzf"
|
2016-03-23 04:19:51 +00:00
|
|
|
url "https://github.com/junegunn/fzf/archive/0.11.4.tar.gz"
|
|
|
|
sha256 "08871ad531c3931224721d4cd56651bf7d109c559a1bbdbfa7c787e3dd03d733"
|
2015-08-03 12:55:31 +00:00
|
|
|
head "https://github.com/junegunn/fzf.git"
|
2015-01-13 15:47:27 +00:00
|
|
|
|
2015-01-13 17:08:56 +00:00
|
|
|
bottle do
|
2015-09-13 01:16:29 +00:00
|
|
|
cellar :any_skip_relocation
|
2016-03-23 05:36:18 +00:00
|
|
|
sha256 "f11bede99408f7b0352fb7ca87146201f138022ea188f2c06ee0586c583de013" => :el_capitan
|
|
|
|
sha256 "f561a60e6a2ff9b94f1ba35f27e58722191b8ee2e963555349bb6c6737f0fdba" => :yosemite
|
|
|
|
sha256 "5f382c442b25408e43a8fb4b11837ae1446845bd65799fb8c2ee6a59b2e11d2c" => :mavericks
|
2015-01-13 17:08:56 +00:00
|
|
|
end
|
|
|
|
|
2015-01-13 15:47:27 +00:00
|
|
|
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
|
2014-03-08 00:59:40 +00:00
|
|
|
|
|
|
|
def install
|
2015-01-13 15:47:27 +00:00
|
|
|
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
|
|
|
|
|
2015-04-01 12:58:09 +00:00
|
|
|
prefix.install %w[install uninstall LICENSE]
|
|
|
|
(prefix/"shell").install %w[bash zsh fish].map { |s| "shell/key-bindings.#{s}" }
|
2015-05-21 15:35:46 +00:00
|
|
|
(prefix/"shell").install %w[bash zsh].map { |s| "shell/completion.#{s}" }
|
2014-03-30 16:07:39 +00:00
|
|
|
(prefix/"plugin").install "plugin/fzf.vim"
|
2015-04-01 12:58:09 +00:00
|
|
|
man1.install "man/man1/fzf.1"
|
|
|
|
bin.install "bin/fzf-tmux"
|
2014-03-08 00:59:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
To install useful keybindings and fuzzy completion:
|
2015-09-05 15:34:15 +00:00
|
|
|
#{opt_prefix}/install
|
2014-03-30 16:07:39 +00:00
|
|
|
|
|
|
|
To use fzf in Vim, add the following line to your .vimrc:
|
2015-09-05 15:34:15 +00:00
|
|
|
set rtp+=#{opt_prefix}
|
2014-03-08 00:59:40 +00:00
|
|
|
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
|
2014-03-08 00:59:40 +00:00
|
|
|
end
|
|
|
|
end
|