Sha256: d8e326ec632624fdb208e022a4e7b5edabb3cb5f8c071542395f4c19a930ff0e

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

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

module Kryo
  module Generators

    # The standard site generator
    # @author Matthew A. Johnston (warmwaffles)
    class SiteGenerator < Base

      # Invokes the generator
      #
      # @param [String] name the name of the site you want to create
      # @param [String] directory the destination where the site will reside
      # @return [void]
      def self.invoke name, directory=FileUtils.pwd
        path = File.join(directory, name)

        %w{public lib}.each do |dir|
          FileUtils.mkpath(File.join(path, dir))
        end

        FileUtils.touch(File.join(path, 'public', '.gitkeep'))

        FileUtils.touch(File.join(path, 'lib', '.gitkeep'))

        %w{assets pages posts template}.each do |dir|
          FileUtils.mkpath(File.join(path, 'source', dir))
          FileUtils.touch(File.join(path,  'source', dir, '.gitkeep'))
        end

        create 'site/templates/config.rb', path
        create 'site/templates/Gemfile',   path
      end

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kryo-0.0.2 lib/kryo/generators/site/site_generator.rb