From fabb640b062bf4b78f67c2db90fe8253e4384ab3 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Thu, 18 Feb 2010 09:55:47 -0800 Subject: Allow Pathname.install to take a Hash. The keys of the hash are original file names, the values are new file names. Originals are renamed, and then installed under the new name. --- Library/Homebrew/extend/pathname.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Library') diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 1abb51f59..3e0837206 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -5,6 +5,11 @@ class Pathname def install src if src.is_a? Array src.collect {|src| install src } + elsif src.is_a? Hash + src.each_pair do |name, new_name| + FileUtils.mv name, new_name + install new_name + end else # if it's a symlink, don't resolve it to a file because if we are moving # files one by one, it's likely we will break the symlink by moving what -- cgit v1.2.3