13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/qed/helpers/file_fixtures.rb', line 13
def copy_fixture(name, tmpdir=nil)
tmpdir ||= 'tmp' FileUtils.mkdir(tmpdir) unless File.directory?(tmpdir)
srcdir = File.join(demo_directory, 'fixtures', name)
paths = Dir.glob(File.join(srcdir, '**', '*'), File::FNM_DOTMATCH)
paths.each do |path|
basename = File.basename(path)
next if basename == '.'
next if basename == '..'
dest = File.join(tmpdir, path.sub(srcdir+'/', ''))
if File.directory?(path)
FileUtils.mkdir(dest)
else
text = ERB.new(File.read(path)).result
File.open(dest, 'w'){ |f| f << text }
end
end
end
|