homebrew-core/Formula/cherrytree.rb

81 lines
3.4 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.53.tar.xz"
sha256 "317fbac7627b6556c7113433b360376d332bd10b6529b43734a8640cef5de24e"
license "GPL-3.0-or-later"
livecheck do
url :homepage
regex(/href=.*?cherrytree[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
rebuild 1
sha256 arm64_ventura: "567b6a5c4c81c525dc80413b5ab0ce4a75cc52ad9cb80b806b7e1d4a715ec4aa"
sha256 arm64_monterey: "8e1373575b73474c7db65732d7f7a96f9f2dba7f9f3d80d5dddf5a13c1bd71dc"
sha256 arm64_big_sur: "06e8e2039e1621b823b02f479feb8ee6e2931ac5ae57f69401784d95ceebb68d"
sha256 ventura: "aaf06de4dc0fb3ee8d9aff19a11ea449e5a800db3d5326c7df864a6c562a3e18"
sha256 monterey: "164fd8ad27d9b13c4ec1084558737ff42214b90ab6a51a83a270ac4a1d06949c"
sha256 big_sur: "eab7785650044af46d6238dcc640b8d0d8b0068a5fdfbef31836ec6624a430b8"
sha256 x86_64_linux: "40421450994bb4b381de26e51828cb19426fdea0e459f7d75c3160dc1f6d9f81"
end
depends_on "cmake" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "python@3.11" => :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"
depends_on "vte3"
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