55 lines
2.2 KiB
Ruby
55 lines
2.2 KiB
Ruby
class Broot < Formula
|
|
desc "New way to see and navigate directory trees"
|
|
homepage "https://dystroy.org/broot/"
|
|
url "https://github.com/Canop/broot/archive/v1.2.9.tar.gz"
|
|
sha256 "b682aa1a44ac48bca5677d2abbc0333a17c265a11d3809d8d6c07703d6217cac"
|
|
license "MIT"
|
|
head "https://github.com/Canop/broot.git"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "ac30924fb88afcd29c565499a8fe50fc01b1831f102ba649a50702358f065a08"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "621c6e2d19f890acde496cf21eff476fd2c879df2d08f5bbbf156bb7674bd527"
|
|
sha256 cellar: :any_skip_relocation, catalina: "8b0ac32fa1b2c6563c432c363037733f51d6f56763589c7ff9e06f53420398c2"
|
|
sha256 cellar: :any_skip_relocation, mojave: "f34b626d9f1d867c3de9dca8610a37aa9020bc088a95714d067472dbb9befbb8"
|
|
end
|
|
|
|
depends_on "rust" => :build
|
|
|
|
uses_from_macos "zlib"
|
|
|
|
def install
|
|
system "cargo", "install", *std_cargo_args
|
|
|
|
# Replace man page "#version" and "#date" based on logic in release.sh
|
|
inreplace "man/page" do |s|
|
|
s.gsub! "#version", version
|
|
s.gsub! "#date", Time.now.utc.strftime("%Y/%m/%d")
|
|
end
|
|
man1.install "man/page" => "broot.1"
|
|
|
|
# Completion scripts are generated in the crate's build directory,
|
|
# which includes a fingerprint hash. Try to locate it first
|
|
out_dir = Dir["target/release/build/broot-*/out"].first
|
|
bash_completion.install "#{out_dir}/broot.bash"
|
|
bash_completion.install "#{out_dir}/br.bash"
|
|
fish_completion.install "#{out_dir}/broot.fish"
|
|
fish_completion.install "#{out_dir}/br.fish"
|
|
zsh_completion.install "#{out_dir}/_broot"
|
|
zsh_completion.install "#{out_dir}/_br"
|
|
end
|
|
|
|
test do
|
|
assert_match "A tree explorer and a customizable launcher", shell_output("#{bin}/broot --help 2>&1")
|
|
|
|
require "pty"
|
|
require "io/console"
|
|
PTY.spawn(bin/"broot", "--cmd", ":pt", "--no-style", "--out", testpath/"output.txt", err: :out) do |r, w, pid|
|
|
r.winsize = [20, 80] # broot dependency termimad requires width > 2
|
|
w.write "n\r"
|
|
assert_match "New Configuration file written in", r.read
|
|
Process.wait(pid)
|
|
end
|
|
assert_equal 0, $CHILD_STATUS.exitstatus
|
|
end
|
|
end
|