homebrew-core/Formula/khard.rb
2018-03-01 21:38:57 -08:00

90 lines
3.5 KiB
Ruby

class Khard < Formula
include Language::Python::Virtualenv
desc "Console carddav client"
homepage "https://github.com/scheibler/khard/"
url "https://files.pythonhosted.org/packages/19/91/6309d5b0477582b9b663cd65f1346cec6ed5f44e734bac722e1ca2ddc1e3/khard-0.12.2.tar.gz"
sha256 "9193d2d07cdb69cc6e35a0732111efb92bbfba854a1dd42b4f9c91a52a16c507"
revision 1
bottle do
cellar :any
sha256 "7631328fffaf8926e42eaf9f5ed8005a089f94d727ff39c2202c1ab3f674c8a2" => :high_sierra
sha256 "2fb891127ece61d960e8ebecb83e21558fbef38610731db6b26907832be4a601" => :sierra
sha256 "c1e15333ada257f03eb38c2fcb4bfeb1283b8d2a5f557bd0e0c16f23b93818c5" => :el_capitan
end
depends_on "python"
resource "atomicwrites" do
url "https://files.pythonhosted.org/packages/a1/e1/2d9bc76838e6e6667fde5814aa25d7feb93d6fa471bf6816daac2596e8b2/atomicwrites-1.1.5.tar.gz"
sha256 "240831ea22da9ab882b551b31d4225591e5e447a68c5e188db5b89ca1d487585"
end
resource "configobj" do
url "https://files.pythonhosted.org/packages/64/61/079eb60459c44929e684fa7d9e2fdca403f67d64dd9dbac27296be2e0fab/configobj-5.0.6.tar.gz"
sha256 "a2f5650770e1c87fb335af19a9b7eb73fc05ccf22144eb68db7d00cd2bcb0902"
end
resource "python-dateutil" do
url "https://files.pythonhosted.org/packages/54/bb/f1db86504f7a49e1d9b9301531181b00a1c7325dc85a29160ee3eaa73a54/python-dateutil-2.6.1.tar.gz"
sha256 "891c38b2a02f5bb1be3e4793866c8df49c7d19baabf9c1bad62547e0b4866aca"
end
resource "PyYAML" do
url "https://files.pythonhosted.org/packages/4a/85/db5a2df477072b2902b0eb892feb37d88ac635d36245a72a6a69b23b383a/PyYAML-3.12.tar.gz"
sha256 "592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab"
end
resource "ruamel.yaml" do
url "https://files.pythonhosted.org/packages/8f/39/77c555d68d317457a10a30f4a92ae4a315a4ee0e05e9af7c0ac5c301df10/ruamel.yaml-0.15.35.tar.gz"
sha256 "8dc74821e4bb6b21fb1ab35964e159391d99ee44981d07d57bf96e2395f3ef75"
end
resource "six" do
url "https://files.pythonhosted.org/packages/16/d8/bc6316cf98419719bd59c91742194c111b6f2e85abac88e496adefaf7afe/six-1.11.0.tar.gz"
sha256 "70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9"
end
resource "Unidecode" do
url "https://files.pythonhosted.org/packages/9d/36/49d0ee152b6a1631f03a541532c6201942430060aa97fe011cf01a2cce64/Unidecode-1.0.22.tar.gz"
sha256 "8c33dd588e0c9bc22a76eaa0c715a5434851f726131bd44a6c26471746efabf5"
end
resource "vobject" do
url "https://files.pythonhosted.org/packages/8d/8b/2c6107d0132fd2309ee870eaee8501808e4e9d950e729a3dfcbd9dfd5b81/vobject-0.9.5.tar.gz"
sha256 "0f56cae196303d875682b9648b4bb43ffc769d2f0f800958e0a506af867b1243"
end
def install
virtualenv_create(libexec, "python3")
virtualenv_install_with_resources
(etc/"khard").install "misc/khard/khard.conf.example"
zsh_completion.install "misc/zsh/_khard"
pkgshare.install (buildpath/"misc").children - [buildpath/"misc/zsh"]
end
test do
(testpath/".config/khard/khard.conf").write <<~EOS
[addressbooks]
[[default]]
path = ~/.contacts/
[general]
editor = /usr/bin/vi
merge_editor = /usr/bin/vi
default_country = Germany
default_action = list
show_nicknames = yes
EOS
(testpath/".contacts/dummy.vcf").write <<~EOS
BEGIN:VCARD
VERSION:3.0
EMAIL;TYPE=work:username@example.org
FN:User Name
UID:092a1e3b55
N:Name;User
END:VCARD
EOS
assert_match /Address book: default/, shell_output("#{bin}/khard list user", 0)
end
end