homebrew-core/Formula/ledger.rb

59 lines
1.8 KiB
Ruby

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"
head "https://github.com/ledger/ledger.git"
bottle do
sha256 "66d5a0700f708ed2030db289e5fb9437185f3f0cebc03d24a5a18ba299c94063" => :catalina
sha256 "a39a1ce36e416f8d8b920173d598a2635a51e6a15d86da5eee8a02c55c88744b" => :mojave
sha256 "442b0e1736797ca9686168635e991ba36924759e889c3a01052b4e39ba1b7d51" => :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