Class: Charyf::Generators::SkillHooksGenerator

Inherits:
NamedBase show all
Defined in:
lib/charyf/utils/generators/skill/hooks_generator.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from NamedBase

#initialize

Methods inherited from Base

class_option, desc, desc_file, hide!, hook_for, inherited, namespace, source_root

Methods included from Actions

#add_source, #after_bundle, #environment, #gem, #gem_group, #git, #initialize

Constructor Details

This class inherits a constructor from Charyf::Generators::NamedBase

Instance Method Details

#tryObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/charyf/utils/generators/skill/hooks_generator.rb', line 14

def try
  hooked_generators.each do |generator_name|
    names = generator_name.to_s.split(":")
    klass = Charyf::Generators.find_by_namespace(names.pop, names.any? && names.join(":"))

    if klass
      say_status behavior, generator_name, :green

      invoke generator_name, [name], options, behavior: behavior
    else
      say_status behavior, "#{generator_name} generator not found", :red
    end
  end
end