class Etsh < Formula desc "Two ports of /bin/sh from V6 UNIX (circa 1975)" homepage "https://v6shell.org/" url "https://v6shell.org/src/etsh-4.6.0.tar.gz" sha256 "2884a862a89c4ecaf66ff2bab8d0a3156f3e32477290e117d03ac94981d92659" version_scheme 1 head "https://github.com/JNeitzel/v6shell.git", :branch => "current" bottle do sha256 "960a2eef8ab3991a6a5291c79692a03c100c29a9af591a5ca90f0f20cb0dabc3" => :sierra sha256 "c995654d271f7063d033ea96218605f43dcf1bedf3fc2523e25dfaeffa5e7bf2" => :el_capitan sha256 "56c0ddbcc7e5ebc1e7709231623d02fb49b960e6a361082cfca2d10bc2bbb4bf" => :yosemite end option "with-examples", "Build with shell examples" conflicts_with "teleport", :because => "both install `tsh` binaries" resource "examples" do url "https://v6shell.org/v6scripts/v6scripts-20160128.tar.gz" sha256 "c23251137de67b042067b68f71cd85c3993c566831952af305f1fde93edcaf4d" end def install system "./configure" system "make", "install", "PREFIX=#{prefix}", "SYSCONFDIR=#{etc}", "MANDIR=#{man1}" bin.install_symlink "etsh" => "osh" bin.install_symlink "tsh" => "sh6" if build.with? "examples" resource("examples").stage do ENV.prepend_path "PATH", bin system "./INSTALL", libexec end end end test do assert_match "brew!", shell_output("#{bin}/etsh -c 'echo brew!'").strip if build.with? "examples" ENV.prepend_path "PATH", libexec assert_match "1 3 5 7 9 11 13 15 17 19", shell_output("#{libexec}/counts").strip end end end