class Baha::PreBuild::Module::Download
Constants
- LOG
Public Class Methods
execute(mod)
click to toggle source
# 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