16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/template_resolver.rb', line 16
def copy_files(from, to, render=false)
created_files = Array.new
if(!File.exists? from)
raise ProjectError.new('TemplateResolver attempted to copy files from (' + from + ') but it does not exist...')
end
if(File.directory? from)
Dir.open(from).each do |filename|
if(!AsProject.ignore_file? filename)
fullname = File.join(from, filename)
new_fullname = File.join(to, filename)
cleaned_filename = clean_file_name(filename)
cleaned_fullname = File.join(to, cleaned_filename)
if(File.directory? fullname)
Dir.mkdir(new_fullname) unless File.exists? new_fullname
copy_files(fullname, new_fullname, render).each do |file|
created_files << file
end
else
file = copy_file(fullname, cleaned_fullname, render)
if(file)
created_files << file
end
end
end
end
else
raise ProjectError.new("copy_files called with a file (" + from + ") instead of a directory!")
end
return created_files
end
|