homebrew-core/Formula/cherrytree.rb

78 lines
3.3 KiB
Ruby

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.49.tar.xz"
sha256 "cb3f48903716c3dfca7b4638c57137642d99c76f1bfc2f5f9f5b442baff2cde1"
license "GPL-3.0-or-later"
livecheck do
url :homepage
regex(/href=.*?cherrytree[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_monterey: "d8f91c6fa407fd0a98a7c6b1400e048938d609fbc9f2c61a1d02d3bcc59df883"
sha256 arm64_big_sur: "21b5282822b1af6bb82efe055a956e1deed9b5f4f4dc52b93979550e00b414d8"
sha256 monterey: "3070463ee21957c6b1baaf07c1991833ab79ade71d0f6ecda403b74ee5836cc5"
sha256 big_sur: "e7a171cfb88f42e4f31bd5de68bef2776f32e097f86a8b84c5d18872633c45da"
sha256 catalina: "efd6609a798ca8603af61dbc6e8cb01f0ed30d1541b08d2bfbca57fe1698825c"
sha256 x86_64_linux: "30cbbca27d1cd305b414bef397418118d7b8f7fbbb2673f3f7eae93e99a838a4"
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 "sqlite" # try to change to uses_from_macos after python is not a dependency
depends_on "uchardet"
uses_from_macos "curl"
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
<?xml version="1.0" encoding="UTF-8"?>
<cherrytree>
<bookmarks list=""/>
<node name="rich text" unique_id="1" prog_lang="custom-colors" tags="" readonly="0" custom_icon_id="0" is_bold="0" foreground="" ts_creation="1611952177" ts_lastsave="1611952932">
<rich_text>this is a </rich_text>
<rich_text weight="heavy">simple</rich_text>
<rich_text> </rich_text>
<rich_text foreground="#ffff00000000">command line</rich_text>
<rich_text> </rich_text>
<rich_text style="italic">test</rich_text>
<rich_text> </rich_text>
<rich_text family="monospace">for</rich_text>
<rich_text> </rich_text>
<rich_text link="webs https://brew.sh/">homebrew</rich_text>
</node>
<node name="code" unique_id="2" prog_lang="python3" tags="" readonly="0" custom_icon_id="0" is_bold="0" foreground="" ts_creation="1611952391" ts_lastsave="1611952667">
<rich_text>print('hello world')</rich_text>
</node>
</cherrytree>
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