2013-10-06 22:04:46 +01:00
|
|
|
module InstallRenamed
|
2015-03-23 21:03:55 -04:00
|
|
|
def install_p(_, new_basename)
|
2013-10-06 22:04:46 +01:00
|
|
|
super do |src, dst|
|
2015-03-26 22:22:45 -04:00
|
|
|
if src.directory?
|
2016-03-07 15:11:00 +00:00
|
|
|
dst.install(src.children)
|
|
|
|
next
|
2015-03-26 22:22:45 -04:00
|
|
|
else
|
|
|
|
append_default_if_different(src, dst)
|
2014-08-25 10:28:40 +01:00
|
|
|
end
|
2013-10-06 22:04:46 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-03 13:09:07 +01:00
|
|
|
def cp_path_sub(pattern, replacement)
|
2013-10-05 20:29:02 +01:00
|
|
|
super do |src, dst|
|
|
|
|
append_default_if_different(src, dst)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-03 13:09:07 +01:00
|
|
|
def +(path)
|
2014-08-25 10:28:40 +01:00
|
|
|
super(path).extend(InstallRenamed)
|
|
|
|
end
|
|
|
|
|
2015-08-03 13:09:07 +01:00
|
|
|
def /(path)
|
2014-08-25 10:28:40 +01:00
|
|
|
super(path).extend(InstallRenamed)
|
|
|
|
end
|
|
|
|
|
2013-10-06 22:04:46 +01:00
|
|
|
private
|
|
|
|
|
2015-03-26 22:22:45 -04:00
|
|
|
def append_default_if_different(src, dst)
|
|
|
|
if dst.file? && !FileUtils.identical?(src, dst)
|
|
|
|
Pathname.new("#{dst}.default")
|
|
|
|
else
|
|
|
|
dst
|
2013-10-06 22:04:46 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|