R/makeShinyCellModularPortable.R
makeShinyCellModularPortable.RdAll customization and testing happens in out_dir (the folder created and
iterated on with useShinyCellModular). When ready to containerize, put
behind ShinyProxy, or serve as one of several datasets on a website engine, run
this function to assemble a self-contained portable bundle in bundle_dir:
a skeleton app.R, app_config.yml, and copies of modules/
and the input data. out_dir itself is never modified, it stays the dev
copy. bundle_dir is what gets moved to wherever it needs to live.
makeShinyCellModularPortable(out_dir, bundle_dir = NULL, overwrite = FALSE)Existing, already-tested app folder created by
useShinyCellModular (must contain app.R). Left untouched.
Destination folder for the portable bundle. Default
NULL: uses paste0(out_dir, "_portable"). If it already exists
and does not contain an app_config.yml, this function stops rather
than risk overwriting the out_dir you are trying to convert. If it
already exists and does contain an app_config.yml (an earlier
portable bundle), set overwrite = TRUE to replace it.
Replace an existing bundle_dir that already contains
an app_config.yml. Default FALSE.
Invisibly returns NULL. Writes the bundle to bundle_dir.
app_title, enabled_tabs, navbar_css, and the generating
ShinyCellModular version are all read by sourcing out_dir's
app.R and taking the resulting variables directly, not by parsing the
text. assays come from out_dir's folder structure: every
top-level folder other than modules/ is treated as data input. Any
hand-added or edited tabs in app.R and modules/ are picked up
and carried into the bundle.
The skeleton app.R bakes in the ShinyCellModular version that
generated out_dir's app.R (SKELETON_VERSION, read from
that app.R, not from whatever version happens to be installed right
now), and compares it against app_config.yml's scm_version at
startup. On mismatch, e.g. an app_config.yml paired with the wrong
skeleton copy, it warns but still launches, the developer decides whether
that mismatch actually matters.