Skip to content

Commit

Permalink
Add [email protected] formula, remove trailing space
Browse files Browse the repository at this point in the history
  • Loading branch information
rail committed Dec 2, 2024
1 parent 3aa4b52 commit aab8987
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 9 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ jobs:
fail-fast: false
matrix:
os:
- macos-latest # amd64
- macos-latest-xlarge # arm64
- macos-13 # amd64
- macos-latest# arm64
product:
- cockroach
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- cockroach-sql
- ccloud
name: ${{ matrix.product }} formula tests (${{ matrix.os }})
Expand Down
2 changes: 1 addition & 1 deletion Formula/cockroach-sql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CockroachSql < Formula
def install
bin.install "cockroach-sql"
prefix.install "LICENSE" if File.exist?("LICENSE")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "THIRD-PARTY-NOTICES.txt"
end

Expand Down
2 changes: 1 addition & 1 deletion Formula/cockroach.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Cockroach < Formula
def install
bin.install "cockroach"
prefix.install "LICENSE" if File.exist?("LICENSE")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "THIRD-PARTY-NOTICES.txt"
on_intel do
lib.mkpath
Expand Down
2 changes: 1 addition & 1 deletion Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CockroachAT231 < Formula
def install
bin.install "cockroach"
prefix.install "LICENSE" if File.exist?("LICENSE")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "THIRD-PARTY-NOTICES.txt"
on_intel do
lib.mkpath
Expand Down
2 changes: 1 addition & 1 deletion Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CockroachAT232 < Formula
def install
bin.install "cockroach"
prefix.install "LICENSE" if File.exist?("LICENSE")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "THIRD-PARTY-NOTICES.txt"
on_intel do
lib.mkpath
Expand Down
2 changes: 1 addition & 1 deletion Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CockroachAT241 < Formula
def install
bin.install "cockroach"
prefix.install "LICENSE" if File.exist?("LICENSE")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "THIRD-PARTY-NOTICES.txt"
on_intel do
lib.mkpath
Expand Down
135 changes: 135 additions & 0 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Auto-generated file, DO NOT EDIT
# Source: release/cockroach-tmpl.rb

class CockroachAT243 < Formula
desc "Distributed SQL database"
homepage "https://www.cockroachlabs.com"
version "24.3.0"
on_macos do
on_intel do
url "https://binaries.cockroachdb.com/cockroach-v24.3.0.darwin-10.9-amd64.tgz"
sha256 "93979ffaa09aaf84f4c9f1f5d55cf6cd06f83aa228a50aba4174e3ee1c680aab"
end
on_arm do
url "https://binaries.cockroachdb.com/cockroach-v24.3.0.darwin-11.0-arm64.tgz"
sha256 "d34882ce15289948d4794542fc2bb402ce373d812ca5d8ef4624220c4bec9c7d"
end
end

def install
bin.install "cockroach"
prefix.install "LICENSE" if File.exist?("LICENSE")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "THIRD-PARTY-NOTICES.txt"
on_intel do
lib.mkpath
mkdir "#{lib}/cockroach"
lib.install "lib/libgeos.dylib" => "cockroach/libgeos.dylib"
lib.install "lib/libgeos_c.dylib" => "cockroach/libgeos_c.dylib"

# Brew sets rpaths appropriately, but only if the rpaths are set
# to not include "@rpath". As such, use the #{lib} location for the
# rpaths.
system "install_name_tool", "-id",
"#{lib}/cockroach/libgeos.dylib", "#{lib}/cockroach/libgeos.dylib"
system "install_name_tool", "-id",
"#{lib}/cockroach/libgeos_c.1.dylib", "#{lib}/cockroach/libgeos_c.dylib"
if version < Version::new("23.2.0")
system "install_name_tool", "-change",
"@rpath/libgeos.3.8.1.dylib", "#{lib}/cockroach/libgeos.dylib",
"#{lib}/cockroach/libgeos_c.dylib"
else
system "install_name_tool", "-change",
"@rpath/libgeos.3.11.2.dylib", "#{lib}/cockroach/libgeos.dylib",
"#{lib}/cockroach/libgeos_c.dylib"
end
end

