Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions Formula/h/hister.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
class Hister < Formula
desc "Your own search engine"
homepage "https://hister.org/"
url "https://github.com/asciimoo/hister/archive/refs/tags/v0.12.0.tar.gz"
sha256 "3b1b16854ee88ca461a1a943fb9b831e0bfc2cc8a5b8e08394140f0f7fb9c393"
license "AGPL-3.0-or-later"
head "https://github.com/asciimoo/hister.git", branch: "master"

depends_on "go" => :build
depends_on "node" => :build

def install
ENV["CGO_ENABLED"] = "1"
system "go", "generate", "./..."
system "go", "build", *std_go_args(ldflags: "-s -w")
end

Copy link
Copy Markdown
Contributor

@GunniBusch GunniBusch Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "tool" seams to be something that user run in the background, correct? So adding a service block https://docs.brew.sh/Formula-Cookbook#service-files might be usefull.

test do
assert_match version.to_s, shell_output("#{bin}/hister --version")

# Generate a default config; exercises the config package and embedded defaults.
config = testpath/"hister.yml"
system bin/"hister", "create-config", config
assert_match "app:", config.read

# Keep the data directory inside the test sandbox.
inreplace config, /^(\s*directory:).*$/, "\\1 #{testpath}"

# Spawn the server and confirm the embedded web UI responds.
port = free_port
pid = spawn bin/"hister", "--config", config, "listen", "--address", "127.0.0.1:#{port}"
begin
sleep 5
assert_match(/<html|<!doctype/i, shell_output("curl -fsS http://127.0.0.1:#{port}/"))
ensure
Process.kill("TERM", pid)
end
end
end
Loading