homebrew-core/Formula/vdirsyncer.rb

129 lines
5.4 KiB
Ruby

class Vdirsyncer < Formula
include Language::Python::Virtualenv
desc "Synchronize calendars and contacts"
homepage "https://github.com/pimutils/vdirsyncer"
url "https://files.pythonhosted.org/packages/fe/af/b04ca8d53dba17d9f042e9d94b56cf42b23ce8927d84591da1ddd3093cdc/vdirsyncer-0.18.0.tar.gz"
sha256 "27bc3ed51f774935fbba392915c8c8d4cf639ae51a44b674686b49a1025fc201"
license "BSD-3-Clause"
revision 1
head "https://github.com/pimutils/vdirsyncer.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "7bb630b6c7824cc451b615ecc0d66c639fc1aaecc1250067d1b9154c97bc12cf"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "abda18a7cf9b00692be141d7eb6800883b73469a819d15839bb4a304ef1e0c52"
sha256 cellar: :any_skip_relocation, monterey: "f4c292e6b0594126b3a685e9cd5b3074eda6074b90d9f61bd0adb44d007a1234"
sha256 cellar: :any_skip_relocation, big_sur: "26d65150cd7aa8a31db2103655a3bf4faeab09259c9ddade51f4d2feee6c5949"
sha256 cellar: :any_skip_relocation, catalina: "3fc977f2f7f24828432071bc073ea3ef965f8dbe74a9787e104d8ed4765769e7"
sha256 cellar: :any_skip_relocation, x86_64_linux: "73671af393d13d3d324e0f4eda162dfa471b420c9962fe7cfbbc4d406a73c8d3"
end
depends_on "python@3.10"
resource "atomicwrites" do
url "https://files.pythonhosted.org/packages/55/8d/74a75635f2c3c914ab5b3850112fd4b0c8039975ecb320e4449aa363ba54/atomicwrites-1.4.0.tar.gz"
sha256 "ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"
end
resource "certifi" do
url "https://files.pythonhosted.org/packages/cc/85/319a8a684e8ac6d87a1193090e06b6bbb302717496380e225ee10487c888/certifi-2022.6.15.tar.gz"
sha256 "84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d"
end
resource "charset-normalizer" do
url "https://files.pythonhosted.org/packages/56/31/7bcaf657fafb3c6db8c787a865434290b726653c912085fbd371e9b92e1c/charset-normalizer-2.0.12.tar.gz"
sha256 "2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"
end
resource "click" do
url "https://files.pythonhosted.org/packages/59/87/84326af34517fca8c58418d148f2403df25303e02736832403587318e9e8/click-8.1.3.tar.gz"
sha256 "7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"
end
resource "click-log" do
url "https://files.pythonhosted.org/packages/22/44/3d73579b547f0790a2723728088c96189c8b52bd2ee3c3de8040efc3c1b8/click-log-0.3.2.tar.gz"
sha256 "16fd1ca3fc6b16c98cea63acf1ab474ea8e676849dc669d86afafb0ed7003124"
end
resource "click-threading" do
url "https://files.pythonhosted.org/packages/df/ea/0b20b8e09a6ba1df6defc29479c462437a8e8a3b6f4203fcad8b0a5e3fa3/click-threading-0.5.0.tar.gz"
sha256 "adcfe623c02a595c107c314072f67a2278fe4eb40b72c0d1a2c903cc78af3439"
end
resource "idna" do
url "https://files.pythonhosted.org/packages/62/08/e3fc7c8161090f742f504f40b1bccbfc544d4a4e09eb774bf40aafce5436/idna-3.3.tar.gz"
sha256 "9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"
end
resource "oauthlib" do
url "https://files.pythonhosted.org/packages/6e/7e/a43cec8b2df28b6494a865324f0ac4be213cb2edcf1e2a717547a93279b0/oauthlib-3.2.0.tar.gz"
sha256 "23a8208d75b902797ea29fd31fa80a15ed9dc2c6c16fe73f5d346f83f6fa27a2"
end
resource "requests" do
url "https://files.pythonhosted.org/packages/e9/23/384d9953bb968731212dc37af87cb75a885dc48e0615bd6a303577c4dc4b/requests-2.28.0.tar.gz"
sha256 "d568723a7ebd25875d8d1eaf5dfa068cd2fc8194b2e483d7b1f7c81918dbec6b"
end
resource "requests-oauthlib" do
url "https://files.pythonhosted.org/packages/95/52/531ef197b426646f26b53815a7d2a67cb7a331ef098bb276db26a68ac49f/requests-oauthlib-1.3.1.tar.gz"
sha256 "75beac4a47881eeb94d5ea5d6ad31ef88856affe2332b9aafb52c6452ccf0d7a"
end
resource "requests-toolbelt" do
url "https://files.pythonhosted.org/packages/28/30/7bf7e5071081f761766d46820e52f4b16c8a08fef02d2eb4682ca7534310/requests-toolbelt-0.9.1.tar.gz"
sha256 "968089d4584ad4ad7c171454f0a5c6dac23971e9472521ea3b6d49d610aa6fc0"
end
resource "urllib3" do
url "https://files.pythonhosted.org/packages/1b/a5/4eab74853625505725cefdf168f48661b2cd04e7843ab836f3f63abf81da/urllib3-1.26.9.tar.gz"
sha256 "aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e"
end
def install
virtualenv_install_with_resources
end
service do
run [opt_bin/"vdirsyncer", "-v", "ERROR", "sync"]
run_type :interval
interval 60
log_path var/"log/vdirsyncer.log"
error_log_path var/"log/vdirsyncer.log"
working_dir HOMEBREW_PREFIX
end
test do
ENV["LC_ALL"] = "en_US.UTF-8"
(testpath/".config/vdirsyncer/config").write <<~EOS
[general]
status_path = "#{testpath}/.vdirsyncer/status/"
[pair contacts]
a = "contacts_a"
b = "contacts_b"
collections = ["from a"]
[storage contacts_a]
type = "filesystem"
path = "~/.contacts/a/"
fileext = ".vcf"
[storage contacts_b]
type = "filesystem"
path = "~/.contacts/b/"
fileext = ".vcf"
EOS
(testpath/".contacts/a/foo/092a1e3b55.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
(testpath/".contacts/b/foo/").mkpath
system "#{bin}/vdirsyncer", "discover"
system "#{bin}/vdirsyncer", "sync"
assert_match "Ö φ 風 ض", (testpath/".contacts/b/foo/092a1e3b55.vcf").read
end
end