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.4/hapi-fhir-6.2.4-cli.zip"
sha256 "03f37563d1961a63190b84e0d70e62035ce2a3d542f1ca60b7eee7a851c0d36a"
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: "70f9768ccebd14d98ab10b357a130ecc4c1c8d3df88b91b8f2c417a8ad9d5388"
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