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.
This commit is contained in:
Adam Vandenberg 2010-02-18 09:55:47 -08:00
parent 799dd7108e
commit 3927972a2a

View File

@ -5,6 +5,11 @@ class Pathname
def install src def install src
if src.is_a? Array if src.is_a? Array
src.collect {|src| install src } 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 else
# if it's a symlink, don't resolve it to a file because if we are moving # 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 # files one by one, it's likely we will break the symlink by moving what