Sha256: d300d1d6aa31b08a93c6f59853a54b897cdc9cbf6456dfcb618240c5f63edd87

Contents?: true

Size: 1.16 KB

Versions: 17

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

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

17 entries across 17 versions & 6 rubygems

Version Path
comfortable_mexican_sofa-2.0.19 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
PixelForce_ETS-0.0.2 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
PixelForce_ETS-0.0.1 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
kcyEtsTest2-0.0.4 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
kcyEtsTest2-0.0.3 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
kcyEtsTest2-0.0.2 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
kcyEtsTest2-0.0.1 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
kcyEtsTest-0.0.1 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
kcyEtsTest-2.2.19 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
ComfortableMexicanSofa-2.0.18 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
kcy1-1.0 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.18 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.17 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.16 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.15 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.14 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb
comfortable_mexican_sofa-2.0.13 lib/comfortable_mexican_sofa/seeds/layout/exporter.rb