blob: d84e8b28a18b03a13ba56f3b6104e6dd917ed6a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
module InstallRenamed
def install_p(_, new_basename)
super do |src, dst|
if src.directory?
dst
else
append_default_if_different(src, dst)
end
end
end
def cp_path_sub(pattern, replacement)
super do |src, dst|
append_default_if_different(src, dst)
end
end
def +(path)
super(path).extend(InstallRenamed)
end
def /(path)
super(path).extend(InstallRenamed)
end
private
def append_default_if_different(src, dst)
if dst.file? && !FileUtils.identical?(src, dst)
Pathname.new("#{dst}.default")
else
dst
end
end
end
|