| add_assets {pracpac} | R Documentation | 
Add assets for the specified use case
Description
Add template assets for the use case specified in add_dockerfile or use_docker.
Usage
add_assets(
  pkg_path = ".",
  img_path = NULL,
  use_case = "default",
  overwrite = TRUE
)
Arguments
| pkg_path | Path to the package directory. Default is  | 
| img_path | Path to the write the docker image definition contents. The default  | 
| use_case | Name of the use case. Defaults to  | 
| overwrite | Logical; should existing assets should be overwritten? Default is  | 
Details
Example #1: the "shiny" use case requires than an app.R file moved into
/srv/shiny-server/ in the container image. Using add_assets(use_case="shiny")
(or when using the "shiny" use case in add_dockerfile or use_docker)
will create a placeholder assets/app.R in the docker/ directory. The
Dockerfile for the "shiny" use case will place COPY assets/app.R/srv/shiny-server into the Dockerfile.
Example #2: the "pipeline" use case creates boilerplate for moving pre- and
post-processing R and shell scripts into the container at
add_assets(use_case="pipeline") (or when using the "pipeline" use case in
add_dockerfile or use_docker) will create a placeholder assets/pre.R,
assets/post.R, and assets/run.sh into the docker/assets directory. The
Dockerfile for the "pipeline" use case will place COPY assets/run.sh /run.sh into the Dockerfile.
This function is run as part of use_docker but can be used on its own.
See vignette("use-cases", package="pracpac") for details on use cases.
Value
Invisibly returns assets per handle_use_case. Called primarily for its side effects.
Examples
## Not run: 
# Specify path to example package source and copy to tempdir()
# Note that in practice you do not need to copy to a tempdir()
# And in fact it may be easiest to use pracpac relative to your package directory root
ex_pkg_src <- system.file("hellow", package = "pracpac", mustWork = TRUE)
file.copy(from = ex_pkg_src, to = tempdir(), recursive = TRUE)
# Add assets for shiny use case
add_assets(pkg_path = file.path(tempdir(), "hellow"), use_case="shiny")
# Add assets for pipeline use case
add_assets(pkg_path = file.path(tempdir(), "hellow"), use_case="pipeline")
## End(Not run)