def install_rb(srcdir=nil, destdir=nil, mode=nil, bin=nil)
path = []
dir = []
Find.find(srcdir) do |f|
next unless FileTest.file?(f)
next if (f = f[srcdir.length+1..-1]) == nil
next if (/CVS$/ =~ File.dirname(f))
path.push f
dir |= [File.dirname(f)]
end
for f in dir
next if f == "."
next if f == "CVS"
File::makedirs(File.join(destdir, f))
end
for f in path
next if (/\~$/ =~ f)
next if (/^\./ =~ File.basename(f))
unless bin
File::install(File.join(srcdir, f), File.join(destdir, f), mode, true)
else
from = File.join(srcdir, f)
to = File.join(destdir, f)
shebangify(from) do |sf|
$deferr.print from, " -> ", File::catname(from, to), "\n"
$deferr.printf "chmod %04o %s\n", mode, to
File::install(sf, to, mode, false)
end
end
end
end