class Bunto::StaticFile

Public Instance Methods

copy_file(path, dest_path) click to toggle source
# File lib/bunto-press.rb, line 80
def copy_file(path, dest_path)
  FileUtils.mkdir_p(File.dirname(dest_path))
  FileUtils.cp(path, dest_path)
end
write(dest) click to toggle source
# File lib/bunto-press.rb, line 85
def write(dest)
  dest_path = destination(dest)

  return false if File.exist?(dest_path) and !modified?
  @@mtimes[path] = mtime

  case File.extname(dest_path)
    when '.js'
      if dest_path =~ /.min.js$/
        copy_file(path, dest_path)
      else
        output_js(dest_path, File.read(path))
      end
    when '.css'
      if dest_path =~ /.min.css$/
        copy_file(path, dest_path)
      else
        output_css(dest_path, File.read(path))
      end
    else
      copy_file(path, dest_path)
  end

  true
end