Class: Lando::Generator::Command::Create

Inherits:
Object
  • Object
show all
Extended by:
Lando::Generator::CommandHelper
Defined in:
lib/lando/generator/command/create.rb

Class Method Summary collapse

Methods included from Lando::Generator::CommandHelper

assert_template_exists, require_nonblank, templates_path

Class Method Details

.execute(name = nil, template = nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/lando/generator/command/create.rb', line 10

def execute(name = nil, template = nil)
  require_nonblank('name', name)
  require_nonblank('template', template)

  raise ArgumentError.new "Directory '#{name}' already exists" if File.exist?(name)
  assert_template_exists(template)
  
  template_path = File.join templates_path, template
  FileUtils.copy_entry template_path, name
end