Class: Staticz::NewCommand

Inherits:
Object
  • Object
show all
Includes:
TTY::Option
Defined in:
lib/commands/new_command.rb

Instance Method Summary collapse

Instance Method Details

#runObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/commands/new_command.rb', line 42

def run
  if params[:help]
    print help
    exit 1
  end

  if params.errors.any?
    puts params.errors.summary
    exit 1
  end

  Object
    .const_get("Staticz::Templates::#{params[:template].capitalize}")
    .tap do |template|
      if params[:with_gitignore]
        template.file ".gitignore", "          build/\n        GITIGNORE\n      end\n    end\n    .build(params[:name])\nend\n"