dice icon indicating copy to clipboard operation
dice copied to clipboard

version-path-from-env

Open QuantumNeuralCoder opened this issue 1 year ago • 2 comments

What Changed? Checks path for VERSION file at env var DICEDB_VERSION_PATH first before defaulting to LOCAL. How will this help? Trying to create formula tap for homebrew. Everything works but the expectation is that the VERSION file resides in the directory where dicedb command is run from. With this change we can put it in the install dir and the caveat can include export like so

class Dicedb < Formula
  desc "DiceDB engine – fast, reactive, in-memory database"
  homepage "https://github.com/DiceDB/dice"
  url "https://github.com/DiceDB/dice/archive/refs/tags/v1.0.0.tar.gz"
  sha256 "1c613e44c8136d67dec73e92e084d38f39710d286fd1880998960891eb798a02"
  license "BSD-3-Clause"

  depends_on "[email protected]" => :build

  def install
    ENV["GOPROXY"] = "direct"
    ENV["GOSUMDB"] = "off"
    ENV.prepend_path "PATH", Formula["[email protected]"].opt_bin

    system "go", "build", "-o", bin/"dicedb", "./cmd/dicedb"

    # Install version file for runtime reference
    pkgshare.install "VERSION"
  end

  def caveats
    <<~EOS
      The DiceDB engine has been installed as 'dicedb'.

      To start the server:
        export DICEDB_VERSION_PATH=#{opt_pkgshare}/VERSION
        dicedb

      The server listens on port 7379 by default.
      For more info, visit: https://github.com/DiceDB/dice
    EOS
  end

  test do
    ENV["DICEDB_VERSION_PATH"] = "#{pkgshare}/VERSION"
    assert_match "DiceDB", shell_output("#{bin}/dicedb --help")
  end
end

QuantumNeuralCoder avatar Jun 02 '25 19:06 QuantumNeuralCoder

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Jun 02 '25 19:06 CLAassistant

Ref: https://github.com/QuantumNeuralCoder/homebrew-dicedb/tree/main closes https://github.com/DiceDB/dice/issues/1755

QuantumNeuralCoder avatar Jun 02 '25 20:06 QuantumNeuralCoder