summaryrefslogtreecommitdiffstats
path: root/.github/workflows/q.rb.brew-formula-template
blob: db9c9637cf703eb4a5a8f499e0d75f0d811b05d7 (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
31
32
# frozen_string_literal: true

# Formula for q
class Q < Formula
  desc "Run SQL directly on CSV or TSV files"
  homepage "https://harelba.github.io/q/"
  url "https://github.com/harelba/q/archive/v3.1.5.tar.gz"

  sha256 "0f4656b19087332d5113dd38907b50d70c55a57b3e97f810b8090132412dc9fb"

  license "GPL-3.0-or-later"
  revision 1

  depends_on "pyoxidizer" => :build
  depends_on "python@3.8" => :build
  depends_on "ronn" => :build
  depends_on xcode: ["12.4", :build]

  def install
    system "pyoxidizer", "build", "--release"
    bin.install "./build/x86_64-apple-darwin/release/install/q"

    system "ronn", "--roff", "--section=1", "doc/USAGE.markdown"
    man1.install "doc/USAGE.1" => "q.1"
  end

  test do
    seq = (1..100).map(&:to_s).join("\n")
    output = pipe_output("#{bin}/q -c 1 'select sum(c1) from -'", seq)
    assert_equal "5050\n", output
  end
end