Sha256: 0b4c77af81690371d78c8a5168c7d68bf1eafd9b64a0045961bd28bceb4ac685

Contents?: true

Size: 637 Bytes

Versions: 1

Compression:

Stored size: 637 Bytes

Contents

require 'fileutils'
require 'kryo/generators/base'

module Kryo
  module Generators

    # Used to generate a basic post
    # @author Matthew A. Johnston (warmwaffles)
    class PostGenerator < Base
      VALID_TYPES = %w{markdown}.freeze

      def self.invoke title, type='markdown'
        directory = File.join(FileUtils.pwd, 'source', 'posts')
        date = DateTime.now
        name = [date.strftime("%Y-%m-%d"),title.gsub(/\s+/,'-')].join('-')
        name = [name, type].join('.').downcase
        create "post/templates/post.#{type}", directory, name: name do
          @title = title
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kryo-0.0.2 lib/kryo/generators/post/post_generator.rb