grep: remove default-names option
This commit is contained in:
parent
dce96029d3
commit
43f2e19d93
1 changed files with 18 additions and 29 deletions
|
@ -12,9 +12,6 @@ class Grep < Formula
|
||||||
sha256 "ccae999dfa982fcafd94f710c62887ee402fb7e45b422242c7f2b6d9ba4c8f4c" => :sierra
|
sha256 "ccae999dfa982fcafd94f710c62887ee402fb7e45b422242c7f2b6d9ba4c8f4c" => :sierra
|
||||||
end
|
end
|
||||||
|
|
||||||
option "with-default-names", "Do not prepend 'g' to the binary"
|
|
||||||
deprecated_option "default-names" => "with-default-names"
|
|
||||||
|
|
||||||
depends_on "pkg-config" => :build
|
depends_on "pkg-config" => :build
|
||||||
depends_on "pcre"
|
depends_on "pcre"
|
||||||
|
|
||||||
|
@ -26,47 +23,39 @@ class Grep < Formula
|
||||||
--infodir=#{info}
|
--infodir=#{info}
|
||||||
--mandir=#{man}
|
--mandir=#{man}
|
||||||
--with-packager=Homebrew
|
--with-packager=Homebrew
|
||||||
|
--program-prefix=g
|
||||||
]
|
]
|
||||||
|
|
||||||
args << "--program-prefix=g" if build.without? "default-names"
|
|
||||||
|
|
||||||
system "./configure", *args
|
system "./configure", *args
|
||||||
system "make"
|
system "make"
|
||||||
system "make", "install"
|
system "make", "install"
|
||||||
|
|
||||||
if build.without? "default-names"
|
%w[grep egrep fgrep].each do |prog|
|
||||||
(libexec/"gnubin").install_symlink bin/"ggrep" => "grep"
|
(libexec/"gnubin").install_symlink bin/"g#{prog}" => prog
|
||||||
(libexec/"gnubin").install_symlink bin/"gegrep" => "egrep"
|
(libexec/"gnuman/man1").install_symlink man1/"g#{prog}.1" => "#{prog}.1"
|
||||||
(libexec/"gnubin").install_symlink bin/"gfgrep" => "fgrep"
|
|
||||||
|
|
||||||
(libexec/"gnuman/man1").install_symlink man1/"ggrep.1" => "grep.1"
|
|
||||||
(libexec/"gnuman/man1").install_symlink man1/"gegrep.1" => "egrep.1"
|
|
||||||
(libexec/"gnuman/man1").install_symlink man1/"gfgrep.1" => "fgrep.1"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def caveats
|
def caveats; <<~EOS
|
||||||
if build.without? "default-names" then <<~EOS
|
All commands have been installed with the prefix "g".
|
||||||
The command has been installed with the prefix "g".
|
If you need to use these commands with their normal names, you
|
||||||
If you do not want the prefix, install using the "with-default-names"
|
can add a "gnubin" directory to your PATH from your bashrc like:
|
||||||
option.
|
PATH="#{opt_libexec}/gnubin:$PATH"
|
||||||
|
|
||||||
If you need to use these commands with their normal names, you
|
Additionally, you can access their man pages with normal names if you add
|
||||||
can add a "gnubin" directory to your PATH from your bashrc like:
|
the "gnuman" directory to your MANPATH from your bashrc as well:
|
||||||
PATH="#{opt_libexec}/gnubin:$PATH"
|
MANPATH="#{opt_libexec}/gnuman:$MANPATH"
|
||||||
|
EOS
|
||||||
Additionally, you can access their man pages with normal names if you add
|
|
||||||
the "gnuman" directory to your MANPATH from your bashrc as well:
|
|
||||||
MANPATH="#{opt_libexec}/gnuman:$MANPATH"
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test do
|
test do
|
||||||
text_file = testpath/"file.txt"
|
text_file = testpath/"file.txt"
|
||||||
text_file.write "This line should be matched"
|
text_file.write "This line should be matched"
|
||||||
cmd = build.with?("default-names") ? "grep" : "ggrep"
|
|
||||||
grepped = shell_output("#{bin}/#{cmd} match #{text_file}")
|
grepped = shell_output("#{bin}/ggrep match #{text_file}")
|
||||||
|
assert_match "should be matched", grepped
|
||||||
|
|
||||||
|
grepped = shell_output("#{opt_libexec}/gnubin/grep match #{text_file}")
|
||||||
assert_match "should be matched", grepped
|
assert_match "should be matched", grepped
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue