Permalink
Cannot retrieve contributors at this time
202 lines (162 sloc)
7.74 KB
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Jrnl < Formula | |
include Language::Python::Virtualenv | |
desc "Command-line note taker" | |
homepage "http://jrnl.sh/en/stable/" | |
url "https://files.pythonhosted.org/packages/1a/06/26fa3eed503f58d492264b301104678c0345f398422c51c39ae0febe5916/jrnl-3.0.tar.gz" | |
sha256 "e676780351fd92a34855b802e6ca3d95041b8b6d4d4ed621b121e66908079e73" | |
license "GPL-3.0-only" | |
bottle do | |
sha256 cellar: :any, arm64_monterey: "ec47968852129c163e27034dd2deae61a7ac7a12d1f0f19f4ad8c0271ea73638" | |
sha256 cellar: :any, arm64_big_sur: "ec80b6ce3788e5a2d3b8f4cbd4451cdc2e084529b6199d1280eca71979200fd7" | |
sha256 cellar: :any, monterey: "cbe6585f73385b8b0c9a185755aa9f148acd1df96a0143d496ceba1141b52b3c" | |
sha256 cellar: :any, big_sur: "f30449add5329c4c68be2b9d504f3df2d217bef5e72a030fe51dc5b2899f673a" | |
sha256 cellar: :any, catalina: "bab3d943472c21af981ddb80adfbcedd5ee3a63711acef3c2ff736ac12998599" | |
sha256 cellar: :any_skip_relocation, x86_64_linux: "35a9b27e9997b5b295b7e6c1b4abb6b5d3ab7c2520d29a43c091369cbecbac22" | |
end | |
depends_on "rust" => :build | |
depends_on "python@3.10" | |
depends_on "six" | |
uses_from_macos "expect" => :test | |
on_linux do | |
depends_on "pkg-config" => :build | |
end | |
resource "ansiwrap" do | |
url "https://files.pythonhosted.org/packages/7c/45/2616341cfcace37d4619d5106a85fcc24f2170d1a161bc5f7fdb81772fbc/ansiwrap-0.8.4.zip" | |
sha256 "ca0c740734cde59bf919f8ff2c386f74f9a369818cdc60efe94893d01ea8d9b7" | |
end | |
resource "cffi" do | |
url "https://files.pythonhosted.org/packages/2b/a8/050ab4f0c3d4c1b8aaa805f70e26e84d0e27004907c5b8ecc1d31815f92a/cffi-1.15.1.tar.gz" | |
sha256 "d400bfb9a37b1351253cb402671cea7e89bdecc294e8016a707f6d1d8ac934f9" | |
end | |
resource "colorama" do | |
url "https://files.pythonhosted.org/packages/2b/65/24d033a9325ce42ccbfa3ca2d0866c7e89cc68e5b9d92ecaba9feef631df/colorama-0.4.5.tar.gz" | |
sha256 "e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4" | |
end | |
resource "commonmark" do | |
url "https://files.pythonhosted.org/packages/60/48/a60f593447e8f0894ebb7f6e6c1f25dafc5e89c5879fdc9360ae93ff83f0/commonmark-0.9.1.tar.gz" | |
sha256 "452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60" | |
end | |
resource "cryptography" do | |
url "https://files.pythonhosted.org/packages/89/d9/5fcd312d5cce0b4d7ee8b551a0ea99e4ea9db0fdbf6dd455a19042e3370b/cryptography-37.0.4.tar.gz" | |
sha256 "63f9c17c0e2474ccbebc9302ce2f07b55b3b3fcb211ded18a42d5764f5c10a82" | |
end | |
resource "keyring" do | |
url "https://files.pythonhosted.org/packages/a4/9e/9d9eb6a6dc4f347bae8200a2e1dd65a7b96ae99e29ef8f7452ccc4ef9eea/keyring-23.6.0.tar.gz" | |
sha256 "3ac00c26e4c93739e19103091a9986a9f79665a78cf15a4df1dba7ea9ac8da2f" | |
end | |
resource "parsedatetime" do | |
url "https://files.pythonhosted.org/packages/a8/20/cb587f6672dbe585d101f590c3871d16e7aec5a576a1694997a3777312ac/parsedatetime-2.6.tar.gz" | |
sha256 "4cb368fbb18a0b7231f4d76119165451c8d2e35951455dfee97c62a87b04d455" | |
end | |
resource "pycparser" do | |
url "https://files.pythonhosted.org/packages/5e/0b/95d387f5f4433cb0f53ff7ad859bd2c6051051cebbb564f139a999ab46de/pycparser-2.21.tar.gz" | |
sha256 "e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206" | |
end | |
resource "Pygments" do | |
url "https://files.pythonhosted.org/packages/59/0f/eb10576eb73b5857bc22610cdfc59e424ced4004fe7132c8f2af2cc168d3/Pygments-2.12.0.tar.gz" | |
sha256 "5eb116118f9612ff1ee89ac96437bb6b49e8f04d8a13b514ba26f620208e26eb" | |
end | |
resource "python-dateutil" do | |
url "https://files.pythonhosted.org/packages/4c/c4/13b4776ea2d76c115c1d1b84579f3764ee6d57204f6be27119f13a61d0a9/python-dateutil-2.8.2.tar.gz" | |
sha256 "0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86" | |
end | |
resource "pytz" do | |
url "https://files.pythonhosted.org/packages/2f/5f/a0f653311adff905bbcaa6d3dfaf97edcf4d26138393c6ccd37a484851fb/pytz-2022.1.tar.gz" | |
sha256 "1e760e2fe6a8163bc0b3d9a19c4f84342afa0a2affebfaa84b01b978a02ecaa7" | |
end | |
resource "pyxdg" do | |
url "https://files.pythonhosted.org/packages/b0/25/7998cd2dec731acbd438fbf91bc619603fc5188de0a9a17699a781840452/pyxdg-0.28.tar.gz" | |
sha256 "3267bb3074e934df202af2ee0868575484108581e6f3cb006af1da35395e88b4" | |
end | |
resource "rich" do | |
url "https://files.pythonhosted.org/packages/f5/f3/f87be42279b5cfba09f7f29e2f4a77063ccf5d9075042981e2cf48752d51/rich-12.4.4.tar.gz" | |
sha256 "4c586de507202505346f3e32d1363eb9ed6932f0c2f63184dea88983ff4971e2" | |
end | |
resource "ruamel.yaml" do | |
url "https://files.pythonhosted.org/packages/46/a9/6ed24832095b692a8cecc323230ce2ec3480015fbfa4b79941bd41b23a3c/ruamel.yaml-0.17.21.tar.gz" | |
sha256 "8b7ce697a2f212752a35c1ac414471dc16c424c9573be4926b56ff3f5d23b7af" | |
end | |
resource "ruamel.yaml.clib" do | |
url "https://files.pythonhosted.org/packages/8b/25/08e5ad2431a028d0723ca5540b3af6a32f58f25e83c6dda4d0fcef7288a3/ruamel.yaml.clib-0.2.6.tar.gz" | |
sha256 "4ff604ce439abb20794f05613c374759ce10e3595d1867764dd1ae675b85acbd" | |
end | |
resource "textwrap3" do | |
url "https://files.pythonhosted.org/packages/4d/02/cef645d4558411b51700e3f56cefd88f05f05ec1b8fa39a3142963f5fcd2/textwrap3-0.9.2.zip" | |
sha256 "5008eeebdb236f6303dcd68f18b856d355f6197511d952ba74bc75e40e0c3414" | |
end | |
resource "tzlocal" do | |
url "https://files.pythonhosted.org/packages/ce/73/99e4cc30db6b21cba6c3b3b80cffc472cc5a0feaf79c290f01f1ac460710/tzlocal-2.1.tar.gz" | |
sha256 "643c97c5294aedc737780a49d9df30889321cbe1204eac2c2ec6134035a92e44" | |
end | |
resource "asn1crypto" do | |
on_linux do | |
url "https://files.pythonhosted.org/packages/9f/3d/8beae739ed8c1c8f00ceac0ab6b0e97299b42da869e24cf82851b27a9123/asn1crypto-1.3.0.tar.gz" | |
sha256 "5a215cb8dc12f892244e3a113fe05397ee23c5c4ca7a69cd6e69811755efc42d" | |
end | |
end | |
resource "jeepney" do | |
on_linux do | |
url "https://files.pythonhosted.org/packages/74/24/9b720cc6b2a73c908896a0ed64cb49780dcfbf4964e23a725aa6323f4452/jeepney-0.4.3.tar.gz" | |
sha256 "3479b861cc2b6407de5188695fa1a8d57e5072d7059322469b62628869b8e36e" | |
end | |
end | |
resource "secretstorage" do | |
on_linux do | |
url "https://files.pythonhosted.org/packages/fd/9f/36197c75d9a09b1ab63f56cb985af6cd858ca3fc41fd9cd890ce69bae5b9/SecretStorage-3.1.2.tar.gz" | |
sha256 "15da8a989b65498e29be338b3b279965f1b8f09b9668bd8010da183024c8bff6" | |
end | |
end | |
def install | |
virtualenv_install_with_resources | |
end | |
test do | |
(testpath/"tests.sh").write <<~EOS | |
#!/usr/bin/env expect | |
set timeout 3 | |
match_max 100000 | |
# Write the journal | |
spawn "#{bin}/jrnl" "This is the fanciest test in the world." | |
expect { | |
"/.local/share/jrnl/journal.txt" { send -- "#{testpath}/test.txt\r" } | |
timeout { exit 1 } | |
} | |
expect { | |
"You can always change this later" { send -- "n\r" } | |
timeout { exit 1 } | |
} | |
expect { | |
eof { exit } | |
timeout { exit 1 } | |
} | |
# Read the journal | |
spawn "#{bin}/jrnl" -1 | |
expect { | |
"This is the fanciest test in the world." { exit } | |
timeout { exit 1 } | |
eof { exit 1 } | |
} | |
# Encrypt the journal | |
spawn "#{bin}/jrnl" --encrypt | |
expect { | |
-exact "Enter password for new journal: " { send -- "homebrew\r" } | |
timeout { exit 1 } | |
} | |
expect { | |
-exact "Enter password again: " { send -- "homebrew\r" } | |
timeout { exit 1 } | |
} | |
expect { | |
-exact "Do you want to store the password in your keychain? \[Y/n\] " { send -- "n\r" } | |
timeout { exit 1 } | |
} | |
expect { | |
-re "Journal encrypted to .*/test.txt." { exit } | |
timeout { exit 1 } | |
eof { exit 1 } | |
} | |
EOS | |
system "expect", "./tests.sh" | |
assert_predicate testpath/".config/jrnl/jrnl.yaml", :exist? | |
assert_predicate testpath/"test.txt", :exist? | |
end | |
end |