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.5/hapi-fhir-6.2.5-cli.zip"
sha256 "a3e8fac3ac94a0204ecea58fc4f2ea931285201cc8463417139912a0bb520337"
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: "9b73176f41f5e2ed704c3108978842ed1e49f7bc2b1d3e94a0a1a5255b618c09"
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