Skip to contents

shinypak assumes you have GitHub and Posit workbench synced. Read more about setting this up on the gert package website

In gert, authentication is done automatically using the credentials package. This package calls out to the local OS credential store which is also used by the git command line. Therefore gert will automatically pick up on https credentials that are safely stored in your OS keychain.

List all apps

The apps are stored in branches on the sap repo.

list_apps() |> head()
#>              branch        last_updated
#> 2 01_whole-app-game 2024-07-30 14:59:35
#> 1    02.1_shiny-app 2024-09-03 21:27:18
#> 4   02.2_movies-app 2024-12-15 11:14:20
#> 5     02.3_proj-app 2024-12-16 05:00:36
#> 6  03.1_description 2024-12-16 19:57:01
#> 7        03.2_rproj 2024-12-16 19:58:34

You can also specify a regex to return a table of branches matching a particular chapter or topic:

list_apps("^16")
#>                  branch        last_updated
#> 21  16.1_tests-fixtures 2024-09-14 14:13:41
#> 22   16.2_tests-helpers 2024-09-04 05:39:27
#> 23 16.3_tests-snapshots 2024-11-06 15:09:57
list_apps("tests")
#>                  branch        last_updated
#> 20       15_tests-specs 2024-09-04 05:33:22
#> 21  16.1_tests-fixtures 2024-09-14 14:13:41
#> 22   16.2_tests-helpers 2024-09-04 05:39:27
#> 23 16.3_tests-snapshots 2024-11-06 15:09:57
#> 24     17_tests-modules 2024-09-04 06:11:59
#> 25      18_tests-system 2025-01-17 21:55:03

Launch

To launch an app from the Shiny App-Packages book, you can supply the name of the branch to launch():

launch(app = "<branch>")

For example, we’ll start with one of the branches from the early chapters of Shiny App-Packages (the app is not quite an app-package yet):

launch(app = "02.3_proj-app")

launch() will check if the application has already been downloaded, download the application files into a folder in the current working directory, then launch the app:

 '02.3_proj-app' not in local working directory [59ms]
 downloading '02.3_proj-app' [10.7s] 
 got '02.3_proj-app' [163ms]         
 Launching app with: shiny::shinyAppDir('02.3_proj-app/app.R') 

If the branch is storing an app-package, launch() loads the package and then launches the application:

Helper

The is_r_package() function is useful for determining if a directory contains an R package. If path contains a folder that isn’t an R package, it will return FALSE.

is_r_package(path = system.file("pkg", package = "shinypak"))
#> [1] FALSE

If the verbose argument is set to TRUE, the details are printed on what is being checked:

is_r_package(path = system.file("pkg", package = "shinypak"), verbose = TRUE)
#>  Checking DESCRIPTION for package fields
#>  Package, Version, License, Description, Title, Author, and Maintainer found!
#>  Checking .Rroj for project build fields
#>  BuildType, PackageUseDevtools, and PackageInstallArgs not in .Rproj!
#>  '' is not configured as an R package
#> [1] FALSE

Get

launch() calls the get_app() function. If you call get_app(), the specified branch and application will be downloaded into the current working directory:

get_app(app = "14_tests-system")

You can open the new app project by supplying the open = TRUE argument:

get_app(app = "14_tests-system", open = TRUE)

If the app is already downloaded, the files are updated with the latest commit to the branch.

Lookup Table

topic_lookup connects branch, part, and chapter:

topic_lookup
branch part chapter
01_whole-app-game Intro Whole app game
02.1_shiny-app Intro Shiny
02.2_movies-app Intro Shiny
02.3_proj-app Intro Shiny
03.1_description Intro Packages
03.2_rproj Intro Packages
03.3_create-package Intro Packages
04_devtools Intro Development
05_roxygen2 App-packages Documentation
06.1_exports App-packages Dependencies
06.2_imports App-packages Dependencies
07_data App-packages Data
08_launch App-packages Launch
09_inst App-packages Resources
10_debugger Debug Debuggers
11_debug-print Debug Print debugging
12_debug-apps Debug Debugging apps
14_test-suite Tests Test suite
15_tests-specs Tests Specifications
16.1_tests-fixtures Tests Test tools
16.2_tests-helpers Tests Test tools
16.3_tests-snapshots Tests Test tools
17_tests-modules Tests Testing modules
18_tests-system Tests System tests
20_docker Deploy Docker
21.1_gha-style Deploy GitHub Actions
21.2_gha-shiny Deploy GitHub Actions
21.3_gha-docker Deploy GitHub Actions
22_pkgdown Deploy pkgdown
23_golem Frameworks golem
24_leprechaun Frameworks leprechaun
25_charpente Frameworks charpente
26_rhino Frameworks rhino