2019-05-23 02:27:35 +00:00
|
|
|
class Csvq < Formula
|
|
|
|
desc "SQL-like query language for csv"
|
|
|
|
homepage "https://mithrandie.github.io/csvq"
|
2019-06-02 12:11:22 +00:00
|
|
|
url "https://github.com/mithrandie/csvq/archive/v1.11.4.tar.gz"
|
|
|
|
sha256 "facde7668ab90d879e1159d84909b7e52988880b7e999eaf1664cb4baa4440fd"
|
2019-05-23 02:27:35 +00:00
|
|
|
|
2019-05-23 05:32:07 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any_skip_relocation
|
2019-06-02 12:18:11 +00:00
|
|
|
sha256 "292deba5ee3673dc8cfbbd417e46b5bf928f55d14eb3f308021298b71fb7cab7" => :mojave
|
|
|
|
sha256 "e95262c8361a9aef8f5dec67e2509af4ebe8fc2ee4bb3cf900e706a63d94f266" => :high_sierra
|
|
|
|
sha256 "623f76dd524ab045d2e1582e6bcc6d41d9b18e06ec81f3fb1ddca255fac3eb46" => :sierra
|
2019-05-23 05:32:07 +00:00
|
|
|
end
|
|
|
|
|
2019-05-23 02:27:35 +00:00
|
|
|
depends_on "go" => :build
|
|
|
|
|
|
|
|
def install
|
|
|
|
system "make"
|
|
|
|
bin.install "csvq"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
system "#{bin}/csvq", "--version"
|
|
|
|
|
|
|
|
(testpath/"test.csv").write <<~EOS
|
|
|
|
a,b,c
|
|
|
|
1,2,3
|
|
|
|
EOS
|
|
|
|
expected = <<~EOS
|
|
|
|
a,b
|
|
|
|
1,2
|
|
|
|
EOS
|
|
|
|
result = shell_output("#{bin}/csvq --format csv 'SELECT a, b FROM `test.csv`'")
|
|
|
|
assert_equal expected, result
|
|
|
|
end
|
|
|
|
end
|