Sha256: 63c71de1831b8e2870bd536e9ca8eb2cacb1589b04fa80d5d5918713b21e94dc

Contents?: true

Size: 652 Bytes

Versions: 1

Compression:

Stored size: 652 Bytes

Contents

context = ChefCLI::Generator.context
cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
new_file_basename = File.basename(context.new_file_basename)
relative_path = File.dirname(context.new_file_basename)
relative_path.slice! "."
files_dir = File.join(cookbook_dir, 'files', relative_path)
cookbook_file_path = File.join(files_dir, new_file_basename)

directory files_dir do
  recursive true
end

if context.content_source

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

else

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chef-cli-3.0.36 lib/chef-cli/skeletons/code_generator/recipes/cookbook_file.rb