homebrew-core/Formula/fits.rb

40 lines
1.3 KiB
Ruby

class Fits < Formula
desc "File Information Tool Set"
homepage "https://projects.iq.harvard.edu/fits"
url "https://github.com/harvard-lts/fits/releases/download/1.5.0/fits-1.5.0.zip"
sha256 "1378a78892db103b3a00e45c510b58c70e19a1a401b3720ff4d64a51438bfe0b"
license "Apache-2.0"
bottle :unneeded
depends_on "openjdk"
uses_from_macos "zlib"
def install
libexec.install "lib",
%w[tools xml],
Dir["*.properties"]
inreplace "fits-env.sh" do |s|
s.gsub!(/^FITS_HOME=.*/, "FITS_HOME=#{libexec}")
s.gsub! "${FITS_HOME}/lib", "#{libexec}/lib"
end
inreplace %w[fits.sh fits-ngserver.sh],
%r{\$\(dirname .*\)/fits-env\.sh}, "#{libexec}/fits-env.sh"
# fits-env.sh is a helper script that sets up environment
# variables, so we want to tuck this away in libexec
libexec.install "fits-env.sh"
(libexec/"bin").install %w[fits.sh fits-ngserver.sh]
(bin/"fits").write_env_script libexec/"bin/fits.sh", Language::Java.overridable_java_home_env
(bin/"fits-ngserver").write_env_script libexec/"bin/fits.sh", Language::Java.overridable_java_home_env
end
test do
cp test_fixtures("test.mp3"), testpath
assert_match 'mimetype="audio/mpeg"', shell_output("#{bin}/fits -i test.mp3")
end
end