homebrew-core/Formula/cherrytree.rb

71 lines
2.9 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.45.tar.xz"
sha256 "87649f594b8e6e8fb9426d437b1cd651240e073624ffbe0e5268b686759af2a5"
license "GPL-3.0-or-later"
livecheck do
url :homepage
regex(/href=.*?cherrytree[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_monterey: "bfb5a3b14a4a62259d25ae17a6842d30531936d0c73632a9bfbeb5bc39ed5d2c"
sha256 arm64_big_sur: "1e1b056e3fdec0d7cba717f263dcaef1118972a16cd0b4b9fcf92875b1d66513"
sha256 monterey: "d7fcc3ded3f25ac9fafa9208c653e319404fce604ce0b94f54a801288f41226f"
sha256 big_sur: "8e84898987639bf2e21edf7c8580964663cfd3d52d1a787e36f5dc952cc2932a"
sha256 catalina: "210e40271e3cd19ca54cb3917214d13df911c73885d93c514429d92f607da418"
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"
def install
system "cmake", ".", "-DBUILD_TESTING=''", "-GNinja", *std_cmake_args
system "ninja"
system "ninja", "install"
end
test do
(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