From f5b3f139a14513fa36d72e0bc8ba49724c6bfc7e Mon Sep 17 00:00:00 2001 From: Paul Bergeron Date: Fri, 9 Oct 2015 13:34:51 -0700 Subject: [PATCH] textql 2.0.0 (new formula) Textql allows fast execution of SQL statements over text files. Supports a *nix-like interface, stdin/stdout and pipes. Avoids disk access unless requested. --- Library/Formula/textql.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Library/Formula/textql.rb diff --git a/Library/Formula/textql.rb b/Library/Formula/textql.rb new file mode 100644 index 000000000000..e62d77ecda17 --- /dev/null +++ b/Library/Formula/textql.rb @@ -0,0 +1,30 @@ +require "language/go" + +class Textql < Formula + desc "Executes SQL across text files" + homepage "https://github.com/dinedal/textql" + url "https://github.com/dinedal/textql/archive/2.0.0.tar.gz" + sha256 "c9ea3c35332163be54d3b742ee8a691e82f10dbc0a4f3a76c35c1480787cd952" + + depends_on "go" => :build + + go_resource "github.com/mattn/go-sqlite3" do + url "https://github.com/mattn/go-sqlite3.git", + :revision => "8897bf145272af4dd0305518cfb725a5b6d0541c" + end + + def install + (buildpath + "src/github.com/dinedal/textql").install "inputs", "outputs", "storage", "sqlparser", "util", "cmd" + ENV["GOPATH"] = buildpath + Language::Go.stage_deps resources, buildpath/"src" + + system "go", "build", "-ldflags", "-X main.VERSION 2.0.0", "#{buildpath}/src/github.com/dinedal/textql/cmd/textql.go" + bin.install "textql" + end + + test do + version = pipe_output("#{bin}/textql --version") + assert_match /2.0.0/, version + assert_equal "3\n", pipe_output("#{bin}/textql -sql 'select count(*) from ???'", "a\nb\nc\n") + end +end