homebrew-core/Formula/mu.rb

94 lines
3.4 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/releases/download/v1.8.10/mu-1.8.10.tar.xz"
sha256 "a60b330e8a360255134b1fa1d9f672363ebf318d5cbe4b4b0bee1e9f94ae15c9"
license "GPL-3.0-or-later"
head "https://github.com/djcb/mu.git", branch: "master"
# 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 arm64_monterey: "3f2560981abd6a016c0a87ea0e2c22c8516c59cd48b1193d64b0faa07df0460d"
sha256 arm64_big_sur: "b13e3b82950a4b60b63d7a6328646f6d4183ff1e2cef5199a797b84a871afb3d"
sha256 monterey: "afdfec52961a37a6e1f047903f16e25b7eacff5d5ae442c2c1b4cce2ef9cffd4"
sha256 big_sur: "56c7955f0b306add81f45755a12bff3e0199b1c46549c2a70f348c6b45837c86"
sha256 catalina: "5f9a9fc7d6ebab692dcb2d7f1c5d8937f47c48cc0e44bebd7e2142d26fa3586d"
sha256 x86_64_linux: "e615b5e61c118528aabd1c265426d4b9b16f2e2aabf08cbae799e22cfddf72cf"
end
depends_on "emacs" => :build
depends_on "libgpg-error" => :build
depends_on "libtool" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "gettext"
depends_on "glib"
depends_on "gmime"
depends_on "xapian"
uses_from_macos "texinfo" => :build
conflicts_with "mu-repo", because: "both install `mu` binaries"
fails_with gcc: "5"
def install
mkdir "build" do
system "meson", *std_meson_args, "-Dlispdir=#{elisp}", ".."
system "ninja", "-v"
system "ninja", "install", "-v"
end
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