Method: Monad::StaticFile#write

Defined in:
lib/monad/static_file.rb

#write(dest) ⇒ Object

Write the static file to the destination directory (if modified).

dest - The String path to the destination dir.

Returns false if the file was not modified since last time (no-op).



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/monad/static_file.rb', line 50

def write(dest)
  dest_path = destination(dest)

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

  FileUtils.mkdir_p(File.dirname(dest_path))
  FileUtils.cp(path, dest_path)

  true
end