class Ledger < Formula desc "Command-line, double-entry accounting tool" homepage "https://ledger-cli.org/" url "https://github.com/ledger/ledger/archive/v3.2.1.tar.gz" sha256 "92bf09bc385b171987f456fe3ee9fa998ed5e40b97b3acdd562b663aa364384a" license "BSD-3-Clause" revision 1 head "https://github.com/ledger/ledger.git" livecheck do url :head regex(/^v?(\d+(?:\.\d+)+)$/i) end bottle do sha256 "9389b112e1243aeeba892aa4159fade1d4cddaf6f9e9cd134f7ae4e5c48949b6" => :catalina sha256 "c6296f9a1093aea18b386efc82ed8c3a5c870560c1c32b189639644dd396f5ea" => :mojave sha256 "130e42b66db744081ad7e25e3f71dc70c2923e25e0476ef0e306514081ed1aca" => :high_sierra end depends_on "cmake" => :build depends_on "boost" depends_on "gmp" depends_on "mpfr" depends_on "python@3.8" uses_from_macos "groff" def install ENV.cxx11 ENV.prepend_path "PATH", Formula["python@3.8"].opt_libexec/"bin" args = %W[ --jobs=#{ENV.make_jobs} --output=build --prefix=#{prefix} --boost=#{Formula["boost"].opt_prefix} -- -DBUILD_DOCS=1 -DBUILD_WEB_DOCS=1 -DBoost_NO_BOOST_CMAKE=ON -DPython_FIND_VERSION_MAJOR=3 ] + std_cmake_args system "./acprep", "opt", "make", *args system "./acprep", "opt", "make", "doc", *args system "./acprep", "opt", "make", "install", *args (pkgshare/"examples").install Dir["test/input/*.dat"] pkgshare.install "contrib" elisp.install Dir["lisp/*.el", "lisp/*.elc"] bash_completion.install pkgshare/"contrib/ledger-completion.bash" end test do balance = testpath/"output" system bin/"ledger", "--args-only", "--file", "#{pkgshare}/examples/sample.dat", "--output", balance, "balance", "--collapse", "equity" assert_equal " $-2,500.00 Equity", balance.read.chomp assert_equal 0, $CHILD_STATUS.exitstatus end end