From 9004bb3f471fabd76407573803c60383e629bace Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Mon, 31 Jan 2022 16:23:39 +0800 Subject: [PATCH] Update tiv.rb Bumped version, added `license`, `branch`, better `install`, and better `test`. --- tiv.rb | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/tiv.rb b/tiv.rb index 6d0b8f9..a75e7bf 100644 --- a/tiv.rb +++ b/tiv.rb @@ -1,32 +1,23 @@ class Tiv < Formula desc "Display images in a terminal using block graphic characters" homepage "https://github.com/stefanhaustein/TerminalImageViewer" - url "https://github.com/stefanhaustein/TerminalImageViewer/archive/v1.1.0.tar.gz" - sha256 "727ddaa048643cb0a13e23bc308415060d99d8b1853883ad339ad7b952050d61" - head "https://github.com/stefanhaustein/TerminalImageViewer.git" - uses_from_macos "curl" => :test + url "https://github.com/stefanhaustein/TerminalImageViewer/archive/refs/tags/v1.1.1.tar.gz" + sha256 "9a5f5c8688ef8db0e88dfcea6a1ae30da32268a7ab7972ff0de71955a75af0db" + license "Apache-2.0" + head "https://github.com/stefanhaustein/TerminalImageViewer.git", branch: "master" depends_on "imagemagick" + uses_from_macos "curl" => :test + def install cd "src/main/cpp" do - if OS.mac? - system "c++", "-std=c++17", "-Wall", "-fpermissive", "-fexceptions", "-O2", - "-c", "tiv.cpp", "-o", "tiv.o" - system "c++", "tiv.o", "-o", "tiv", "-L/usr/local/opt/gcc/lib/gcc/11/", "-pthread", - "-s" - else - system "make" - end + system "make" bin.install "tiv" end end test do - # Downloads a public domain test file from wikimedia commons and displays it. - # NOTE: Test will fail. Will fix when I get to my mac. - system "curl -o \"test.png\" https://upload.wikimedia.org/wikipedia/commons/2/24/Cornell_box.png" - assert_equal "▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ -", - shell_output("#{bin}/tiv -0 -w 400 -h 400 test.png").strip + assert_equal "\e[48;2;0;0;255m\e[38;2;0;0;255m  \e[0m", +shell_output("#{bin}/tiv #{test_fixtures("test.png")}").strip end end