homebrew-core/Formula/grc.rb

40 lines
1.2 KiB
Ruby

class Grc < Formula
include Language::Python::Shebang
desc "Colorize logfiles and command output"
homepage "https://korpus.juls.savba.sk/~garabik/software/grc.html"
url "https://github.com/garabik/grc/archive/v1.12.tar.gz"
sha256 "4ca20134775ca15b2e26b4a464786aacd8c114cc793557b53959592b279b8d3c"
license "GPL-2.0-or-later"
head "https://github.com/garabik/grc.git", branch: "devel"
bottle :unneeded
depends_on "python@3.9"
conflicts_with "cc65", because: "both install `grc` binaries"
def install
# fix non-standard prefix installs
inreplace ["grc", "grc.1"], "/etc", etc
inreplace ["grcat", "grcat.1"], "/usr/local", HOMEBREW_PREFIX
# so that the completions don't end up in etc/profile.d
inreplace "install.sh",
"mkdir -p $PROFILEDIR\ncp -fv grc.sh $PROFILEDIR", ""
rewrite_shebang detected_python_shebang, "grc", "grcat"
system "./install.sh", prefix, HOMEBREW_PREFIX
etc.install "grc.sh"
etc.install "grc.zsh"
etc.install "grc.fish"
zsh_completion.install "_grc"
end
test do
actual = pipe_output("#{bin}/grcat #{pkgshare}/conf.ls", "hello root")
assert_equal "\e[0mhello \e[0m\e[1m\e[37m\e[41mroot\e[0m", actual.chomp
end
end