| Title: | Generate Project Files from a Template | 
| Version: | 0.1.0 | 
| Description: | Generate project files and directories following a pre-made template. You can specify variables to customize file names and content, and flexibly adapt the template to your needs. 'cookiecutter' for 'R' implements a subset of the excellent 'cookiecutter' package for the 'Python' programming language (https://github.com/cookiecutter/), and aims to be largely compatible with the original 'cookiecutter' template format. | 
| URL: | https://github.com/felixhenninger/cookiecutter/, https://felixhenninger.github.io/cookiecutter/, https://github.com/FelixHenninger/cookiecutter | 
| License: | Apache License (≥ 2) | 
| Config/Needs/website: | pkgdown, rmarkdown | 
| Encoding: | UTF-8 | 
| RoxygenNote: | 7.2.3 | 
| Imports: | fs, jsonlite, mime, purrr, readr, rlang, stringr, utils, whisker | 
| BugReports: | https://github.com/FelixHenninger/cookiecutter/issues | 
| NeedsCompilation: | no | 
| Packaged: | 2023-09-07 19:26:25 UTC; felix | 
| Author: | Felix Henninger | 
| Maintainer: | Felix Henninger <mailbox@felixhenninger.com> | 
| Repository: | CRAN | 
| Date/Publication: | 2023-09-08 07:00:02 UTC | 
Fill a directory with files based on a cookiecutter template.
Description
This function takes a cookiecutter-compatible template directory and resolves template placeholders in both filenames and (for text files) content.
Usage
bake(
  template,
  output_path,
  extra_context = list(),
  overwrite = FALSE,
  no_input = FALSE
)
Arguments
| template | Template to apply | 
| output_path | Directory to fill | 
| extra_context | Context variables to use while populating template | 
| overwrite | Whether to overwrite existing files | 
| no_input | Don't prompt for context variables specified in cookiecutter.json | 
Details
template
Path to the template to apply. This can point to either a directory, or an
archive of the same in .zip, .tar or .tar.gz formats.
output_path
Path of directory to output processed template files into. This will be
filled based on the contents of the template option.
extra_context
List of template variables to use in filling placeholders. (empty by default)
overwrite
Whether to overwrite existing files. (defaults to false, and issues a
message)
no_input
Don't prompt the user for variable values specified in cookiecutter.json.
This removes the need for interaction when applying a template.
Value
None
Examples
# Extract a demo template
# (this uses a bundled template and extracts information
# into a temporary directory -- you'll have it easier
# because you can insert the paths you want directly)
cookiecutter::bake(
  system.file('examples/demo.zip', package = 'cookiecutter'),
  fs::path_temp('cookiecutter.demo'),
  extra_context = list(
    flavor = 'chocolate chip',
    hot_beverage = 'coffee'
  )
)
Generate a new directory from a template, given a predefined context
Description
Generate a new directory from a template, given a predefined context
Usage
generate_files(
  template_dir,
  output_dir,
  context = list(),
  context_prefix = NA,
  exclude = c(),
  overwrite = FALSE
)
Arguments
| template_dir | Template directory to copy | 
| output_dir | Target directory to copy to (defaults to project directory) | 
| context | Data available in templates | 
| context_prefix | Prefix key to apply to context data (see description) | 
| exclude | Files to exclude, as an array of paths with respect to the template directory | 
| overwrite | Whether to overwrite existing files |