43 lines
1.5 KiB
Ruby
43 lines
1.5 KiB
Ruby
class Unrar < Formula
|
|
desc "Extract, view, and test RAR archives"
|
|
homepage "https://www.rarlab.com/"
|
|
url "https://www.rarlab.com/rar/unrarsrc-5.8.5.tar.gz"
|
|
sha256 "a725923a627bc8b3dd670a347b57701e1ad61f5f4e7b789d09244fb4b7f97b29"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "555a39a080ba65da9f8d4a5c02fc95eb810221f9e88dfb741261ce32622e7a00" => :catalina
|
|
sha256 "c2011afe36f228c13123bbe3c4a777439f353c5b183313160f0118b79d3af417" => :mojave
|
|
sha256 "cb838a0e04135acb5b7bd0e92f7a73371208c407c8abeaf0c42b60ae367b609d" => :high_sierra
|
|
end
|
|
|
|
def install
|
|
# upstream doesn't particularly care about their unix targets,
|
|
# so we do the dirty work of renaming their shared objects to
|
|
# dylibs for them.
|
|
inreplace "makefile", "libunrar.so", "libunrar.dylib"
|
|
|
|
system "make"
|
|
# Explicitly clean up for the library build to avoid an issue with an
|
|
# apparent implicit clean which confuses the dependencies.
|
|
system "make", "clean"
|
|
system "make", "lib"
|
|
|
|
bin.install "unrar"
|
|
lib.install "libunrar.dylib"
|
|
end
|
|
|
|
test do
|
|
contentpath = "directory/file.txt"
|
|
rarpath = testpath/"archive.rar"
|
|
data = "UmFyIRoHAM+QcwAADQAAAAAAAACaCHQggDIACQAAAAkAAAADtPej1LZwZE" \
|
|
"QUMBIApIEAAGRpcmVjdG9yeVxmaWxlLnR4dEhvbWVicmV3CsQ9ewBABwA="
|
|
|
|
rarpath.write data.unpack1("m")
|
|
assert_equal contentpath, `#{bin}/unrar lb #{rarpath}`.strip
|
|
assert_equal 0, $CHILD_STATUS.exitstatus
|
|
|
|
system "#{bin}/unrar", "x", rarpath, testpath
|
|
assert_equal "Homebrew\n", (testpath/contentpath).read
|
|
end
|
|
end
|