class Pfm::Command::GeneratorCommands::ServerBuild

def base_dir

def base_dir
  "builds/#{@params.first}"
end

def default_build_files

def default_build_files
  %w(
    metadata
  ).each do |file|
    FileUtils.touch("#{base_dir}/#{file}", verbose: verbose?(params))
  end
end

def default_cookbooks

def default_cookbooks
  %w(
    chef/bake/cookbooks/bake
    chef/fry/cookbooks/fry
  ).each do |cookbook|
    system("chef generate cookbook #{base_dir}/#{cookbook} -g #{__dir__}/skeletons/code_generator")
  end
end

def mk_build_dirs

def mk_build_dirs
  %w(
    chef/bake/cookbooks
    chef/fry/cookbooks
    chef/vendor/cookbooks
  ).each do |path|
    FileUtils.mkdir_p("#{base_dir}/#{path}", verbose: verbose?(params))
  end
end

def run

def run
  read_and_validate_params
  if params_valid?
    setup_context
    mk_build_dirs
    default_build_files
    default_cookbooks
  else
    errors.each { |error| err("Error: #{error}") }
    parse_options(params)
    msg(opt_parser)
    1
  end
end