Sha256: eb0dfd13c8f955ec501b0ff4c67edf9e15db1ebf27b93c96d4729edb4d3d3f2b

Contents?: true

Size: 961 Bytes

Versions: 17

Compression:

Stored size: 961 Bytes

Contents

# frozen_string_literal: true

module ComfortableMexicanSofa::Seeds::Snippet
  class Exporter < ComfortableMexicanSofa::Seeds::Exporter

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

    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)

        message = "[CMS SEEDS] Exported Snippet \t #{snippet.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/snippet/exporter.rb
PixelForce_ETS-0.0.2 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
PixelForce_ETS-0.0.1 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
kcyEtsTest2-0.0.4 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
kcyEtsTest2-0.0.3 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
kcyEtsTest2-0.0.2 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
kcyEtsTest2-0.0.1 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
kcyEtsTest-0.0.1 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
kcyEtsTest-2.2.19 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
ComfortableMexicanSofa-2.0.18 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
kcy1-1.0 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
comfortable_mexican_sofa-2.0.18 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
comfortable_mexican_sofa-2.0.17 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
comfortable_mexican_sofa-2.0.16 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
comfortable_mexican_sofa-2.0.15 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
comfortable_mexican_sofa-2.0.14 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb
comfortable_mexican_sofa-2.0.13 lib/comfortable_mexican_sofa/seeds/snippet/exporter.rb