From dad73b92eb168e7ec4830d7fd1397ae72211ece9 Mon Sep 17 00:00:00 2001
From: Andrew Gallant <jamslam@gmail.com>
Date: Wed, 21 Sep 2016 17:28:19 -0400
Subject: [PATCH] Add brew.

---
 README-NEW.md       | 11 +++++++++++
 pkg/brew/ripgrep.rb | 16 ++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 pkg/brew/ripgrep.rb

diff --git a/README-NEW.md b/README-NEW.md
index 7e046cdc..3e8225cd 100644
--- a/README-NEW.md
+++ b/README-NEW.md
@@ -57,6 +57,9 @@ for a very detailed comparison with more benchmarks and analysis.
   color and full Unicode support. Unlike GNU grep, `ripgrep` stays fast while
   supporting Unicode (which is always on).
 
+In other words, use `ripgrep` if you like speed, sane defaults, fewer bugs and
+Unicode.
+
 ### Is it really faster than everything else?
 
 Yes. A large number of benchmarks with detailed analysis for each is
@@ -96,6 +99,14 @@ but you'll need to have the
 Tools](http://landinghub.visualstudio.com/visual-cpp-build-tools)
 installed.
 
+If you're a `brew` user, then you can install it with a custom formula
+(N.B. `ripgrep` isn't actually in Homebrew yet. This just installs the binary
+directly):
+
+```
+$ brew install https://github.com/BurntSushi/ripgrep/blob/master/pkg/brew/ripgrep.rb
+```
+
 If you're a Rust programmer, `ripgrep` can be installed with `cargo`:
 
 ```
diff --git a/pkg/brew/ripgrep.rb b/pkg/brew/ripgrep.rb
new file mode 100644
index 00000000..c3c45095
--- /dev/null
+++ b/pkg/brew/ripgrep.rb
@@ -0,0 +1,16 @@
+require  'formula'
+class Ripgrep < Formula
+  version '0.1.8'
+  desc "Search tool like grep and The Silver Searcher."
+  homepage "https://github.com/BurntSushi/ripgrep"
+
+  if Hardware::CPU.is_64_bit?
+    url "https://github.com/BurntSushi/ripgrep/releases/download/#{version}/ripgrep-#{version}-x86_64-apple-darwin.tar.gz"
+  else
+    url "https://github.com/BurntSushi/ripgrep/releases/download/#{version}/ripgrep-#{version}-i686-apple-darwin.tar.gz"
+  end
+
+  def install
+    bin.install "rg"
+  end
+end