From 4e9c4e3872bb0f4ff4b55af6ffc6e84fc2d9146b Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Fri, 17 Feb 2012 23:07:16 -0800 Subject: Update return values of install and install_symlink These now return an Array of all the target destinations. Previously, if a single argument was passed a single non- Array was returned. This behavior has been changed so that an Array is always returned even for a single argument. Updated the test. Hopefully this won't break any custom code out there. --- Library/Formula/getmail.rb | 2 +- Library/Homebrew/extend/pathname.rb | 16 ++++++++++------ Library/Homebrew/test/test_bucket.rb | 3 ++- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'Library') diff --git a/Library/Formula/getmail.rb b/Library/Formula/getmail.rb index ce46e758f..34bc9738e 100644 --- a/Library/Formula/getmail.rb +++ b/Library/Formula/getmail.rb @@ -9,7 +9,7 @@ class Getmail < Formula scripts = %w[ getmail getmail_fetch getmail_maildir getmail_mbox ] libexec.install 'getmailcore' libexec_scripts = libexec.install scripts - bin.install_symlink *libexec_scripts + bin.install_symlink libexec_scripts man1.install Dir['docs/*.1'] end end diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index d1b043097..0dbff65c6 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -3,16 +3,18 @@ require 'pathname' # we enhance pathname to make our code more readable class Pathname def install *sources + results = [] sources.each do |src| case src when Array - src.collect {|src| install_p(src) } + src.each {|s| results << install_p(s) } when Hash - src.collect {|src, new_basename| install_p(src, new_basename) } + src.each {|s, new_basename| results << install_p(s, new_basename) } else - install_p(src) + results << install_p(src) end end + return results end def install_p src, new_basename = nil @@ -50,16 +52,18 @@ class Pathname # Creates symlinks to sources in this folder. def install_symlink *sources + results = [] sources.each do |src| case src when Array - src.collect {|src| install_symlink_p(src) } + src.each {|s| results << install_symlink_p(s) } when Hash - src.collect {|src, new_basename| install_symlink_p(src, new_basename) } + src.each {|s, new_basename| results << install_symlink_p(s, new_basename) } else - install_symlink_p(src) + results << install_symlink_p(src) end end + return results end def install_symlink_p src, new_basename = nil diff --git a/Library/Homebrew/test/test_bucket.rb b/Library/Homebrew/test/test_bucket.rb index fda9f356f..0c14f39c0 100644 --- a/Library/Homebrew/test/test_bucket.rb +++ b/Library/Homebrew/test/test_bucket.rb @@ -149,7 +149,8 @@ class BeerTasting < Test::Unit::TestCase abcd=orig_abcd=HOMEBREW_CACHE+'abcd' FileUtils.cp ABS__FILE__, abcd - abcd=HOMEBREW_PREFIX.install abcd + installed_paths=HOMEBREW_PREFIX.install abcd + abcd = installed_paths[0] assert (HOMEBREW_PREFIX+orig_abcd.basename).exist? assert abcd.exist? assert_equal HOMEBREW_PREFIX+'abcd', abcd -- cgit v1.2.3