4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/indocker/images/template_compiler.rb', line 4
def compile(path, context, image)
if !image.compile?(path)
Indocker.logger.debug("skipping ERB compilation for #{path}".grey)
return
end
Indocker.logger.debug("compiling template file #{path}".grey)
template = File.read(path)
content = ERB.new(template).result(context.helper.get_binding)
File.write(path, content)
rescue Errno::EACCES => e
rescue => e
Indocker.logger.error("compilation failed for template file #{path}. #{e.inspect}")
raise e
end
|