homebrew-core/Formula/name-that-hash.rb

73 lines
3.4 KiB
Ruby

class NameThatHash < Formula
include Language::Python::Virtualenv
desc "Modern hash identification system"
homepage "https://nth.skerritt.blog/"
url "https://files.pythonhosted.org/packages/0c/6c/5a63e2d3450fd78679262769cf47a3820ed09f1eaa444b1d7a6367f480db/name-that-hash-1.1.6.tar.gz"
sha256 "a78136dded9aceb87da405b68570c6c000f6858a8c4e79490f48318a5b901c1d"
license "GPL-3.0-or-later"
head "https://github.com/HashPals/Name-That-Hash.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "1c7f04c88c14648f7233b7df512f0010e5f8c2e2384c944067255ad6ca8398ce"
sha256 cellar: :any_skip_relocation, big_sur: "f18b38a20cac8265d6c4c84decc7ec42c7ae3216b0aaa15031c4aa1e70c8af8b"
sha256 cellar: :any_skip_relocation, catalina: "8f15c980296559c3ab4f5c3895c8e90e6f1db4a3f21d054b3b49fc402866c5c7"
sha256 cellar: :any_skip_relocation, mojave: "8483ed8781861ab6fe0c363ed55c0b4b2be8d982299a2f53d3bed16053a5330a"
end
depends_on "python@3.9"
resource "click" do
url "https://files.pythonhosted.org/packages/27/6f/be940c8b1f1d69daceeb0032fee6c34d7bd70e3e649ccac0951500b4720e/click-7.1.2.tar.gz"
sha256 "d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"
end
resource "colorama" do
url "https://files.pythonhosted.org/packages/1f/bb/5d3246097ab77fa083a61bd8d3d527b7ae063c7d8e8671b1cf8c4ec10cbe/colorama-0.4.4.tar.gz"
sha256 "5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"
end
resource "commonmark" do
url "https://files.pythonhosted.org/packages/60/48/a60f593447e8f0894ebb7f6e6c1f25dafc5e89c5879fdc9360ae93ff83f0/commonmark-0.9.1.tar.gz"
sha256 "452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60"
end
resource "loguru" do
url "https://files.pythonhosted.org/packages/6d/25/0d65383fc7b4f4ce9505d16773b2b2a9f0f465ef00ab337d66afff47594a/loguru-0.5.3.tar.gz"
sha256 "b28e72ac7a98be3d28ad28570299a393dfcd32e5e3f6a353dec94675767b6319"
end
resource "Pygments" do
url "https://files.pythonhosted.org/packages/19/d0/dec5604a275b19b0ebd2b9c43730ce39549c8cd8602043eaf40c541a7256/Pygments-2.8.0.tar.gz"
sha256 "37a13ba168a02ac54cc5891a42b1caec333e59b66addb7fa633ea8a6d73445c0"
end
resource "rich" do
url "https://files.pythonhosted.org/packages/23/4d/85d622a12208a1fb09540554f812e867db983d4aa7fddf763cf26d9407f5/rich-9.12.2.tar.gz"
sha256 "493b4288273aa46475230733358696457e5df9215c898b164a324b7d9d694e88"
end
resource "typing-extensions" do
url "https://files.pythonhosted.org/packages/16/06/0f7367eafb692f73158e5c5cbca1aec798cdf78be5167f6415dd4205fa32/typing_extensions-3.7.4.3.tar.gz"
sha256 "99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"
end
def install
virtualenv_install_with_resources
xy = Language::Python.major_minor_version Formula["python@3.9"].opt_bin/"python3"
site_packages = "lib/python#{xy}/site-packages"
pth_contents = "import site; site.addsitedir('#{libexec/site_packages}')\n"
(prefix/site_packages/"homebrew-name_that_hash.pth").write pth_contents
end
test do
hash = "5f4dcc3b5aa765d61d8327deb882cf99"
output = shell_output("#{bin}/nth --text #{hash}")
assert_match "#{hash}\n", output
assert_match "MD5, HC: 0 JtR: raw-md5 Summary: Used for Linux Shadow files.\n", output
system Formula["python@3.9"].opt_bin/"python3", "-c", "from name_that_hash import runner"
end
end