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 thecredentials
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.”
Listing all apps
The apps are stored in branches on the sap
repo.
list_apps() |> head()
#> branch last_updated
#> 2 01_whole-app-game 2025-03-11 13:28:36
#> 1 02.1_shiny-app 2025-03-11 13:30:37
#> 4 02.2_movies-app 2025-03-11 13:42:22
#> 5 02.3_proj-app 2025-03-11 13:43:18
#> 6 03.1_description 2025-03-11 13:44:18
#> 7 03.2_rproj 2025-03-11 13:44:55
You can also specify a regex
to return a table of
branches matching a particular chapter or topic:
list_apps("^16")
#> branch last_updated
#> 23 16.1_test-help 2025-03-11 14:17:52
#> 24 16.2_test-data 2025-03-11 14:22:18
#> 25 16.3_test-logger 2025-03-11 14:24:14
#> 26 16.4_test-snapshots 2025-03-11 14:25:35
list_apps("test")
#> branch last_updated
#> 21 14_tests_suite 2025-03-11 14:14:32
#> 23 16.1_test-help 2025-03-11 14:17:52
#> 24 16.2_test-data 2025-03-11 14:22:18
#> 25 16.3_test-logger 2025-03-11 14:24:14
#> 26 16.4_test-snapshots 2025-03-11 14:25:35
#> 27 17_test-modules 2025-03-11 14:27:13
#> 28 18_test-system 2025-03-11 14:28:58
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. Consider the three folders below:
path/to/project
└── project.Rproj
If the folder contains an R package, is_r_package()
returns TRUE
.
is_r_package(path = system.file("pkg", package = "shinypak"))
#> ✔ '/home/runner/work/_temp/Library/shinypak/pkg' is an R package (no .Rproj file found!)
#> [1] TRUE
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)
#> ✔ Package found!
#> ✔ Version found!
#> ✔ License found!
#> ✔ Description found!
#> ✔ Title found!
#> ✔ Author found!
#> ✔ Maintainer found!
#> ✔ '/home/runner/work/_temp/Library/shinypak/pkg' is an R package (no .Rproj file found!)
#> [1] TRUE
This can be used to quickly determine if a folder contains an R
package or Shiny app (and what is missing). Consider the
app
folder (with a DESCRIPTION
and
.Rproj
file).
is_r_package(
path = system.file("app", package = "shinypak"),
verbose = TRUE)
#> ✖ Package not in DESCRIPTION!
#> ✖ Version not in DESCRIPTION!
#> ✔ License found!
#> ✖ Description not in DESCRIPTION!
#> ✔ Title found!
#> ✔ Author found!
#> ✖ Maintainer not in DESCRIPTION!
#> ✖ '/home/runner/work/_temp/Library/shinypak/app' is not an R package (no .Rproj file found!)
#> [1] FALSE
This tells is app
has fields missing from the
DESCRIPTION
and the .Rproj
isn’t configured
with RStudio’s build tools.
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 = "05_roxygen2")
You can open the new app project by supplying the
open = TRUE
argument:
get_app(app = "05_roxygen2", 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_pkg-exports | App-packages | Dependencies |
06.2_pkg-imports | App-packages | Dependencies |
07_data | App-packages | Data |
08_launch-app | App-packages | Launch |
09_inst | App-packages | External files |
10_debugger | Debugging | Debugging in Positron/RStudio |
11_debug-print | Debugging | Print debugging methods |
12.1_debug-mods | Debugging | Debugging modules |
12.2_mod-comms | Debugging | Debugging module communication |
13_logging | Debugging | Logging app behaviors |
14_tests_suite | Tests | Building testthat test suite |
15_specs | Tests | Test specifications |
16.1_test-help | Tests | Using ensure to help write tests |
16.2_test-data | Tests | Storing and using test data |
16.3_test-logger | Tests | Writing a test logging helper function |
16.4_test-snapshots | Tests | Test snapshots |
17_test-modules | Tests | Testing modules |
18_test-system | Tests | System tests |
19_shinyappsio | Deploy | Deploy to shinyapps.io |
20_docker | Deploy | Deploying with Docker |
21.1_gha-style | Deploy | Deploying with GitHub Actions (styling code) |
21.2_gha-shiny-deploy | Deploy | Deploying shiny app with GitHub Actions |
21.3_gha-shiny-docker | Deploy | Deploying shiny app with Docker and GitHub Actions |
22_pkgdown | Deploy | Deploying a package website |
23_llm-shiny-assist | Shiny & LLMs | LLMs with Shiny Assistant |
24_llm-ellmer | Shiny & LLMs | LLMs with ellmer package |
25_llm-shinychat | Shiny & LLMs | LLMs with shinychat |
26_llm-chores | Shiny & LLMs | LLMs with chores package |
27_golem | Frameworks | golem framework |
28_leprechaun | Frameworks | leprechaun framework |
29_rhino | Frameworks | rhino framework |
DEV | NA | Development branch |
gh-pages | NA | gh-pages branch for pkgdown |
main | NA | main (initial) branch |