diff --git a/Formula/miller.rb b/Formula/miller.rb new file mode 100644 index 0000000000..a996a8ed33 --- /dev/null +++ b/Formula/miller.rb @@ -0,0 +1,33 @@ +class Miller < Formula + desc "Like sed, awk, cut, join & sort for name-indexed data such as CSV" + homepage "https://github.com/johnkerl/miller" + url "https://github.com/johnkerl/miller/releases/download/v2.2.1/mlr-2.2.1.tar.gz" + sha256 "2e85b0a2beb295174a4346f98dec79573394064c1fc2f004fe6816feefb0ddbe" + + head do + url "https://github.com/johnkerl/miller.git" + + depends_on "automake" => :build + depends_on "autoconf" => :build + depends_on "libtool" => :build + end + + def install + system "autoreconf", "-fvi" if build.head? + system "./configure", "--prefix=#{prefix}", "--disable-silent-rules", + "--disable-dependency-tracking" + system "make" + system "make", "check" + system "make", "install" + end + + test do + (testpath/"test.csv").write <<-EOS.undent + a,b,c + 1,2,3 + 4,5,6 + EOS + output = pipe_output("#{bin}/mlr --csvlite cut -f a test.csv") + assert_match /a\n1\n4\n/, output + end +end