summaryrefslogtreecommitdiffstats
path: root/.github/workflows/q.rb.brew-formula-template
blob: c860a0ce92d85c818f807bc106304a55331b51bb (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
33
34
# 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/"
  # Using branch name for pre-releases, for tagged releases this would be the version tag, and not "version" part will be needed
  url "https://github.com/harelba/q/archive/3.1.3.tar.gz"

  # Removed for now, until everything is finalized
  # sha256 "0844aed6658d0347a299b84bee978c88724d45093e8cbd7b05506ecc0b93c98c"

  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