131 lines
4.5 KiB
Ruby
131 lines
4.5 KiB
Ruby
require "language/perl"
|
|
|
|
class Kpcli < Formula
|
|
include Language::Perl::Shebang
|
|
|
|
desc "Command-line interface to KeePass database files"
|
|
homepage "https://kpcli.sourceforge.io/"
|
|
url "https://downloads.sourceforge.net/project/kpcli/kpcli-3.6.pl"
|
|
sha256 "01f23882d458dfffc176fe5f268ced13c667de22b7fbf60d488eca87f3362deb"
|
|
license any_of: ["Artistic-1.0-Perl", "GPL-1.0-or-later"]
|
|
revision 1
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(%r{url=.*?/kpcli[._-]v?(\d+(?:\.\d+)+)\.pl}i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_big_sur: "ada893ae300554a13c7b56fce7bc91716d45294078a0f2006175a10e581eddc0"
|
|
sha256 cellar: :any, big_sur: "0918f51306694d5a21d117030f32ce49e08a4da4b47d0106d8542b826db03ce6"
|
|
sha256 cellar: :any, catalina: "8b88064bbd450ba7b3a7e902a85ac926d2d57b38b74b8a79f4cb72cc9a43aee9"
|
|
sha256 cellar: :any, mojave: "6cbffa6128e72f200e5216a6df39b07586048d165e69e45a8cb4821928b98a5d"
|
|
end
|
|
|
|
depends_on "readline"
|
|
|
|
uses_from_macos "perl"
|
|
|
|
resource "Module::Build" do
|
|
url "https://cpan.metacpan.org/authors/id/L/LE/LEONT/Module-Build-0.4231.tar.gz"
|
|
sha256 "7e0f4c692c1740c1ac84ea14d7ea3d8bc798b2fb26c09877229e04f430b2b717"
|
|
end
|
|
|
|
resource "File::KeePass" do
|
|
url "https://cpan.metacpan.org/authors/id/R/RH/RHANDOM/File-KeePass-2.03.tar.gz"
|
|
sha256 "c30c688027a52ff4f58cd69d6d8ef35472a7cf106d4ce94eb73a796ba7c7ffa7"
|
|
end
|
|
|
|
resource "Crypt::Rijndael" do
|
|
url "https://cpan.metacpan.org/authors/id/L/LE/LEONT/Crypt-Rijndael-1.15.tar.gz"
|
|
sha256 "a0989b55990d7905d1b5bf524cd8b46aadc0de778414d4ca8d406aa2aa594163"
|
|
end
|
|
|
|
resource "Sort::Naturally" do
|
|
url "https://cpan.metacpan.org/authors/id/B/BI/BINGOS/Sort-Naturally-1.03.tar.gz"
|
|
sha256 "eaab1c5c87575a7826089304ab1f8ffa7f18e6cd8b3937623e998e865ec1e746"
|
|
end
|
|
|
|
resource "Term::ShellUI" do
|
|
url "https://cpan.metacpan.org/authors/id/B/BR/BRONSON/Term-ShellUI-0.92.tar.gz"
|
|
sha256 "3279c01c76227335eeff09032a40f4b02b285151b3576c04cacd15be05942bdb"
|
|
end
|
|
|
|
resource "Term::Readline::Gnu" do
|
|
url "https://cpan.metacpan.org/authors/id/H/HA/HAYASHI/Term-ReadLine-Gnu-1.37.tar.gz"
|
|
sha256 "3bd31a998a9c14748ee553aed3e6b888ec47ff57c07fc5beafb04a38a72f0078"
|
|
end
|
|
|
|
resource "Data::Password" do
|
|
url "https://cpan.metacpan.org/authors/id/R/RA/RAZINF/Data-Password-1.12.tar.gz"
|
|
sha256 "830cde81741ff384385412e16faba55745a54a7cc019dd23d7ed4f05d551a961"
|
|
end
|
|
|
|
resource "Clipboard" do
|
|
url "https://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/Clipboard-0.26.tar.gz"
|
|
sha256 "886ae43dc8538f9bfc4e07fdbcf09b7fbd6ee59c31f364618c859de14953c58a"
|
|
end
|
|
|
|
resource "Mac::Pasteboard" do
|
|
url "https://cpan.metacpan.org/authors/id/W/WY/WYANT/Mac-Pasteboard-0.011.tar.gz"
|
|
sha256 "bd8c4510b1e805c43e4b55155c0beaf002b649fe30b6a7841ff05e7399ba02a9"
|
|
end
|
|
|
|
resource "Capture::Tiny" do
|
|
url "https://cpan.metacpan.org/authors/id/D/DA/DAGOLDEN/Capture-Tiny-0.48.tar.gz"
|
|
sha256 "6c23113e87bad393308c90a207013e505f659274736638d8c79bac9c67cc3e19"
|
|
end
|
|
|
|
def install
|
|
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
|
|
ENV.prepend_path "PERL5LIB", libexec/"lib"
|
|
|
|
resources = [
|
|
"Module::Build",
|
|
"File::KeePass",
|
|
"Crypt::Rijndael",
|
|
"Sort::Naturally",
|
|
"Term::ShellUI",
|
|
"Data::Password",
|
|
"Mac::Pasteboard",
|
|
"Capture::Tiny",
|
|
]
|
|
resources.each do |r|
|
|
resource(r).stage do
|
|
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
|
|
system "make", "install"
|
|
end
|
|
end
|
|
|
|
resource("Clipboard").stage do
|
|
system "perl", "Build.PL", "--install_base", libexec
|
|
system "./Build"
|
|
system "./Build", "install"
|
|
end
|
|
|
|
resource("Term::Readline::Gnu").stage do
|
|
# Prevent the Makefile to try and build universal binaries
|
|
ENV.refurbish_args
|
|
|
|
# Work around issue with Makefile.PL not detecting -ltermcap
|
|
# https://rt.cpan.org/Public/Bug/Display.html?id=133846
|
|
inreplace "Makefile.PL", "my $TERMCAP_LIB =", "my $TERMCAP_LIB = '-lncurses'; 0 &&"
|
|
|
|
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}",
|
|
"--includedir=#{Formula["readline"].opt_include}",
|
|
"--libdir=#{Formula["readline"].opt_lib}"
|
|
system "make", "install"
|
|
end
|
|
|
|
rewrite_shebang detected_perl_shebang, "kpcli-#{version}.pl"
|
|
|
|
libexec.install "kpcli-#{version}.pl" => "kpcli"
|
|
chmod 0755, libexec/"kpcli"
|
|
(bin/"kpcli").write_env_script("#{libexec}/kpcli", PERL5LIB: ENV["PERL5LIB"])
|
|
end
|
|
|
|
test do
|
|
system bin/"kpcli", "--help"
|
|
end
|
|
end
|