homebrew-core/Formula/hapi-fhir-cli.rb

42 lines
1.6 KiB
Ruby

class HapiFhirCli < Formula
desc "Command-line interface for the HAPI FHIR library"
homepage "https://hapifhir.io/"
url "https://github.com/hapifhir/hapi-fhir/releases/download/v6.2.3/hapi-fhir-6.2.3-cli.zip"
sha256 "5190df6ed181710b79820c601763a72ac98d4295b5502e973b9c6d25a23e5c26"
license "Apache-2.0"
# The "latest" release on GitHub is sometimes for an older major/minor, so we
# can't rely on it being the newest version. The formula's `stable` URL is a
# release archive, so it's also not appropriate to check the Git tags here.
# Instead we have to check tags of releases (omitting pre-release versions).
livecheck do
url "https://github.com/hapifhir/hapi-fhir/releases?q=prerelease%3Afalse"
regex(%r{href=["']?[^"' >]*?/tag/v?(\d+(?:\.\d+)+)["' >]}i)
strategy :page_match
end
bottle do
sha256 cellar: :any_skip_relocation, all: "e421b6e241b47f11bb15fd3548fc451aef3524266f3bc3446b5a2c573cb4ff47"
end
depends_on "openjdk"
resource "homebrew-test_resource" do
url "https://github.com/hapifhir/hapi-fhir/raw/v5.4.0/hapi-fhir-structures-dstu3/src/test/resources/specimen-example.json"
sha256 "4eacf47eccec800ffd2ca23b704c70d71bc840aeb755912ffb8596562a0a0f5e"
end
def install
inreplace "hapi-fhir-cli", /SCRIPTDIR=(.*)/, "SCRIPTDIR=#{libexec}"
libexec.install "hapi-fhir-cli.jar"
bin.install "hapi-fhir-cli"
bin.env_script_all_files libexec/"bin", JAVA_HOME: Formula["openjdk"].opt_prefix
end
test do
testpath.install resource("homebrew-test_resource")
system bin/"hapi-fhir-cli", "validate", "--file", "specimen-example.json",
"--fhir-version", "dstu3"
end
end