class Yams < Formula desc "Yet Another Memory System - High-performance content-addressed storage" homepage "https://github.com/trvon/yams" version "__VERSION__" license "MIT" if Hardware::CPU.arm? url "https://github.com/trvon/yams/releases/download/v#{version}/yams-#{version}-macos-arm64.zip" sha256 "__SHA256_ARM64__" else url "https://github.com/trvon/yams/releases/download/v#{version}/yams-#{version}-macos-x86_64.zip" sha256 "__SHA256_X86_64__" end livecheck do url "https://github.com/trvon/yams/releases" regex(/^v?(\d+(?:\.\d+)+)$/i) end def install # Homebrew strips the 'usr' prefix from archives # So files are at local/bin, local/include, local/lib bin.install Dir["local/bin/*"] # Skip spdlog to avoid conflicts with homebrew's spdlog (buildpath/"local/include/spdlog").rmtree if (buildpath/"local/include/spdlog").exist? include.install Dir["local/include/*"] if Dir.exist?("local/include") lib.install Dir["local/lib/*"] if Dir.exist?("local/lib") end def caveats <<~EOS Initialize YAMS storage: yams init . Or specify custom location: export YAMS_STORAGE="$HOME/.local/share/yams" yams init Documentation: https://yamsmemory.ai Repository: https://github.com/trvon/yams EOS end test do assert_match version.to_s, shell_output("#{bin}/yams --version") system "#{bin}/yams", "init", "--non-interactive", "--storage", testpath/"yams-test" assert_predicate testpath/"yams-test/yams.db", :exist? assert_predicate testpath/".config/yams/config.toml", :exist? end end