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.”
List all apps
The apps are stored in branches on the shinyAppPkgs
repo:
list_apps()
#> branch last_updated
#> 2 01_whole-app-game 2024-07-25 19:14:02
#> 1 02.1_shiny-app 2024-07-25 19:20:46
#> 4 02.2_movies-app 2024-07-25 19:25:24
#> 5 02.3_proj-app 2024-07-25 19:28:08
#> 6 03.1_description 2024-07-25 19:40:09
#> 7 03.2_rproj 2024-07-25 19:54:08
#> 8 03.3_create-package 2024-07-25 19:59:58
#> 9 04_devtools 2024-07-25 20:16:35
#> 10 05_roxygen2 2024-07-26 05:02:57
#> 11 06.1_pkg-exports 2024-07-26 05:27:53
#> 12 06.2_pkg-imports 2024-07-26 05:38:56
#> 13 07_data 2024-07-26 13:57:00
#> 14 08_launch-app 2024-07-26 15:02:25
#> 15 09.1_inst-www 2024-07-26 15:01:04
#> 16 09.2_inst-bslib 2024-07-26 15:12:26
#> 17 09.3_inst-dev 2024-07-26 15:18:47
#> 18 09.4_inst-prod 2024-07-26 18:45:51
#> 19 11_tests-specs 2024-07-26 19:07:11
#> 20 12.1_tests-fixtures 2024-07-26 19:18:13
#> 21 12.2_tests-helpers 2024-07-26 19:34:52
#> 22 12.3_tests-snapshots 2024-07-26 19:45:10
#> 23 13_tests-modules 2024-07-26 20:09:02
#> 24 14_tests-system 2024-07-26 20:23:38
#> 25 15_docker 2024-07-18 14:57:42
#> 26 16.1_gha-style 2024-07-18 15:01:55
#> 27 16.2_gha-shiny 2024-07-18 15:14:24
#> 28 16.3_gha-docker 2024-07-18 15:11:18
#> 29 17_pkgdown 2024-07-18 15:36:39
#> 31 18_html 2024-07-18 16:11:37
#> 30 18.3_css-file 2024-03-18 21:20:11
#> 32 19.1_css-inline 2024-07-18 15:54:38
#> 33 19.2_css-internal 2024-03-18 18:54:15
#> 34 19.3_css-file 2024-03-18 21:20:11
#> 35 20.1_js-htmltools 2024-05-21 04:09:58
#> 36 20.2_js-react 2024-05-09 13:56:26
#> 37 21_style 2024-02-15 14:57:11
#> 38 22_golem 2024-01-17 21:49:00
#> 39 23_leprechaun 2024-01-18 17:59:53
#> 40 24_rhino 2024-04-11 19:10:16
#> 41 25.0_debug-error 2024-02-13 11:29:39
#> 42 25.1_debug-selected_vars 2024-01-15 17:29:25
#> 43 25.2_debug-var_inputs 2024-01-15 17:25:12
#> 44 25.3_debug-scatter_plot 2024-01-15 17:21:58
#> 45 25.4_debug-print 2024-01-15 17:04:21
#> 46 26.1.0_reactive-values 2024-02-13 17:22:35
#> 47 26.1.1_step_01 2024-02-13 17:14:41
#> 48 26.1.2_step_02 2024-02-13 16:23:49
#> 49 26.1.3_step_03 2024-02-13 16:38:31
#> 50 26.1.4_step_04 2024-02-13 19:21:19
#> 51 26.2.0_user-data 2024-02-13 19:04:32
#> 52 26.2.1_step_01 2024-02-13 19:03:00
#> 53 26.2.2_step_02 2024-02-13 19:01:57
#> 54 27_stack-traces 2024-02-21 19:34:35
#> 55 28_dependency-hell 2024-02-21 19:36:47
#> 56 A.E_mocks-snapshots 2024-02-13 19:48:31
You can also specify a regex
to return a table of
branches matching a particular chapter or topic:
list_apps("12")
#> branch last_updated
#> 20 12.1_tests-fixtures 2024-07-26 19:18:13
#> 21 12.2_tests-helpers 2024-07-26 19:34:52
#> 22 12.3_tests-snapshots 2024-07-26 19:45:10
list_apps("tests")
#> branch last_updated
#> 19 11_tests-specs 2024-07-26 19:07:11
#> 20 12.1_tests-fixtures 2024-07-26 19:18:13
#> 21 12.2_tests-helpers 2024-07-26 19:34:52
#> 22 12.3_tests-snapshots 2024-07-26 19:45:10
#> 23 13_tests-modules 2024-07-26 20:09:02
#> 24 14_tests-system 2024-07-26 20:23:38
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:
launch(app = "09.2_inst-bslib")
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 = "02.2_proj-app")
If the verbose
argument is set to TRUE
, the
details are printed on what is being checked:
is_r_package("09.2_inst-bslib", verbose = TRUE)
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_pkg-exports | App-packages | Dependencies |
06.2_pkg-imports | App-packages | Dependencies |
07_data | App-packages | Data |
08_launch-app | App-packages | Launch |
09.1_inst-www | App-packages | External files |
09.2_inst-bslib | App-packages | External files |
09.3_inst-dev | App-packages | External files |
09.4_inst-prod | App-packages | External files |
11_tests-specs | Tests | Specifications |
12.1_tests-fixtures | Tests | Test tools |
12.2_tests-helpers | Tests | Test tools |
12.3_tests-snapshots | Tests | Test tools |
13_tests-modules | Tests | Testing modules |
14_tests-system | Deploy | System tests |
15_docker | Deploy | Docker |
16.1_gha-style | Deploy | GitHub Actions |
16.2_gha-shiny | Deploy | GitHub Actions |
16.3_gha-docker | Deploy | GitHub Actions |
17_pkgdown | Deploy | pkgdown |
18.1_css-inline | Non-R Code | CSS |
18.2_css-internal | Non-R Code | CSS |
18.3_css-file | Non-R Code | CSS |
19_js | Non-R Code | JavaScript |
20_python | Non-R Code | Python |
21_style | Non-R Code | Linting and styling |
22_golem | Frameworks | golem |
23_leprechaun | Frameworks | leprechaun |
24_rhino | Frameworks | rhino |
25.0_debug-error | Special Topics | Debugging |
25.1_debug-selected_vars | Special Topics | Debugging |
25.2_debug-var_inputs | Special Topics | Debugging |
25.3_debug-scatter_plot | Special Topics | Debugging |
25.4_debug-print | Special Topics | Debugging |
26.1.0_reactive-values | Special Topics | App Data |
26.1.1_step_01 | Special Topics | App Data |
26.1.2_step_02 | Special Topics | App Data |
26.1.3_step_03 | Special Topics | App Data |
26.1.4_step_04 | Special Topics | App Data |
26.2.0_user-data | Special Topics | App Data |
26.2.1_step_01 | Special Topics | App Data |
26.2.2_step_02 | Special Topics | App Data |
27_stack-traces | Special Topics | Stack traces |
28_dependency-hell | Special Topics | Dependency hell |
A.E_mocks-snapshots | Appendix | Appendix E — Mocks and snapshots |