Method: OMF::Web::FileContentRepository#write

Defined in:
lib/omf-web/content/file_repository.rb

#write(content_descr, content, message) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/omf-web/content/file_repository.rb', line 47

def write(content_descr, content, message)
  path = _get_path(content_descr)
  Dir.chdir(@top_dir) do
    unless File.writable?(path)
      raise "Cannot write to file '#{path}'"
    end
    f = File.open(path, 'w')
    f.write(content)
    f.close
  end
end