class Mg3a < Formula desc "Small Emacs-like editor inspired by mg with UTF8 support" homepage "http://www.bengtl.net/files/mg3a/" url "http://www.bengtl.net/files/mg3a/mg3a.161117.tar.gz" sha256 "075aae68f75c6f477c17556cf6d70218747d5465d33ea8c5de79e105d06a5a86" bottle do cellar :any_skip_relocation sha256 "e5457a711a7a5168c2ceae43cda1df7ba01b7556d78a599ce8ca5ff40908cafc" => :sierra sha256 "7d18d1976876e2b596e236e61e11cf7ff133bddfd795489ec0c607092f1f1678" => :el_capitan sha256 "6485b13fb71033a4140f680bd5953768995747de75ade322edd32ebef0ebb7f0" => :yosemite end option "with-c-mode", "Include the original C mode" option "with-clike-mode", "Include the C mode that also handles Perl and Java" option "with-python-mode", "Include the Python mode" option "with-most", "Include c-like and python modes, user modes and user macros" option "with-all", "Include all fancy stuff" conflicts_with "mg", :because => "both install `mg`" def install if build.with?("all") mg3aopts = %w[-DALL] else mg3aopts = %w[-DDIRED -DPREFIXREGION -DUSER_MODES -DUSER_MACROS] mg3aopts << "-DLANGMODE_C" if build.with?("c-mode") mg3aopts << "-DLANGMODE_PYTHON" if build.with?("python-mode") || build.with?("most") mg3aopts << "-DLANGMODE_CLIKE" if build.with?("clike-mode") || build.with?("most") end system "make", "CDEFS=#{mg3aopts * " "}", "LIBS=-lncurses", "COPT=-O3" bin.install "mg" doc.install Dir["bl/dot.*"] doc.install Dir["README*"] end test do (testpath/"command.sh").write <<-EOS.undent #!/usr/bin/expect -f set timeout -1 spawn #{bin}/mg match_max 100000 send -- "\u0018\u0003" expect eof EOS (testpath/"command.sh").chmod 0755 system testpath/"command.sh" end end