Sha256: 533995bd5ef2f589d82c0209edfcba54002d5edbf2e331743d635796eccb340f
Contents?: true
Size: 741 Bytes
Versions: 3
Compression:
Stored size: 741 Bytes
Contents
# frozen_string_literal: true require "fileutils" require "dato/dump/format" module Dato module Dump module Operation class CreatePost attr_reader :context, :path attr_accessor :frontmatter_format, :frontmatter_value, :content def initialize(context, path) @context = context @path = path end def perform FileUtils.mkdir_p(File.dirname(path)) File.open(File.join(context.path, path), "w") do |file| file.write Format.frontmatter_dump( frontmatter_format, frontmatter_value, ) file.write "\n\n" file.write content end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dato-0.8.3 | lib/dato/dump/operation/create_post.rb |
dato-0.8.2 | lib/dato/dump/operation/create_post.rb |
dato-0.8.1 | lib/dato/dump/operation/create_post.rb |