From db459fe4dad0ea208a48c67e3291d75415454103 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 19 Aug 2012 19:33:32 -0500 Subject: coreutils: simplify mapping commands into gnubin Signed-off-by: Jack Nagel --- Library/Formula/coreutils.rb | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'Library/Formula') diff --git a/Library/Formula/coreutils.rb b/Library/Formula/coreutils.rb index 3ba748c33..9c6e8eb57 100644 --- a/Library/Formula/coreutils.rb +++ b/Library/Formula/coreutils.rb @@ -12,13 +12,9 @@ class Coreutils < Formula system "./configure", "--prefix=#{prefix}", "--program-prefix=g" system "make install" - # set installed binaries - commands = coreutils_bins - - # create a gnubin dir that has all the commands without program-prefix - (libexec+'gnubin').mkpath - commands.each do |cmd| - ln_sf "../../bin/g#{cmd}", libexec+"gnubin/#{cmd}" + # Symlink all commands into libexec/gnubin without the 'g' prefix + coreutils_bins.each do |cmd| + (libexec/'gnubin').install_symlink bin/"g#{cmd}" => cmd end end @@ -33,13 +29,11 @@ class Coreutils < Formula end def coreutils_bins - require 'find' - bin_path = prefix+'bin' - commands = Array.new - Find.find(bin_path) do |path| - next if path == bin_path or File.basename(path) == '.DS_Store' - commands << File.basename(path).sub(/^g/,'') + commands = [] + bin.find do |path| + next if path.directory? or path.basename.to_s == '.DS_Store' + commands << path.basename.to_s.sub(/^g/,'') end - return commands.sort + commands.sort end end -- cgit v1.2.3