homebrew-core/Formula/cherrytree.rb

70 lines
2.8 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.36.tar.xz"
sha256 "8a768862835c1dd20600d4cb4aa5f8b9f23b0b1cf91d1daf7018a0c7faba570d"
license "GPL-3.0-or-later"
livecheck do
url :homepage
regex(/href=.*?cherrytree[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_big_sur: "b9b07dc6c1a0c665d3cbe12e2d383396b97eca27c84697c0079ab065a315d902"
sha256 big_sur: "4da17ac3cac80fdb8573c30362cc9fb02237e538a2c1c447bef0bb4e811480c6"
sha256 catalina: "16aa9ea42d4cb67be144bb54635720ba437a6dd6c3b6e07a0c3ce60079e2e314"
sha256 mojave: "5560d09e66f2dca4b70474f6b2631105a6e2fab124fbff674d3d33a9975fe52b"
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