Sha256: f6fe69748abf86a968c859e665b33fb44722485ac0e1065c9ac82afea61d1d37

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

module ComfortableMexicanSofa::Seeds::Layout
  class Exporter < ComfortableMexicanSofa::Seeds::Exporter

    def initialize(from, to = from)
      super
      self.path = ::File.join(ComfortableMexicanSofa.config.seeds_path, to, "layouts/")
    end

    def export!
      prepare_folder!(self.path)

      self.site.layouts.each do |layout|
        layout_path = File.join(path, layout.ancestors.reverse.collect{|l| l.identifier}, layout.identifier)
        FileUtils.mkdir_p(layout_path)

        path = ::File.join(layout_path, "content.html")
        data = []

        attrs = {
          "label"      => layout.label,
          "app_layout" => layout.app_layout,
          "position"   => layout.position
        }.to_yaml

        data << {header: "attributes",  content: attrs}
        data << {header: "content",     content: layout.content}
        data << {header: "js",          content: layout.js}
        data << {header: "css",         content: layout.css}

        write_file_content(path, data)

        message = "[CMS SEEDS] Exported Layout \t #{layout.identifier}"
        ComfortableMexicanSofa.logger.info(message)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-2.0.2 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.1 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.0 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb