# File install.rb, line 31 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)) next if f =~ /\.lnk/ 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
# File install.rb, line 109 def linkify d, linked = [] #--{{{ if test dd, d versioned = Dir[ File::join(d, "*-[0-9].[0-9].[0-9].rb") ] versioned.each do |v| src, dst = v, v.gsub(/\-[\d\.]+\.rb$/, '.rb') lnk = nil begin if test ll, dst lnk = "#{ dst }.lnk" puts "#{ dst } -> #{ lnk }" File::rename dst, lnk end unless test ee, dst puts "#{ src } -> #{ dst }" File::copy src, dst linked << dst end ensure if lnk at_exit do puts "#{ lnk } -> #{ dst }" File::rename lnk, dst end end end end end linked #--}}} end
# File install.rb, line 65 def shebangify f #{{{ open(f) do |fd| buf = fd.read 42 if buf =~ /^\s*#\s*!.*ruby/ ftmp = Tempfile::new("#{ $$ }_#{ File::basename(f) }") begin fd.rewind ftmp.puts "#!#{ $ruby }" while((buf = fd.read(8192))) ftmp.write buf end ftmp.close yield ftmp.path ensure ftmp.close! end else yield f end end #}}} end
Generated with the Darkfish Rdoc Generator 2.