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.40.tar.xz"
sha256 "8460284d76d6a1fd555a13903abb10e0473757f6ce09a98c10220de9713bb3ed"
license "GPL-3.0-or-later"
revision 1
livecheck do
url :homepage
regex(/href=.*?cherrytree[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_big_sur: "95ce9f758b1521244d5f4fca69ef27de1b6e4f736d09c28fb3ff81c9d6841855"
sha256 big_sur: "ddb4be16eea7580b734cac8013c40c5695337154cbf51d007f65214e6a0e275e"
sha256 catalina: "2c62cef6a03f56f9807728c23c1e5f75a660f10bfa3896a533837720d10ebb56"
sha256 mojave: "8987e0a9c1ae537a6cd24d053aa720078d097bc1a90401474f2db8420d0c585d"
end
depends_on "cmake" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "python@3.9" => :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