add_update: Add an update to a shiny app

Description Usage Arguments Details Examples

View source: R/add_update.R

Description

Pass app updates from a local inst directory to an app in an installed package

Usage

1
add_update(local_pkg, ..., app_name, open_dir = FALSE, update_css = FALSE)

Arguments

local_pkg

character Path to the local version of the package from which updates will be passed

...

Additional directory names passed to file.path() (see details)

app_name

character Name of the app to be updated

open_dir

logical If TRUE, browseURL() is called to view the files in the app directory

update_css

logical If TRUE the css file is updated

Details

This function enables ultra-fast updates to shiny apps without needing to rebuild the package. It is assumed that two versions of a package exist on the user's machine. The first version is an installed package stored in the user's library, while the second version is a pre-compiled (in-work) version of the package. This function allows users to pass updates to an app from the in-work version of the package to the installed version while ensuring that the app can be deployed/published. Because files in the inst/ directory aren't compiled when packages are built, updates can be passed to an installed package. This is useful for testing changes made to an app without re-building the package each time.

The local_pkg argument can be specified by providing a full file path to any file in the uncompiled version of the package. The root directory of the in-work package is located using rprojroot::find_root. The root directory of the installed version of the package is located using devtools::inst(). Any changes made to an app in the in-work package are passed to the app within the installed version of the package stored in the user's package library.

The ... arguments are passed file.path() and name the directories between the package root directory and the app_name/ directory. Note: the inst has already been provided and should not be included. For update_css=TRUE the ... argument specifies the directories between the package root and the directory in which the css files are stored.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# In the \code{teachingApps} package, apps are stored in the 
# \code{inst/apps/} directory. 
## Not run:  
teachingApps::add_update(local_pkg = file.choose(),
                         'apps',
                         app_name = 'maximum_likelihood')

## End(Not run)

# Open an app directory to make and push updates

## Not run:  
teachingApps::add_update(local_pkg = file.choose(),
                         'apps',
                         app_name = 'maximum_likelihood',
                         open_dir = TRUE)

## End(Not run)

teachingApps documentation built on July 1, 2020, 5:58 p.m.