class Khal < Formula include Language::Python::Virtualenv desc "CLI calendar application" homepage "https://lostpackets.de/khal/" url "https://github.com/pimutils/khal.git", :tag => "v0.9.8", :revision => "b03df58c129f99a35ba74cda0fbc253eb47cfeac" head "https://github.com/pimutils/khal.git" bottle do cellar :any_skip_relocation sha256 "5fa63ff4ec81dc9b5b72ad553636ce899584e7ac4ec265bddded0453e0de3069" => :high_sierra sha256 "0f70a0cf9e761fb25fa3e7b8ad45fe935f3e46b393d10daa345a4b1d27bef7a9" => :sierra sha256 "3006d316948618c8a0702b4fba2b568f43fca5fa51d3836c8d6b8e7966f858ff" => :el_capitan end depends_on :python3 def install venv = virtualenv_create(libexec, "python3") system libexec/"bin/pip", "install", "-v", "--no-binary", ":all:", "--ignore-installed", buildpath system libexec/"bin/pip", "uninstall", "-y", name venv.pip_install_and_link buildpath end test do ENV["LC_ALL"] = "en_US.UTF-8" ENV["LANG"] = "en_US.UTF-8" (testpath/".calendar/test/01ef8547.ics").write <<~EOS BEGIN:VCALENDAR VERSION:2.0 BEGIN:VEVENT DTSTART;VALUE=DATE:20130726 SUMMARY:testevent DTEND;VALUE=DATE:20130727 LAST-MODIFIED:20130725T142824Z DTSTAMP:20130725T142824Z CREATED:20130725T142824Z UID:01ef8547 END:VEVENT END:VCALENDAR EOS (testpath/".config/khal/config").write <<~EOS [calendars] [[test]] path = #{testpath}/.calendar/test/ color = light gray [sqlite] path = #{testpath}/.calendar/khal.db [locale] firstweekday = 0 [default] default_calendar = test EOS system "#{bin}/khal", "--no-color", "search", "testevent" end end