Class: Occams::Seeds::Snippet::Exporter
- Defined in:
- lib/occams/seeds/snippet/exporter.rb
Instance Attribute Summary
Attributes inherited from Exporter
Instance Method Summary collapse
- #export! ⇒ Object
-
#initialize(from, to = from) ⇒ Exporter
constructor
A new instance of Exporter.
Constructor Details
Instance Method Details
#export! ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/occams/seeds/snippet/exporter.rb', line 10 def export! prepare_folder!(path) site.snippets.each do |snippet| attrs = { 'label' => snippet.label, 'categories' => snippet.categories.map(&:label), 'position' => snippet.position }.to_yaml data = [] data << { header: 'attributes', content: attrs } data << { header: 'content', content: snippet.content } snippet_path = File.join(path, "#{snippet.identifier}.html") write_file_content(snippet_path, data) = "[CMS SEEDS] Exported Snippet \t #{snippet.identifier}" Occams.logger.info() end end |