class JsDuck::Img::Writer

Copies images to destination directory.

Public Class Methods

copy(images, output_dir) click to toggle source

Takes an array of image records retrieved from Img::Dir#all_used or Img::DirSet#all_used and copies all of them to given output directory.

# File lib/jsduck/img/writer.rb, line 12
def self.copy(images, output_dir)
  images.each do |img|
    dest = File.join(output_dir, img[:filename])
    Logger.log("Copying image", dest)
    FileUtils.makedirs(File.dirname(dest))
    FileUtils.cp(img[:full_path], dest)
  end
end