8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/baha/pre_build/download.rb', line 8
def self.execute(mod)
LOG.debug("execute(#{mod.args.inspect})")
filename = mod.image.workspace + mod.args['file']
url = mod.args['download']
overwrite = mod.args['overwrite'] || false
if Pathname.new(filename).exist? and not overwrite
LOG.info("#{filename} already exists")
else
LOG.info("Download #{url} -> #{filename}")
File.open(filename, "w") do |saved_file|
open(url, "rb") do |read_file|
saved_file.write(read_file.read)
end
end
end
end
|