class Msitools < Formula desc "Windows installer (.MSI) tool" homepage "https://wiki.gnome.org/msitools" url "https://download.gnome.org/sources/msitools/0.97/msitools-0.97.tar.xz" sha256 "3a5b286c9ae3a7b7126a4a95506d12f34ac91e1a564c99e67d9644fee88fc65e" revision 1 bottle do sha256 "23ad30b2f5ba7ceac3273dc0148c1855ab3806aae3fb241965eb820d9f8c1bc2" => :high_sierra sha256 "a7f930473258e61dfe22e29511bee9a0cc02fdf06bc5bca5bab11779f45d471c" => :sierra sha256 "ce056dd47194966eeddda0bbdc02ca3c8c12feab23b97a46a1044fa323fdbaa6" => :el_capitan 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 EOS system "#{bin}/wixl", "-o", "installer#{i}.msi", "installer#{i}.wxs" assert_predicate testpath/"installer#{i}.msi", :exist? end # msidiff: diff two installers lines = `#{bin}/msidiff --list installer1.msi installer2.msi 2>/dev/null`.split("\n") assert_equal 0, $CHILD_STATUS.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, $CHILD_STATUS.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_predicate testpath/"idt/File.idt", :exist? # msibuild: replace a table in an installer system "#{bin}/msibuild", "installer1.msi", "-i", "idt/File.idt" end end