209 lines
7.6 KiB
Ruby
209 lines
7.6 KiB
Ruby
class Jrnl < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "Command-line note taker"
|
|
homepage "https://jrnl.sh/"
|
|
url "https://files.pythonhosted.org/packages/b2/38/d8bec99bbc94d8bab97e9432bd4878f7c98826caa0d228604b6fcd2248d3/jrnl-2.5.tar.gz"
|
|
sha256 "3984d402feb18538fca6bbba3e0b9900b2f78af0a800fffa735ab9b08896ffda"
|
|
license "GPL-3.0-only"
|
|
|
|
livecheck do
|
|
url :stable
|
|
end
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "dfc5a4f36fd8b189c96378342160c1a5582ed735dc037be1bb3ceef9ef062f8c" => :big_sur
|
|
sha256 "96a6adf438d7e5b0f6da73a3ba45c1bd4d3b8b3bd9c6e89d1bc3c240bc221264" => :catalina
|
|
sha256 "b620db98f7e06d2e1321406fc3527ea66a214d3586bf76683586a7e73e353fe0" => :mojave
|
|
sha256 "bb6ac873a16d1944c6191425f379105ea58e8deb59adf66991b337a8169b2ba4" => :high_sierra
|
|
end
|
|
|
|
depends_on "python@3.9"
|
|
|
|
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 "asteval" do
|
|
url "https://files.pythonhosted.org/packages/4d/35/140edd280047b77aef487a8840c0f60372ab15210eb8064e5de9b832730c/asteval-0.9.19.tar.gz"
|
|
sha256 "445f3a59df692c0c0ff2868c0bbf9b293884db4a9f9a13c73555485ba75ed08b"
|
|
end
|
|
|
|
resource "cffi" do
|
|
url "https://files.pythonhosted.org/packages/cb/ae/380e33d621ae301770358eb11a896a34c34f30db188847a561e8e39ee866/cffi-1.14.3.tar.gz"
|
|
sha256 "f92f789e4f9241cd262ad7a555ca2c648a98178a953af117ef7fad46aa1d5591"
|
|
end
|
|
|
|
resource "colorama" do
|
|
url "https://files.pythonhosted.org/packages/1f/bb/5d3246097ab77fa083a61bd8d3d527b7ae063c7d8e8671b1cf8c4ec10cbe/colorama-0.4.4.tar.gz"
|
|
sha256 "5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"
|
|
end
|
|
|
|
resource "cryptography" do
|
|
url "https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz"
|
|
sha256 "d3d5e10be0cf2a12214ddee45c6bd203dab435e3d83b4560c03066eda600bfe3"
|
|
end
|
|
|
|
resource "keyring" do
|
|
url "https://files.pythonhosted.org/packages/c9/5a/c7aefc112d75872ea2099c494b84ba6e108b20584264929e614c60939368/keyring-21.5.0.tar.gz"
|
|
sha256 "207bd66f2a9881c835dad653da04e196c678bf104f8252141d2d3c4f31051579"
|
|
end
|
|
|
|
resource "packaging" do
|
|
url "https://files.pythonhosted.org/packages/55/fd/fc1aca9cf51ed2f2c11748fa797370027babd82f87829c7a8e6dbe720145/packaging-20.4.tar.gz"
|
|
sha256 "4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8"
|
|
end
|
|
|
|
resource "parsedatetime" do
|
|
url "https://files.pythonhosted.org/packages/a8/20/cb587f6672dbe585d101f590c3871d16e7aec5a576a1694997a3777312ac/parsedatetime-2.6.tar.gz"
|
|
sha256 "4cb368fbb18a0b7231f4d76119165451c8d2e35951455dfee97c62a87b04d455"
|
|
end
|
|
|
|
resource "passlib" do
|
|
url "https://files.pythonhosted.org/packages/b6/06/9da9ee59a67fae7761aab3ccc84fa4f3f33f125b370f1ccdb915bf967c11/passlib-1.7.4.tar.gz"
|
|
sha256 "defd50f72b65c5402ab2c573830a6978e5f202ad0d984793c8dde2c4152ebe04"
|
|
end
|
|
|
|
resource "pycparser" do
|
|
url "https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz"
|
|
sha256 "2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0"
|
|
end
|
|
|
|
resource "pyparsing" do
|
|
url "https://files.pythonhosted.org/packages/c1/47/dfc9c342c9842bbe0036c7f763d2d6686bcf5eb1808ba3e170afdb282210/pyparsing-2.4.7.tar.gz"
|
|
sha256 "c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"
|
|
end
|
|
|
|
resource "python-dateutil" do
|
|
url "https://files.pythonhosted.org/packages/be/ed/5bbc91f03fa4c839c4c7360375da77f9659af5f7086b7a7bdda65771c8e0/python-dateutil-2.8.1.tar.gz"
|
|
sha256 "73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c"
|
|
end
|
|
|
|
resource "pytz" do
|
|
url "https://files.pythonhosted.org/packages/09/07/448a8887c7195450604dfc0305d80d74324c36ee18ed997664051d4bffe3/pytz-2020.4.tar.gz"
|
|
sha256 "3e6b7dd2d1e0a59084bcee14a17af60c5c562cdc16d828e8eba2e683d3a7e268"
|
|
end
|
|
|
|
resource "pyxdg" do
|
|
url "https://files.pythonhosted.org/packages/47/6e/311d5f22e2b76381719b5d0c6e9dc39cd33999adae67db71d7279a6d70f4/pyxdg-0.26.tar.gz"
|
|
sha256 "fe2928d3f532ed32b39c32a482b54136fe766d19936afc96c8f00645f9da1a06"
|
|
end
|
|
|
|
resource "PyYAML" do
|
|
url "https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz"
|
|
sha256 "b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d"
|
|
end
|
|
|
|
resource "six" do
|
|
url "https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz"
|
|
sha256 "30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"
|
|
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/expect -f
|
|
|
|
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
|