aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/jq.rb
blob: 860b2c4650a2015443d7a86fb606b689ab9c7535 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require 'formula'

class Jq < Formula
  homepage 'http://stedolan.github.io/jq/'
  url 'http://stedolan.github.io/jq/download/source/jq-1.4.tar.gz'
  sha1 '71da3840839ec74ae65241e182ccd46f6251c43e'

  depends_on 'bison' => :build # jq depends on bison > 2.5

  head do
    url 'https://github.com/stedolan/jq.git'

    depends_on 'oniguruma'
    depends_on 'autoconf' => :build
    depends_on 'automake' => :build
    depends_on 'libtool' => :build
  end

  def install
    system "autoreconf", "-iv" if build.head?
    system "./configure", "--disable-dependency-tracking",
                          "--disable-silent-rules",
                          "--prefix=#{prefix}"
    system "make", "install"
  end

  test do
    assert_equal "2\n", pipe_output("#{bin}/jq .bar", '{"foo":1, "bar":2}')
  end
end