20 lines
590 B
Ruby
20 lines
590 B
Ruby
class Psql2csv < Formula
|
|
desc "Run a query in psql and output the result as CSV"
|
|
homepage "https://github.com/fphilipe/psql2csv"
|
|
url "https://github.com/fphilipe/psql2csv/archive/v0.10.tar.gz"
|
|
sha256 "09ab6a76c1de1fadf29558ef63afcbbfcee5483a2b9b913cb0fbc139107d8d5a"
|
|
|
|
bottle :unneeded
|
|
|
|
depends_on "postgresql"
|
|
|
|
def install
|
|
bin.install "psql2csv"
|
|
end
|
|
|
|
test do
|
|
expected = "COPY (SELECT 1) TO STDOUT WITH (FORMAT csv, ENCODING 'UTF8', HEADER true)"
|
|
output = shell_output(%Q(#{bin}/psql2csv --dry-run "SELECT 1")).strip
|
|
assert_equal expected, output
|
|
end
|
|
end
|