Class: Middleman::Cli::Init

Inherits:
Thor
  • Object
show all
Defined in:
lib/middleman-core/cli/init.rb

Overview

A thor task for creating new projects

Instance Method Summary collapse

Instance Method Details

#init(name) ⇒ Object

The init task

Parameters:



45
46
47
48
49
50
51
52
53
# File 'lib/middleman-core/cli/init.rb', line 45

def init(name)
  key = options[:template].to_sym
  unless ::Middleman::Templates.registered.has_key?(key)
    raise Thor::Error.new "Unknown project template '#{key}'"
  end

  thor_group = ::Middleman::Templates.registered[key]
  thor_group.new([name], options).invoke_all
end