class CookbookCreator::Main

Attributes

params[R]

Public Class Methods

new(argv=[]) click to toggle source
# File lib/cookbook_creator/main.rb, line 20
def initialize(argv=[])
  @cookbook_name = argv[0]
  @params = argv
end

Public Instance Methods

run() click to toggle source
# File lib/cookbook_creator/main.rb, line 25
def run
  config_location = ConfigLoader.new(nil, nil).config_location
  CookbookCreator::MCLI.use_separate_default_options true
  cli = CookbookCreator::MCLI.new
  cli.run(@params)
  generator_config = Helpers::load_config_file(cli.default_config, cli.config)
  Config.from_file(generator_config)
  sym_hash = Config.configuration.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
  Helpers.merge_configs(cli.default_config, cli.config, sym_hash)
  run_list = ["recipe[code_generator::cookbook]"]
  cookbook_root =  Generator::Context.cookbook_root
  runner = Runner.new(cli.config[:generator_cookbook], run_list)  
  Generator.setup_context(cli.config)
  runner.converge
end