homebrew-core/Formula/transcrypt.rb

39 lines
1.3 KiB
Ruby

class Transcrypt < Formula
desc "Configure transparent encryption of files in a Git repo"
homepage "https://github.com/elasticdog/transcrypt"
url "https://github.com/elasticdog/transcrypt/archive/v2.2.0.tar.gz"
sha256 "6ea1dd8c3c7306e54f056728c7344ed31cf52403566e6c2268acc0f984d53391"
license "MIT"
head "https://github.com/elasticdog/transcrypt.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, all: "c2808cb2a2183c73a48c6588ad8678367dcfa4447eb88d12daeb591e0f37cf22"
end
on_linux do
depends_on "util-linux"
end
def install
bin.install "transcrypt"
man.install "man/transcrypt.1"
bash_completion.install "contrib/bash/transcrypt"
zsh_completion.install "contrib/zsh/_transcrypt"
end
test do
system "git", "init"
system bin/"transcrypt", "--password", "guest", "--yes"
(testpath/".gitattributes").atomic_write <<~EOS
sensitive_file filter=crypt diff=crypt merge=crypt
EOS
(testpath/"sensitive_file").write "secrets"
system "git", "add", ".gitattributes", "sensitive_file"
system "git", "commit", "--message", "Add encrypted version of file"
assert_equal `git show HEAD:sensitive_file --no-textconv`.chomp,
"U2FsdGVkX198ELlOY60n2ekOK1DiMCLS1dRs53RGBeU="
end
end