Sha256: 61b73a6054fa0a3459926bc9a1a3a8c52c24865d9974e81fd3c9eb2e5f5c0a2c

Contents?: true

Size: 1.13 KB

Versions: 10

Compression:

Stored size: 1.13 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!(path)

      site.layouts.each do |layout|
        layout_path = File.join(path, layout.ancestors.reverse.collect(&: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

10 entries across 10 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-2.0.12 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.11 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.10 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.9 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.8 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.7 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.6 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.5 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.4 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.3 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb