Sha256: 83ea15c9e99740e0b0f2558efc49add1b560a97d46c45391612bc78463e396b3

Contents?: true

Size: 563 Bytes

Versions: 8

Compression:

Stored size: 563 Bytes

Contents

module Locomotive
  module Import
    class Snippets < Base

      def process
        Dir[File.join(theme_path, 'snippets', '*')].each do |snippet_path|
          self.log "path = #{snippet_path}"

          name = File.basename(snippet_path, File.extname(snippet_path)).parameterize('_')

          snippet = site.snippets.where(:slug => name).first || site.snippets.build(:name => name)

          snippet.template = File.read(snippet_path) # = site.snippets.create! :name => name, :template =>

          snippet.save!
        end
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
locomotive_cms-1.0.0.beta.2 lib/locomotive/import/snippets.rb
locomotive_cms-1.0.0.beta lib/locomotive/import/snippets.rb
locomotive_cms-0.0.4.beta12 lib/locomotive/import/snippets.rb
locomotive_cms-0.0.4.beta11 lib/locomotive/import/snippets.rb
locomotive_cms-0.0.4.beta10 lib/locomotive/import/snippets.rb
locomotive_cms-0.0.4.beta9 lib/locomotive/import/snippets.rb
locomotive_cms-0.0.4.beta8 lib/locomotive/import/snippets.rb
locomotive_cms-0.0.4.beta7 lib/locomotive/import/snippets.rb