From 068955e8cd698ac0286302fd244a4e4b42b47bab Mon Sep 17 00:00:00 2001 From: FX Coudert Date: Sat, 5 Jan 2019 11:24:06 +0100 Subject: [PATCH] gnu-sed: remove default-names option --- Formula/gnu-sed.rb | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/Formula/gnu-sed.rb b/Formula/gnu-sed.rb index 4d3f8f429e..dd00687cf6 100644 --- a/Formula/gnu-sed.rb +++ b/Formula/gnu-sed.rb @@ -12,48 +12,42 @@ class GnuSed < Formula sha256 "5c090deefc2dd3769191d97378b981b2dfdd64f1e0259de22682d434ad07e427" => :sierra end - option "with-default-names", "Do not prepend 'g' to the binary" - - deprecated_option "default-names" => "with-default-names" - conflicts_with "ssed", :because => "both install share/info/sed.info" def install - args = ["--prefix=#{prefix}", "--disable-dependency-tracking"] - args << "--program-prefix=g" if build.without? "default-names" + args = %W[ + --prefix=#{prefix} + --disable-dependency-tracking + --program-prefix=g + ] system "./configure", *args system "make", "install" - if build.without? "default-names" - (libexec/"gnubin").install_symlink bin/"gsed" =>"sed" - (libexec/"gnuman/man1").install_symlink man1/"gsed.1" => "sed.1" - end + (libexec/"gnubin").install_symlink bin/"gsed" =>"sed" + (libexec/"gnuman/man1").install_symlink man1/"gsed.1" => "sed.1" end - def caveats - if build.without? "default-names" then <<~EOS - The command has been installed with the prefix "g". - If you do not want the prefix, install using the "with-default-names" option. + def caveats; <<~EOS + GNU "sed" has been installed as "gsed". + If you need to use it as "sed", you can add a "gnubin" directory + to your PATH from your bashrc like: - If you need to use these commands with their normal names, you - can add a "gnubin" directory to your PATH from your bashrc like: PATH="#{opt_libexec}/gnubin:$PATH" - Additionally, you can access their man pages with normal names if you add - the "gnuman" directory to your MANPATH from your bashrc as well: + Additionally, you can access its man page with normal name if you add + the "gnuman" directory to your MANPATH from your bashrc as well: + MANPATH="#{opt_libexec}/gnuman:$MANPATH" - EOS - end + EOS end test do (testpath/"test.txt").write "Hello world!" - if build.with? "default-names" - system "#{bin}/sed", "-i", "s/world/World/g", "test.txt" - else - system "#{bin}/gsed", "-i", "s/world/World/g", "test.txt" - end + system "#{bin}/gsed", "-i", "s/world/World/g", "test.txt" + assert_match /Hello World!/, File.read("test.txt") + + system "#{opt_libexec}/gnubin/sed", "-i", "s/world/World/g", "test.txt" assert_match /Hello World!/, File.read("test.txt") end end