homebrew-core/Formula/aqbanking.rb

76 lines
2.4 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/334/aqbanking-6.2.2.tar.gz"
sha256 "b14c2ec8069854226f8ced273c91948b8722b0e52e83c88b99df541fef2f40fd"
livecheck do
url "https://www.aquamaniac.de/rdm/projects/aqbanking/files"
regex(/href=.*?aqbanking[._-](\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 "957a2955f2cae1257863b5ec837f34d5ee2fb2be46db0c498159182e26e9358f" => :catalina
sha256 "20110cbda1de863ddc72ef8b5d6d5b0d5c3fb59f24280851383f61f063f30d41" => :mojave
sha256 "e348e6783b24c081c0357dd1c4f30fd74a4ee15303f5951b968cb9bea81b5b1d" => :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