Sha256: 6db807881509fe1b5a32977042eac693a59c95f47988e3e0bd8c64c5d27f7b20

Contents?: true

Size: 593 Bytes

Versions: 13

Compression:

Stored size: 593 Bytes

Contents

# frozen_string_literal: true

context = ChefDK::Generator.context
cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
files_dir = File.join(cookbook_dir, 'files', 'default')
cookbook_file_path = File.join(cookbook_dir, 'files', 'default', context.new_file_basename)

directory files_dir do
  recursive true
end

if context.content_source

  file cookbook_file_path do
    content(IO.read(context.context_source))
  end

else

  template cookbook_file_path do
    source 'cookbook_file.erb'
    helpers(ChefDK::Generator::TemplateHelper)
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
chef-dk-3.9.0 lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb
chef-dk-3.8.14 lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb
chef-dk-3.7.23 lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb
chef-dk-3.6.57 lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb
chef-dk-3.5.13 lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb
chef-dk-2.6.2 lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb
chef-dk-3.4.38 lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb
chef-dk-2.6.1 lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb
chef-dk-3.3.23 lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb
chef-dk-3.2.30 lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb
chef-dk-2.5.13 lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb
chef-dk-3.1.0 lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb
chef-dk-2.5.3 lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb