Class: ChefGen::Flavors

Inherits:
Object
  • Object
show all
Defined in:
lib/chef_gen/flavors.rb

Overview

a plugin framework for creating ChefDK generator flavors

Constant Summary collapse

VERSION =

the version of the gem

'0.8.4'

Class Method Summary collapse

Class Method Details

.pathString

return the path to to the copy of the generator cookbook for the selected ChefGen Flavor

Returns:

  • (String)

    the path to the code_generator cookbook



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/chef_gen/flavors.rb', line 20

def path
  # select the plugin to use
  @plugins = plugins.dup
  add_builtin_template
  selected = plugin_from_env ||
             only_plugin ||
             prompt_for_plugin ||
             fail('no ChefGen flavors found!')
  path = generator_path(selected)
  $stdout.puts "using ChefGen flavor '#{selected}' in #{path}"
  # take a copy so we can augment it
  copy = copy_generator_dir(path)
  # augment the copy if the plugin has hooks
  run_content_hooks(selected, copy)
  # return the path to the copy
  copy
end