homebrew-core/Formula/aqbanking.rb

78 lines
2.5 KiB
Ruby

class Aqbanking < Formula
desc "Generic online banking interface"
homepage "https://www.aquamaniac.de/sites/aqbanking/"
url "https://www.aquamaniac.de/rdm/attachments/download/342/aqbanking-6.2.5.tar.gz"
sha256 "cf5b060e3ec7e3fc925687caf044d4df3dbf9595f23c4fe8ffad78f44af0d6df"
license "GPL-2.0-or-later"
livecheck do
url "https://www.aquamaniac.de/rdm/projects/aqbanking/files"
regex(/href=.*?aqbanking[._-](\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 "e1236223ad900e4aea9b78e38bdcb0054a254a01207b68847e3ad17106db371e" => :big_sur
sha256 "630a89380604bf0f7e0f0a9e02a94bb3e9f6d440288e48977d15b62270073d6e" => :catalina
sha256 "6bedce92b40d4f2ce98fceca64afb4188e286bfd5387fda1233950e8cc2efd17" => :mojave
sha256 "086f77cd676c597f9963a1ccac53d960d4a9ef832431245928b5e81c3f59ad13" => :high_sierra
end
head do
url "https://git.aquamaniac.de/git/aqbanking.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
depends_on "gettext"
depends_on "gmp"
depends_on "gwenhywfar"
depends_on "ktoblzcheck"
depends_on "libxml2"
depends_on "libxmlsec1"
depends_on "libxslt"
depends_on "pkg-config" # aqbanking-config needs pkg-config for execution
def install
ENV.deparallelize
inreplace "aqbanking-config.in.in", "@PKG_CONFIG@", "pkg-config"
system "autoreconf", "-fiv" if build.head?
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--enable-cli"
system "make", "install"
end
test do
ENV["TZ"] = "UTC"
context = "balance.ctx"
(testpath/context).write <<~EOS
accountInfoList {
accountInfo {
char bankCode="110000000"
char accountNumber="000123456789"
char iban="US44110000000000123456789"
char bic="BYLADEM1001"
char currency="USD"
balanceList {
balance {
char date="20221212"
char value="-11096%2F100%3AUSD"
char type="booked"
} #balance
} #balanceList
} #accountInfo
} #accountInfoList
EOS
match = "110000000 000123456789 12.12.2022 -110.96 US44110000000000123456789 BYLADEM1001"
out = shell_output("#{bin}/aqbanking-cli -D .aqbanking listbal "\
"-T '$(bankcode) $(accountnumber) $(dateAsString) "\
"$(valueAsString) $(iban) $(bic)' < #{context}")
assert_match match, out.gsub(/\s+/, " ")
end
end