|
1 | | -#' Run learnr tutorials from the BioDataScience1 package |
| 1 | +#' Run learnr tutorials, Shiny applications from the BioDataScience1 package, or |
| 2 | +#' update it |
| 3 | +#' |
| 4 | +#' Start a learnr tutorial or a Shiny application from the BioDataScience1 |
| 5 | +#' package, possibly after updating it. |
2 | 6 | #' |
3 | 7 | #' @param tutorial The name of the tutorial to use. If not provided, a list of |
4 | 8 | #' available tutorials is displayed. |
5 | | -#' @param ... Further arguments passed to `learnr::run_tutorial()`. |
| 9 | +#' @param app The name of the Shiny application to use. If not provided, a list |
| 10 | +#' of available applications is displayed. |
| 11 | +#' @param ... Further arguments passed to `learnr::run_tutorial()` or to |
| 12 | +#' `shiny::runApp()`. |
6 | 13 | #' @param update Do we check for an updated version first, and if it is found, |
7 | 14 | #' update the package automatically? |
8 | | -#' @param ask In case `tutorial` is not provided, do we ask to select in a list? |
9 | | -#' |
10 | | -#' @description Start the learnr R engine in the current R session with the |
11 | | -#' selected tutorial. |
| 15 | +#' @param ask In case `tutorial` or `app` is not provided, do we ask to select |
| 16 | +#' in a list? |
| 17 | +#' @param in.job Should the application be run in a Job in RStudio (`TRUE` by |
| 18 | +#' default)? |
12 | 19 | #' |
13 | | -#' @return If `tutorial` is not provided, in interactive mode with `ask = TRUE`, |
14 | | -#' you have to select one in a list, and in non interactive mode, or |
15 | | -#' `ask = FALSE`, it returns the list of all available tutorials. |
| 20 | +#' @return If `tutorial` or `app` is not provided, in interactive mode with |
| 21 | +#' `ask = TRUE`, you have to select one in a list, and in non interactive mode, |
| 22 | +#' or `ask = FALSE`, it returns the list of all available tutorials or Shiny |
| 23 | +#' applications in the BioDataScience1 package. |
16 | 24 | #' @export |
17 | 25 | #' @keywords utilities |
18 | | -#' @concept run interactive learnr documents from the BioDataScience package |
| 26 | +#' @concept run interactive learnr or Shiny applications |
19 | 27 | #' @examples |
| 28 | +#' \dontrun{ |
20 | 29 | #' # To start from a list of available tutorials: |
21 | 30 | #' run() |
22 | | -#' \dontrun{ |
23 | | -#' run("00a_learnr") |
| 31 | +#' # Idem for Shiny applications: |
| 32 | +#' run_app() |
24 | 33 | #' } |
25 | 34 | run <- function(tutorial, ..., update = ask, ask = interactive()) { |
26 | | - #BioDataScience::init() |
27 | 35 | if (missing(tutorial)) |
28 | 36 | tutorial <- NULL |
29 | 37 | learndown::run(tutorial = tutorial, package = "BioDataScience1", |
30 | | - repos = "BioDataScience-course/BioDataScience1", ..., update = update, |
31 | | - ask = ask) |
| 38 | + github_repos = "BioDataScience-course/BioDataScience1", |
| 39 | + ..., update = update, ask = ask) |
32 | 40 | } |
| 41 | + |
| 42 | +#' @rdname run |
| 43 | +#' @export |
| 44 | +run_app <- function(app, ..., update = ask, ask = interactive(), |
| 45 | +in.job = TRUE) { |
| 46 | + if (missing(app)) |
| 47 | + app <- NULL |
| 48 | + learndown::run_app(app = app, package = "BioDataScience1", |
| 49 | + github_repos = "BioDataScience-course/BioDataScience1", |
| 50 | + ..., update = update, ask = ask, in.job = in.job) |
| 51 | +} |
| 52 | + |
| 53 | +#' @rdname run |
| 54 | +#' @export |
| 55 | +update_pkg <- function() |
| 56 | + learndown::update_pkg(package = "BioDataScience1", |
| 57 | + github_repos = "BioDataScience-course/BioDataScience1") |
0 commit comments