homebrew-core/Formula/mu.rb

94 lines
3.3 KiB
Ruby

# NOTE: Odd release numbers indicate unstable releases.
# Please only submit PRs for [x.even.x] version numbers:
# https://github.com/djcb/mu/commit/23f4a64bdcdee3f9956a39b9a5a4fd0c5c2370ba
class Mu < Formula
desc "Tool for searching e-mail messages stored in the maildir-format"
homepage "https://www.djcbsoftware.nl/code/mu/"
url "https://github.com/djcb/mu/archive/1.4.15.tar.gz"
sha256 "e19900a68b6d26d2e01bf002b8ffaa97916239eca4d7104b7bc57db0add406b2"
license "GPL-3.0-or-later"
# We restrict matching to versions with an even-numbered minor version number,
# as an odd-numbered minor version number indicates a development version:
# https://github.com/djcb/mu/commit/23f4a64bdcdee3f9956a39b9a5a4fd0c5c2370ba
livecheck do
url :stable
regex(/^v?(\d+\.\d*[02468](?:\.\d+)*)$/i)
end
bottle do
sha256 cellar: :any, arm64_big_sur: "d7a73a634d7b10e4c1bad9879d5f2b17bdaf1261ed8bfcf231c8a45a4ac7bd3e"
sha256 cellar: :any, big_sur: "156897a7a8054b5d6621bfb8dead7bedf0479e8bf30e8bbd705f35e2bfbf6654"
sha256 cellar: :any, catalina: "2352f980cdc3e560e3901cf91f0163b8f9c4fad08b935646c38abc3cc076f6ba"
sha256 cellar: :any, mojave: "2543a69a0ea5f7c8aeca43e71f6c79bca8332fb2fa5d449c766a7f74462eb6e8"
end
head do
url "https://github.com/djcb/mu.git"
depends_on "autoconf-archive" => :build
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "emacs" => :build
depends_on "libgpg-error" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "gettext"
depends_on "glib"
depends_on "gmime"
depends_on "xapian"
uses_from_macos "texinfo" => :build
def install
system "autoreconf", "-ivf"
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--with-lispdir=#{elisp}"
system "make"
system "make", "install"
end
# Regression test for:
# https://github.com/djcb/mu/issues/397
# https://github.com/djcb/mu/issues/380
# https://github.com/djcb/mu/issues/332
test do
mkdir (testpath/"cur")
(testpath/"cur/1234567890.11111_1.host1!2,S").write <<~EOS
From: "Road Runner" <fasterthanyou@example.com>
To: "Wile E. Coyote" <wile@example.com>
Date: Mon, 4 Aug 2008 11:40:49 +0200
Message-id: <1111111111@example.com>
Beep beep!
EOS
(testpath/"cur/0987654321.22222_2.host2!2,S").write <<~EOS
From: "Wile E. Coyote" <wile@example.com>
To: "Road Runner" <fasterthanyou@example.com>
Date: Mon, 4 Aug 2008 12:40:49 +0200
Message-id: <2222222222@example.com>
References: <1111111111@example.com>
This used to happen outdoors. It was more fun then.
EOS
system "#{bin}/mu", "init", "--muhome=#{testpath}", "--maildir=#{testpath}"
system "#{bin}/mu", "index", "--muhome=#{testpath}"
mu_find = "#{bin}/mu find --muhome=#{testpath} "
find_message = "#{mu_find} msgid:2222222222@example.com"
find_message_and_related = "#{mu_find} --include-related msgid:2222222222@example.com"
assert_equal 1, shell_output(find_message).lines.count
assert_equal 2, shell_output(find_message_and_related).lines.count, <<~EOS
You tripped over https://github.com/djcb/mu/issues/380
--related doesn't work. Everything else should
EOS
end
end