|
| 1 | +class Lazysql < Formula |
| 2 | + desc "Cross-platform TUI database management tool" |
| 3 | + homepage "https://github.com/jorgerojas26/lazysql" |
| 4 | + url "https://github.com/jorgerojas26/lazysql/archive/refs/tags/v0.3.4.tar.gz" |
| 5 | + sha256 "b8f725e7e3e26e4d8c90f5ce5f336f8916f9dfdeb9468736c7d8a2b3a970498c" |
| 6 | + license "MIT" |
| 7 | + |
| 8 | + livecheck do |
| 9 | + url :stable |
| 10 | + regex(/^v?(\d+(?:\.\d+)+)$/i) |
| 11 | + end |
| 12 | + |
| 13 | + bottle do |
| 14 | + sha256 cellar: :any_skip_relocation, arm64_sequoia: "b39c736b95ed324b0cdf0053829afbda0796b858b70b43d1f1a1233b00c0960e" |
| 15 | + sha256 cellar: :any_skip_relocation, arm64_sonoma: "b39c736b95ed324b0cdf0053829afbda0796b858b70b43d1f1a1233b00c0960e" |
| 16 | + sha256 cellar: :any_skip_relocation, arm64_ventura: "b39c736b95ed324b0cdf0053829afbda0796b858b70b43d1f1a1233b00c0960e" |
| 17 | + sha256 cellar: :any_skip_relocation, sonoma: "b2c989d974d85f2bf369c684e86e31e83e83d86a2a0f70dea8593c9a5df605b8" |
| 18 | + sha256 cellar: :any_skip_relocation, ventura: "b2c989d974d85f2bf369c684e86e31e83e83d86a2a0f70dea8593c9a5df605b8" |
| 19 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "0a017abc286d60d26ad804e35f22da4aeba2c0c01ae3fb4bf6e11d5f7459417b" |
| 20 | + end |
| 21 | + |
| 22 | + depends_on "go" => :build |
| 23 | + uses_from_macos "sqlite" => :test |
| 24 | + |
| 25 | + def install |
| 26 | + system "go", "build", *std_go_args(ldflags: "-s -w -X main.version=#{version}") |
| 27 | + end |
| 28 | + |
| 29 | + test do |
| 30 | + path = testpath/"school.sql" |
| 31 | + path.write <<~SQL |
| 32 | + create table students (name text, age integer); |
| 33 | + insert into students (name, age) values ('Bob', 14); |
| 34 | + insert into students (name, age) values ('Sue', 12); |
| 35 | + insert into students (name, age) values ('Tim', 13); |
| 36 | + select name from students order by age asc; |
| 37 | + SQL |
| 38 | + |
| 39 | + names = shell_output("sqlite3 test.db < #{path}").strip.split("\n") |
| 40 | + assert_equal %w[Sue Tim Bob], names |
| 41 | + |
| 42 | + assert_match "terminal not cursor addressable", shell_output("#{bin}/lazysql test.db 2>&1", 1) |
| 43 | + |
| 44 | + assert_match version.to_s, shell_output("#{bin}/lazysql -version 2>&1") |
| 45 | + end |
| 46 | +end |
0 commit comments