Add more efficient copying
This commit is contained in:
parent
a40aae70b2
commit
932819fd63
1 changed files with 14 additions and 5 deletions
|
@ -41,22 +41,31 @@ class Copy < Builder
|
||||||
sh "cp -fv *.gemspec #{dest}"
|
sh "cp -fv *.gemspec #{dest}"
|
||||||
sh "cp -Rfv lib/ #{dest}"
|
sh "cp -Rfv lib/ #{dest}"
|
||||||
else
|
else
|
||||||
sh "cp -Rfv #{_1}/* #{dest}"
|
sh [
|
||||||
|
"find #{_1}",
|
||||||
|
excludes.map { |n| "-not -name #{n}" }.join(" "),
|
||||||
|
"-mindepth 1 -maxdepth 1",
|
||||||
|
"-exec cp -Rfv {} #{dest} \\;"
|
||||||
|
].join(" ")
|
||||||
end
|
end
|
||||||
sh "find #{dest} -type d -exec chmod u=rwx,g=rx,o=rx {} +"
|
chmod!(dest)
|
||||||
sh "find #{dest} -type f -exec chmod u=rw,g=r,o=r {} +"
|
|
||||||
chmod_exes(dest)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def chmod_exes(dest)
|
def chmod!(dest)
|
||||||
|
sh "find #{dest} -type d -exec chmod u=rwx,g=rx,o=rx {} +"
|
||||||
|
sh "find #{dest} -type f -exec chmod u=rw,g=r,o=r {} +"
|
||||||
[File.join(dest, "libexec"), File.join(dest, "bin")].each do |exedir|
|
[File.join(dest, "libexec"), File.join(dest, "bin")].each do |exedir|
|
||||||
next unless File.exist?(exedir)
|
next unless File.exist?(exedir)
|
||||||
sh "find #{exedir} -type f -exec chmod u=rwx,g=rx,o=rx {} +"
|
sh "find #{exedir} -type f -exec chmod u=rwx,g=rx,o=rx {} +"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def excludes
|
||||||
|
%w[.gems node_modules]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Build < Builder
|
class Build < Builder
|
||||||
|
|
Loading…
Reference in a new issue