class Msitools < Formula desc "Windows installer (.MSI) tool" homepage "https://wiki.gnome.org/msitools" url "https://download.gnome.org/sources/msitools/0.96/msitools-0.96.tar.xz" sha256 "1b3e194a94747362a2d8d9b7c512c540ccb69e4dbd1dbc2d999a8a44d0b6729e" bottle do sha256 "2231e9c191d93b7696057471e279d78aae5caf47adf7d6d59995885e0fe3e7e5" => :sierra sha256 "4b8f1ad913f8f23d42f1e77a716bf3af7a3d134edb98f3f0209357751a2dcbf6" => :el_capitan sha256 "f64cfce287c9b2c4430524f51db8c69b53432e6fefbedf1dd893b0bd35d80dcf" => :yosemite end depends_on "intltool" => :build depends_on "pkg-config" => :build depends_on "e2fsprogs" depends_on "gcab" depends_on "gettext" depends_on "glib" depends_on "libgsf" depends_on "vala" def install system "./configure", "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=#{prefix}" system "make", "install" end test do # wixl-heat: make an xml fragment assert_match //, pipe_output("#{bin}/wixl-heat --prefix test") # wixl: build two installers 1.upto(2) do |i| (testpath/"test#{i}.txt").write "abc" (testpath/"installer#{i}.wxs").write <<-EOS.undent EOS system "#{bin}/wixl", "-o", "installer#{i}.msi", "installer#{i}.wxs" assert File.exist?("installer#{i}.msi") end # msidiff: diff two installers lines = `#{bin}/msidiff --list installer1.msi installer2.msi 2>/dev/null`.split("\n") assert_equal 0, $?.exitstatus assert_equal "-Program Files/test/test1.txt", lines[-2] assert_equal "+Program Files/test/test2.txt", lines[-1] # msiinfo: show info for an installer out = `#{bin}/msiinfo suminfo installer1.msi` assert_equal 0, $?.exitstatus assert_match /Author: BigCo/, out # msiextract: extract files from an installer mkdir "files" system "#{bin}/msiextract", "--directory", "files", "installer1.msi" assert_equal (testpath/"test1.txt").read, (testpath/"files/Program Files/test/test1.txt").read # msidump: dump tables from an installer mkdir "idt" system "#{bin}/msidump", "--directory", "idt", "installer1.msi" assert File.exist?("idt/File.idt") # msibuild: replace a table in an installer system "#{bin}/msibuild", "installer1.msi", "-i", "idt/File.idt" end end