Class: Kryo::Generators::SiteGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/kryo/generators/site/site_generator.rb

Overview

The standard site generator

Author:

  • Matthew A. Johnston (warmwaffles)

Class Method Summary collapse

Methods inherited from Base

create

Class Method Details

.invoke(name, directory = FileUtils.pwd) ⇒ void

This method returns an undefined value.

Invokes the generator

Parameters:

  • name (String)

    the name of the site you want to create

  • directory (String) (defaults to: FileUtils.pwd)

    the destination where the site will reside



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/kryo/generators/site/site_generator.rb', line 16

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