2016-03-15 16:22:00 +00:00
|
|
|
class Buku < Formula
|
2016-10-25 05:00:51 +00:00
|
|
|
include Language::Python::Virtualenv
|
|
|
|
|
2016-03-15 16:22:00 +00:00
|
|
|
desc "Command-line bookmark manager"
|
|
|
|
homepage "https://github.com/jarun/Buku"
|
2016-11-29 20:40:30 +00:00
|
|
|
url "https://github.com/jarun/Buku/archive/v2.7.tar.gz"
|
|
|
|
sha256 "9ebc95a665e56460d91b9d98711f1eba722b14a14a058e2ef330b117b79943fe"
|
2016-12-23 15:12:03 +00:00
|
|
|
revision 1
|
2016-03-15 16:22:00 +00:00
|
|
|
|
2016-03-16 04:09:17 +00:00
|
|
|
bottle do
|
2016-12-24 09:25:22 +00:00
|
|
|
sha256 "9b3511452cb07c82bc2a62d18689adec92fac87aa584d7b6b9cf75a19c81fb58" => :sierra
|
|
|
|
sha256 "26ec6a9fd5b9eef52a054e13330040f2817b0d87d3008774731f40b01fedef32" => :el_capitan
|
|
|
|
sha256 "3987c15d09d55c9be482cd3621e9f6181d108b7fb864d045b90440031d33a20b" => :yosemite
|
2016-03-16 04:09:17 +00:00
|
|
|
end
|
|
|
|
|
2016-03-15 16:22:00 +00:00
|
|
|
depends_on :python3
|
2016-11-08 04:20:27 +00:00
|
|
|
depends_on "openssl@1.1"
|
2016-10-25 05:00:51 +00:00
|
|
|
|
|
|
|
resource "beautifulsoup4" do
|
|
|
|
url "https://files.pythonhosted.org/packages/86/ea/8e9fbce5c8405b9614f1fd304f7109d9169a3516a493ce4f7f77c39435b7/beautifulsoup4-4.5.1.tar.gz"
|
|
|
|
sha256 "3c9474036afda9136aac6463def733f81017bf9ef3510d25634f335b0c87f5e1"
|
|
|
|
end
|
|
|
|
|
|
|
|
resource "cffi" do
|
2016-11-29 20:40:30 +00:00
|
|
|
url "https://files.pythonhosted.org/packages/a1/32/e3d6c3a8b5461b903651dd6ce958ed03c093d2e00128e3f33ea69f1d7965/cffi-1.9.1.tar.gz"
|
|
|
|
sha256 "563e0bd53fda03c151573217b3a49b3abad8813de9dd0632e10090f6190fdaf8"
|
2016-10-25 05:00:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "cryptography" do
|
2016-11-29 20:40:30 +00:00
|
|
|
url "https://files.pythonhosted.org/packages/d7/a2/b90736c37fd720db425c5e48d69da75a6eff6609b22d2123762f1ae8c5f5/cryptography-1.6.tar.gz"
|
|
|
|
sha256 "4d0d86d2c8d3fc89133c3fa0d164a688a458b6663ab6fa965c80d6c2cdaf9b3f"
|
2016-10-25 05:00:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
resource "idna" do
|
|
|
|
url "https://files.pythonhosted.org/packages/fb/84/8c27516fbaa8147acd2e431086b473c453c428e24e8fb99a1d89ce381851/idna-2.1.tar.gz"
|
|
|
|
sha256 "ed36f281aebf3cd0797f163bb165d84c31507cedd15928b095b1675e2d04c676"
|
|
|
|
end
|
|
|
|
|
|
|
|
resource "pyasn1" do
|
|
|
|
url "https://files.pythonhosted.org/packages/f7/83/377e3dd2e95f9020dbd0dfd3c47aaa7deebe3c68d3857a4e51917146ae8b/pyasn1-0.1.9.tar.gz"
|
|
|
|
sha256 "853cacd96d1f701ddd67aa03ecc05f51890135b7262e922710112f12a2ed2a7f"
|
|
|
|
end
|
|
|
|
|
|
|
|
resource "pycparser" do
|
2016-11-04 13:22:34 +00:00
|
|
|
url "https://files.pythonhosted.org/packages/be/64/1bb257ffb17d01f4a38d7ce686809a736837ad4371bcc5c42ba7a715c3ac/pycparser-2.17.tar.gz"
|
|
|
|
sha256 "0aac31e917c24cb3357f5a4d5566f2cc91a19ca41862f6c3c22dc60a629673b6"
|
2016-10-25 05:00:51 +00:00
|
|
|
end
|
|
|
|
|
2016-11-29 20:40:30 +00:00
|
|
|
resource "pyOpenSSL" do
|
|
|
|
url "https://files.pythonhosted.org/packages/0c/d6/b1fe519846a21614fa4f8233361574eddb223e0bc36b182140d916acfb3b/pyOpenSSL-16.2.0.tar.gz"
|
|
|
|
sha256 "7779a3bbb74e79db234af6a08775568c6769b5821faecf6e2f4143edb227516e"
|
|
|
|
end
|
|
|
|
|
|
|
|
resource "requests" do
|
|
|
|
url "https://files.pythonhosted.org/packages/6e/40/7434b2d9fe24107ada25ec90a1fc646e97f346130a2c51aa6a2b1aba28de/requests-2.12.1.tar.gz"
|
|
|
|
sha256 "2109ecea94df90980be040490ff1d879971b024861539abb00054062388b612e"
|
|
|
|
end
|
|
|
|
|
2016-10-25 05:00:51 +00:00
|
|
|
resource "six" do
|
|
|
|
url "https://files.pythonhosted.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz"
|
|
|
|
sha256 "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a"
|
|
|
|
end
|
2016-03-15 16:22:00 +00:00
|
|
|
|
2016-11-29 20:40:30 +00:00
|
|
|
resource "urllib3" do
|
|
|
|
url "https://files.pythonhosted.org/packages/b4/cb/0f195aa96fd63a4ef8b3578c67f56eb0804e394d9789080a8862c06c2f68/urllib3-1.19.1.tar.gz"
|
|
|
|
sha256 "53bc34c8ee268c3bd83ecf5e9c80fa783f3148484579bd4e20f4a7c1bb2dd6a0"
|
|
|
|
end
|
|
|
|
|
2016-03-15 16:22:00 +00:00
|
|
|
def install
|
2016-10-25 05:00:51 +00:00
|
|
|
venv = virtualenv_create(libexec, "python3")
|
|
|
|
venv.pip_install resources
|
|
|
|
|
|
|
|
# Replace shebang with virtualenv python
|
2016-11-29 20:40:30 +00:00
|
|
|
inreplace "buku.py", "#!/usr/bin/env python3", "#!#{libexec}/bin/python"
|
2016-10-25 05:00:51 +00:00
|
|
|
|
2016-11-29 20:40:30 +00:00
|
|
|
bin.install "buku.py" => "buku"
|
2016-10-25 05:00:51 +00:00
|
|
|
man1.install "buku.1"
|
2016-05-15 16:18:45 +00:00
|
|
|
bash_completion.install "auto-completion/bash/buku-completion.bash"
|
|
|
|
fish_completion.install "auto-completion/fish/buku.fish"
|
|
|
|
zsh_completion.install "auto-completion/zsh/_buku"
|
2016-03-15 16:22:00 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2016-04-22 17:19:16 +00:00
|
|
|
ENV["XDG_DATA_HOME"] = "#{testpath}/.local/share"
|
2016-10-25 05:00:51 +00:00
|
|
|
|
|
|
|
# Firefox exported bookmarks file
|
|
|
|
(testpath/"bookmarks.html").write <<-EOS.undent
|
|
|
|
<!DOCTYPE NETSCAPE-Bookmark-file-1>
|
|
|
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
|
|
|
|
<TITLE>Bookmarks</TITLE>
|
|
|
|
<H1>Bookmarks Menu</H1>
|
|
|
|
|
|
|
|
<DL><p>
|
|
|
|
<HR> <DT><H3 ADD_DATE="1464091987" LAST_MODIFIED="1477369518" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks Toolbar</H3>
|
|
|
|
<DD>Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar
|
|
|
|
<DL><p>
|
2016-11-29 20:40:30 +00:00
|
|
|
<DT><A HREF="https://github.com/Homebrew/brew" ADD_DATE="1477369518" LAST_MODIFIED="1477369529">Title unknown</A>
|
2016-10-25 05:00:51 +00:00
|
|
|
</DL><p>
|
|
|
|
</DL>
|
|
|
|
EOS
|
2016-11-29 20:40:30 +00:00
|
|
|
system bin/"buku", "--import", "bookmarks.html"
|
2016-10-25 05:00:51 +00:00
|
|
|
|
2016-11-29 20:40:30 +00:00
|
|
|
# Test online components -- fetch titles
|
|
|
|
system bin/"buku", "--update"
|
2016-10-25 05:00:51 +00:00
|
|
|
|
|
|
|
# Test crypto functionality
|
|
|
|
(testpath/"crypto-test").write <<-EOS.undent
|
|
|
|
# Lock bookmark database
|
2016-11-29 20:40:30 +00:00
|
|
|
spawn buku --lock
|
2016-10-25 05:00:51 +00:00
|
|
|
expect "Password: "
|
|
|
|
send "password\r"
|
|
|
|
expect "Password: "
|
|
|
|
send "password\r"
|
|
|
|
expect {
|
|
|
|
-re ".*ERROR.*" { exit 1 }
|
|
|
|
"File encrypted"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Unlock bookmark database
|
2016-11-29 20:40:30 +00:00
|
|
|
spawn buku --unlock
|
2016-10-25 05:00:51 +00:00
|
|
|
expect "Password: "
|
|
|
|
send "password\r"
|
|
|
|
expect {
|
|
|
|
-re ".*ERROR.*" { exit 1 }
|
|
|
|
"File decrypted"
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
system "/usr/bin/expect", "-f", "crypto-test"
|
|
|
|
|
2016-11-29 20:40:30 +00:00
|
|
|
# Test database content and search
|
|
|
|
result = shell_output("#{bin}/buku --noprompt --sany Homebrew")
|
|
|
|
assert_match "https://github.com/Homebrew/brew", result
|
|
|
|
assert_match "The missing package manager for macOS", result
|
2016-03-15 16:22:00 +00:00
|
|
|
end
|
|
|
|
end
|