Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
New formula: vdirsyncer 0.6.0
Browse files Browse the repository at this point in the history
Synchronize calendars and contacts https://vdirsyncer.readthedocs.org/
  • Loading branch information
benjaminfrank committed Sep 6, 2015
1 parent 7d33150 commit bcfc073
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions Library/Formula/vdirsyncer.rb
@@ -0,0 +1,91 @@
class Vdirsyncer < Formula
desc "Synchronize calendars and contacts"
homepage "https://github.com/untitaker/vdirsyncer"
url "https://pypi.python.org/packages/source/v/vdirsyncer/vdirsyncer-0.6.0.tar.gz"
sha256 "0d2a9677b086cfbe5fe5e7cb5e55db4c1afab62cb5dc56aeaff6e95d34bf60d5"
head "https://github.com/untitaker/vdirsyncer.git"

option "without-keyring", "Build without python-keyring support"

depends_on :python3

resource "keyring" do
url "https://pypi.python.org/packages/source/k/keyring/keyring-5.4.tar.gz"
sha256 "45891cd0af4c4af70fbed7ec6e3964d0261c14188de9ab31030c9d02272e22d2"
end

resource "click" do
url "https://pypi.python.org/packages/source/c/click/click-5.1.tar.gz"
sha256 "678c98275431fad324275dec63791e4a17558b40e5a110e20a82866139a85a5a"
end

resource "requests" do
url "https://pypi.python.org/packages/source/r/requests/requests-2.7.0.tar.gz"
sha256 "398a3db6d61899d25fd4a06c6ca12051b0ce171d705decd7ed5511517b4bb93d"
end

resource "lxml" do
url "https://pypi.python.org/packages/source/l/lxml/lxml-3.4.4.tar.gz"
sha256 "b3d362bac471172747cda3513238f115cbd6c5f8b8e6319bf6a97a7892724099"
end

resource "requests-toolbelt" do
url "https://pypi.python.org/packages/source/r/requests-toolbelt/requests-toolbelt-0.4.0.tar.gz"
sha256 "15b74b90a63841b8430d6301e5062cd92929b1074b0c95bf62166b8239db1a96"
end

resource "atomicwrites" do
url "https://pypi.python.org/packages/source/a/atomicwrites/atomicwrites-0.1.5.tar.gz"
sha256 "9b16a8f1d366fb550f3d5a5ed4587022735f139a4187735466f34cf4577e4eaa"
end

def install
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python3.4/site-packages"
rs = %w[click requests lxml requests-toolbelt atomicwrites]
rs << "keyring" if build.with? "keyring"
rs.each do |r|
resource(r).stage do
system "python3", *Language::Python.setup_install_args(libexec/"vendor")
end
end

ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python3.4/site-packages"
system "python3", *Language::Python.setup_install_args(libexec)

bin.install Dir["#{libexec}/bin/*"]
bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"])
end

test do
ENV["LC_ALL"] = "en_US.UTF-8"
ENV["LANG"] = "en_US.UTF-8"
(testpath/".config/vdirsyncer/config").write <<-EOS.undent
[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.undent
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", "sync"
assert_match /BEGIN:VCARD/, (testpath/".contacts/b/foo/092a1e3b55.vcf").read
end
end

0 comments on commit bcfc073

Please sign in to comment.