Most of the examples in the accesstocare package can be
deployed to RStudio Connect by using the RStudio IDE’s button push
deployment. All of the examples are designed to be deployed using
RStudio Connect’s Git Backed
Deployment. This means that we tell RStudio Connect where the code
repository exists, and then have RStudio Connect download the latest
code everytime the repository is updated.
A major step to accomplish this, is to have a “manifest” file. It
contains the metadata of the example, such as package versions, R
version, primary file, etc. It is produced using the
rsconnect package. In accesstocare, there are
two utility functions to make it easier to create the manifest
files.
There are two functions included in accesstocare to help
with creating the manifests:
write_manifest() creates the manifest for a single
examplewrite_all_manifests() batch creates all of the
manifestsWe will the fs package to make it easy to see the
changes in the directories.
For the usage examples, we will copy all of the
accesstocare examples into a temporary folder.
temp_folder <- path(tempdir(), "temp")
create_content(target = temp_folder, content = "all", silent = TRUE)To show how to create the manifest of a single example, we will point
to the “quarto-dashboard-r” sub-folder. The
create_content() command created that sub-folder.
/var/folders/l8/v1ym1mc10_b0dftql5wrrm8w0000gn/T/RtmpBkacCE/temp/quarto-dashboard-r
├── access-to-care.qmd
├── .gitignore
└── metadata.yml
The folder contains the example, a metadata.yml, and a
.gitignore file.
Now, we run create the manifest using write_manifest().
The function will automatically identify the primary document, and
process the files listed in.gitignore file.
write_manifest(dashboard_path)Full path: /var/folders/l8/v1ym1mc10_b0dftql5wrrm8w0000gn/T/RtmpBkacCE/temp/quarto-dashboard-r
Application files
--- access-to-care.qmd
--- metadata.yml
Primary file: access-to-care.qmd
Compiling manifest...
Manifest complete
/var/folders/l8/v1ym1mc10_b0dftql5wrrm8w0000gn/T/RtmpBkacCE/temp/quarto-dashboard-r/manifest.json
The manifest.json file is now available in the
sub-folder.
dir_tree(dashboard_path)/var/folders/l8/v1ym1mc10_b0dftql5wrrm8w0000gn/T/RtmpBkacCE/temp/quarto-dashboard-r
├── access-to-care.qmd
├── .gitignore
├── manifest.json
└── metadata.yml
To create the manifests for all of the sub-folders, use
write_all_manifests(). This function will silently run the
manifest writer for each sub-folder. For those that it fails for, it
skips the creation. The function returns a list object with
all of the results. Printing the object on the R Console shows which
were skipped, and which were created.
write_all_manifests(temp_folder)# A tibble: 16 × 2
content created
<chr> <chr>
1 RMarkdown-DataPrep YES
2 RMarkdown-html YES
3 RMarkdown-pdf YES
4 RNotebook YES
5 connectwidgets YES
6 dash YES
7 flexdashboard YES
8 htmlwidgets SKIPPED
9 jupyter YES
10 launcher-programatic YES
11 plot SKIPPED
12 plumber-api YES
13 powerpoint YES
14 powerpoint-state YES
15 presentation YES
16 shiny YES