@@ -12,48 +12,42 @@ class GnuSed < Formula
1212 sha256 "5c090deefc2dd3769191d97378b981b2dfdd64f1e0259de22682d434ad07e427" => :sierra
1313 end
1414
15- option "with-default-names" , "Do not prepend 'g' to the binary"
16-
17- deprecated_option "default-names" => "with-default-names"
18-
1915 conflicts_with "ssed" , :because => "both install share/info/sed.info"
2016
2117 def install
22- args = [ "--prefix=#{ prefix } " , "--disable-dependency-tracking" ]
23- args << "--program-prefix=g" if build . without? "default-names"
18+ args = %W[
19+ --prefix=#{ prefix }
20+ --disable-dependency-tracking
21+ --program-prefix=g
22+ ]
2423
2524 system "./configure" , *args
2625 system "make" , "install"
2726
28- if build . without? "default-names"
29- ( libexec /"gnubin" ) . install_symlink bin /"gsed" => "sed"
30- ( libexec /"gnuman/man1" ) . install_symlink man1 /"gsed.1" => "sed.1"
31- end
27+ ( libexec /"gnubin" ) . install_symlink bin /"gsed" => "sed"
28+ ( libexec /"gnuman/man1" ) . install_symlink man1 /"gsed.1" => "sed.1"
3229 end
3330
34- def caveats
35- if build . without? "default-names" then <<~EOS
36- The command has been installed with the prefix "g".
37- If you do not want the prefix, install using the "with-default-names" option.
31+ def caveats ; <<~EOS
32+ GNU "sed" has been installed as "gsed".
33+ If you need to use it as "sed", you can add a "gnubin" directory
34+ to your PATH from your bashrc like:
3835
39- If you need to use these commands with their normal names, you
40- can add a "gnubin" directory to your PATH from your bashrc like:
4136 PATH="#{ opt_libexec } /gnubin:$PATH"
4237
43- Additionally, you can access their man pages with normal names if you add
44- the "gnuman" directory to your MANPATH from your bashrc as well:
38+ Additionally, you can access its man page with normal name if you add
39+ the "gnuman" directory to your MANPATH from your bashrc as well:
40+
4541 MANPATH="#{ opt_libexec } /gnuman:$MANPATH"
46- EOS
47- end
42+ EOS
4843 end
4944
5045 test do
5146 ( testpath /"test.txt" ) . write "Hello world!"
52- if build . with? "default-names"
53- system "#{ bin } /sed" , "-i" , "s/world/World/g" , "test.txt"
54- else
55- system "#{ bin } /gsed" , "-i" , "s/world/World/g" , "test.txt"
56- end
47+ system "#{ bin } /gsed" , "-i" , "s/world/World/g" , "test.txt"
48+ assert_match /Hello World!/ , File . read ( "test.txt" )
49+
50+ system "#{ opt_libexec } /gnubin/sed" , "-i" , "s/world/World/g" , "test.txt"
5751 assert_match /Hello World!/ , File . read ( "test.txt" )
5852 end
5953end
0 commit comments