Class: ComfortableMexicanSofa::Fixture::Snippet::Exporter
- Defined in:
- lib/comfortable_mexican_sofa/fixture/snippet.rb
Instance Attribute Summary
Attributes inherited from Exporter
Instance Method Summary collapse
Methods inherited from Exporter
Constructor Details
This class inherits a constructor from ComfortableMexicanSofa::Fixture::Exporter
Instance Method Details
#export! ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/comfortable_mexican_sofa/fixture/snippet.rb', line 47 def export! prepare_folder!(self.path) self.site.snippets.each do |snippet| snippet_path = File.join(self.path, snippet.identifier) FileUtils.mkdir_p(snippet_path) # writing attributes open(File.join(snippet_path, 'attributes.yml'), 'w') do |f| f.write({ 'label' => snippet.label, 'categories' => snippet.categories.map{|c| c.label} }.to_yaml) end # writing content open(File.join(snippet_path, 'content.html'), 'w') do |f| f.write(snippet.content) end ComfortableMexicanSofa.logger.warn("[FIXTURES] Exported Snippet \t #{snippet.identifier}") end end |