Method: Licensed::DependencyRecord#save

Defined in:
lib/licensed/dependency_record.rb

#save(filename) ⇒ Object

Save the metadata and text to a file

filename - The destination file to save record contents at



81
82
83
84
85
86
87
88
89
# File 'lib/licensed/dependency_record.rb', line 81

def save(filename)
  data_to_save = @metadata.merge({
    "licenses" => licenses.map(&:to_cache),
    "notices" => notices
  })

  FileUtils.mkdir_p(File.dirname(filename))
  File.write(filename, data_to_save.to_yaml)
end