Sha256: d9fff41ff6cac6294c29da279c1f5d9cc56e18fcff5d4c69d68dba54a4a68da0

Contents?: true

Size: 505 Bytes

Versions: 3

Compression:

Stored size: 505 Bytes

Contents

context = ChefCLI::Generator.context
cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
files_dir = File.join(cookbook_dir, 'files')
cookbook_file_path = File.join(files_dir, 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(ChefCLI::Generator::TemplateHelper)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chef-cli-1.0.9 lib/chef-cli/skeletons/code_generator/recipes/cookbook_file.rb
chef-cli-1.0.6 lib/chef-cli/skeletons/code_generator/recipes/cookbook_file.rb
chef-cli-1.0.3 lib/chef-cli/skeletons/code_generator/recipes/cookbook_file.rb