Module: NoftPlus::Util

Defined in:
lib/noft_plus/util.rb

Class Method Summary collapse

Class Method Details

.download_file(url, target_filename) ⇒ Object

Download file to target unless it is already present Typically used to download font libraries from a remote location



21
22
23
24
25
26
# File 'lib/noft_plus/util.rb', line 21

def download_file(url, target_filename)
  unless File.exist?(target_filename)
    FileUtils.mkdir_p File.dirname(target_filename)
    File.write(target_filename, Net::HTTP.get(URI(url)))
  end
end