class Cherrytree < Formula desc "Hierarchical note taking application featuring rich text and syntax highlighting" homepage "https://www.giuspen.com/cherrytree/" url "https://www.giuspen.com/software/cherrytree_0.99.48.tar.xz" sha256 "4bba4f19d23560e8aa59f2ab1e76f128f7f02adaebb5813e826e1753ee5d81fa" license "GPL-3.0-or-later" livecheck do url :homepage regex(/href=.*?cherrytree[._-]v?(\d+(?:\.\d+)+)\.t/i) end bottle do sha256 arm64_monterey: "e0574b7af797089b4a3a46a86a82c0b40bf44fbf6486e36cd84ccbf69651b617" sha256 arm64_big_sur: "df1e46f6ec1efb9ff63b1c08796c9b267d9d442b56de1bee387579e7f6ca1a7c" sha256 monterey: "cc658c25a8d8019a5df4ca2ec5e3e6cdf2981dff3f5045a2b09765c40c5ac9e2" sha256 big_sur: "0ccce6347da37ae691a9d2a9cc20557154963e92a0e7c3cae6e3eee46d6a980a" sha256 catalina: "d2703a787f0078f80f69a341be0cf253db847842a0703a97c9eeafd67d22cd73" sha256 x86_64_linux: "a434bd129bd597a36dee54f97284cb2ca1ef8b3ad99dbd47cf4054d3016ae560" end depends_on "cmake" => :build depends_on "ninja" => :build depends_on "pkg-config" => :build depends_on "python@3.10" => :build depends_on "adwaita-icon-theme" depends_on "fmt" depends_on "gspell" depends_on "gtksourceviewmm3" depends_on "libxml++" depends_on "spdlog" depends_on "uchardet" uses_from_macos "curl" on_linux do depends_on "gcc" end fails_with gcc: "5" # Needs std::optional def install system "cmake", ".", "-DBUILD_TESTING=''", "-GNinja", *std_cmake_args system "ninja" system "ninja", "install" end test do # (cherrytree:46081): Gtk-WARNING **: 17:33:48.386: cannot open display return if OS.linux? && ENV["HOMEBREW_GITHUB_ACTIONS"] (testpath/"homebrew.ctd").write <<~EOS this is a simple command line test for homebrew print('hello world') EOS system "#{bin}/cherrytree", testpath/"homebrew.ctd", "--export_to_txt_dir", testpath, "--export_single_file" assert_predicate testpath/"homebrew.ctd.txt", :exist? assert_match "rich text", (testpath/"homebrew.ctd.txt").read assert_match "this is a simple command line test for homebrew", (testpath/"homebrew.ctd.txt").read assert_match "code", (testpath/"homebrew.ctd.txt").read assert_match "print('hello world')", (testpath/"homebrew.ctd.txt").read end end