homebrew-core/Formula/gitui.rb

48 lines
1.5 KiB
Ruby

class Gitui < Formula
desc "Blazing fast terminal-ui for git written in rust"
homepage "https://github.com/extrawurst/gitui"
url "https://github.com/extrawurst/gitui/archive/v0.7.0.tar.gz"
sha256 "3491730ddbbc886940f20e6cf419c689de3e196f678127807ef69c4de479742e"
bottle do
cellar :any_skip_relocation
sha256 "c7024c52191c49e1cbda891aa747faaed10a3d3f28810ce914d363d1d1203e90" => :catalina
sha256 "b85f069e2f076145bc19805069059d8ef7e07dd524a6835db02359837da895c3" => :mojave
sha256 "caac1ddfbc743230a3b1ad6610c6637077264f517ea68804d0d15cc8eec89ca0" => :high_sierra
end
depends_on "rust" => :build
uses_from_macos "libiconv"
def install
system "cargo", "install", *std_cargo_args
end
test do
system "git", "clone", "https://github.com/extrawurst/gitui.git"
(testpath/"gitui").cd { system "git", "checkout", "v0.7.0" }
input, _, wait_thr = Open3.popen2 "script -q screenlog.ansi"
input.puts "stty rows 80 cols 130"
input.puts "env LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 TERM=xterm #{bin}/gitui -d gitui"
sleep 1
# select log tab
input.puts "2"
sleep 1
# inspect commit (right arrow key)
input.puts "\e[C"
sleep 1
input.close
screenlog = (testpath/"screenlog.ansi").read
# remove ANSI colors
screenlog.gsub! /\e\[([;\d]+)?m/, ""
assert_match "Author: Stephan Dilly", screenlog
assert_match "Date: 2020-06-15", screenlog
assert_match "SHA: 9c2a31846c417d8775a346ceaf38e77b710d3aab", screenlog
ensure
Process.kill("TERM", wait_thr.pid)
end
end