Sha256: f923b29e14e8dbf7944b2f2c4081a8883e352aaa13b19e5fdf06ab9cc0b04ab3

Contents?: true

Size: 1.76 KB

Versions: 74

Compression:

Stored size: 1.76 KB

Contents


context = ChefDK::Generator.context
app_dir = File.join(context.app_root, context.app_name)
cookbooks_dir = context.cookbook_root
cookbook_dir = File.join(cookbooks_dir, context.cookbook_name)

# app root dir
directory app_dir

# Top level files

# Test Kitchen
template "#{app_dir}/.kitchen.yml" do
  source 'kitchen.yml.erb'
  helpers(ChefDK::Generator::TemplateHelper)
end

# Inspec
directory "#{app_dir}/test/smoke/default" do
  recursive true
end

template "#{app_dir}/test/smoke/default/default_test.rb" do
  source 'inspec_default_test.rb.erb'
  helpers(ChefDK::Generator::TemplateHelper)
  action :create_if_missing
end

# README
template "#{app_dir}/README.md" do
  helpers(ChefDK::Generator::TemplateHelper)
end

# Generated Cookbook:

# cookbook collection dir
directory cookbooks_dir

# cookbook collection dir
directory cookbook_dir

# metadata.rb
template "#{cookbook_dir}/metadata.rb" do
  helpers(ChefDK::Generator::TemplateHelper)
end

# chefignore
cookbook_file "#{cookbook_dir}/chefignore"

# Berks
cookbook_file "#{cookbook_dir}/Berksfile"

# Recipes

directory "#{cookbook_dir}/recipes"

template "#{cookbook_dir}/recipes/default.rb" do
  source 'recipe.rb.erb'
  helpers(ChefDK::Generator::TemplateHelper)
end

# Chefspec
directory "#{cookbook_dir}/spec/unit/recipes" do
  recursive true
end

cookbook_file "#{cookbook_dir}/spec/spec_helper.rb" do
  action :create_if_missing
end

template "#{cookbook_dir}/spec/unit/recipes/default_spec.rb" do
  source 'recipe_spec.rb.erb'
  helpers(ChefDK::Generator::TemplateHelper)
  action :create_if_missing
end

# git
if context.have_git
  unless context.skip_git_init
    execute('initialize-git') do
      command('git init .')
      cwd app_dir
    end
  end
  cookbook_file "#{app_dir}/.gitignore" do
    source 'gitignore'
  end
end

Version data entries

74 entries across 74 versions & 3 rubygems

Version Path
iapi-idlc-sdk-pfm-1.0.24 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.23 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.22 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.21 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.20 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.19 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.18 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.17 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.16 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.15 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.14 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.13 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.12 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.11 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.10 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.9 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.8 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.7 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.6 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb
iapi-idlc-sdk-pfm-1.0.5 lib/iapi-idlc-sdk-pfm/command/generator_commands/skeletons/code_generator/recipes/app.rb