Exception: Picky::Generators::NotFoundException

Inherits:
StandardError
  • Object
show all
Defined in:
lib/picky-generators/generators/not_found_exception.rb

Overview

Thrown when no generator for the command

picky <command> <options>

is found.

Instance Method Summary collapse

Constructor Details

#initialize(selector) ⇒ NotFoundException

:nodoc:all



11
12
13
# File 'lib/picky-generators/generators/not_found_exception.rb', line 11

def initialize selector
  super usage + possible_commands(selector.types)
end

Instance Method Details

#possible_commands(types) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/picky-generators/generators/not_found_exception.rb', line 21

def possible_commands types
  "Possible commands:\n" +
  types.map do |name, klass_params|
    result = "  picky-generate #{name}"
    _, params = *klass_params
    result << ' ' << [*params].map { |param| "<#{param}>" }.join(' ') if params
    result
  end.join(?\n) + ?\n + ?\n
end

#usageObject



15
16
17
18
19
# File 'lib/picky-generators/generators/not_found_exception.rb', line 15

def usage
  "\nUsage:\n" +
  "  picky-generate <project_type> [params]\n" +
  ?\n
end