system "#{bin}/cockroach", "gen", "man", "--path=#{man1}"

bash_completion.mkpath
system "#{bin}/cockroach", "gen", "autocomplete", "bash", "--out=#{bash_completion}/cockroach"

zsh_completion.mkpath
system "#{bin}/cockroach", "gen", "autocomplete", "zsh", "--out=#{zsh_completion}/_cockroach"
end

def caveats; <<~EOS
For local development only, this formula ships a launchd configuration to
start a single-node cluster that stores its data under:
#{var}/cockroach/
Instead of the default port of 8080, the node serves its admin UI at:
#{Formatter.url("http://localhost:26256")}
Do NOT use this cluster to store data you care about; it runs in insecure
mode and may expose data publicly in e.g. a DNS rebinding attack. To run
CockroachDB securely, please see:
#{Formatter.url("https://www.cockroachlabs.com/docs/stable/secure-a-cluster.html")}
EOS
end

service do
args = [
"start-single-node",
"--store=#{var}/cockroach",
"--http-port=26256",
"--insecure",
"--host=localhost",
]
if !(OS.mac? && Hardware::CPU.arm?)
args << "--spatial-libs=#{opt_bin}/../lib/cockroach"
end
run [opt_bin/"cockroach"] + args
working_dir var
keep_alive true
log_path var/"log/cockroach.log"
error_log_path var/"log/cockroach.err"
end

test do
begin
# Redirect stdout and stderr to a file, or else `brew test --verbose`
# will hang forever as it waits for stdout and stderr to close.
pid = fork do
exec "#{bin}/cockroach start-single-node --insecure --background --listen-addr=127.0.0.1:0 --http-addr=127.0.0.1:0 --listening-url-file=listen_url_fifo &> start.out"
end
sleep 20

# TODO(bdarnell): remove the X from this variable and the --url flags after
# https://github.com/cockroachdb/cockroach/issues/40747 is fixed.
ENV["XCOCKROACH_URL"] = File.read("listen_url_fifo").strip
pipe_output("#{bin}/cockroach sql --url=$XCOCKROACH_URL", <<~EOS)
CREATE DATABASE bank;
CREATE TABLE bank.accounts (id INT PRIMARY KEY, balance DECIMAL);
INSERT INTO bank.accounts VALUES (1, 1000.50);
EOS
output = pipe_output("#{bin}/cockroach sql --url=$XCOCKROACH_URL --format=csv",
"SELECT * FROM bank.accounts;")
assert_equal <<~EOS, output
id,balance
1,1000.50
EOS
if !(OS.mac? && Hardware::CPU.arm?)
output = pipe_output("#{bin}/cockroach sql --url=$XCOCKROACH_URL --format=csv",
"SELECT ST_IsValid(ST_MakePoint(1, 1)) is_valid;")
assert_equal <<~EOS, output
is_valid
t
EOS
end
rescue => e
# If an error occurs, attempt to print out any messages from the
# server.
begin
$stderr.puts "server messages:", File.read("start.out")
rescue
$stderr.puts "unable to load messages from start.out"
end
raise e
ensure
Process.kill("SIGINT", pid)
Process.wait(pid)
end
end
end

2 changes: 1 addition & 1 deletion release/cockroach-sql-tmpl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CockroachSql < Formula
def install
bin.install "cockroach-sql"
prefix.install "LICENSE" if File.exist?("LICENSE")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "THIRD-PARTY-NOTICES.txt"
end

Expand Down
2 changes: 1 addition & 1 deletion release/cockroach-tmpl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Cockroach{{ .ClassSuffix }} < Formula
def install
bin.install "cockroach"
prefix.install "LICENSE" if File.exist?("LICENSE")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "LICENSE.txt" if File.exist?("LICENSE.txt")
prefix.install "THIRD-PARTY-NOTICES.txt"
on_intel do
lib.mkpath
Expand Down

0 comments on commit aab8987

Please sign in to comment.