Skip to content

Commit fa77e11

Browse files
committed
doc: wrapping in if (interactive())
1 parent 8d85d6e commit fa77e11

File tree

8 files changed

+52
-63
lines changed

8 files changed

+52
-63
lines changed

R/add_dockerfiles.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,33 +52,33 @@ talk_once <- function(.f, msg = "") {
5252
#' @examples
5353
#' \donttest{
5454
#' # Add a standard Dockerfile
55-
#' if (interactive()) {
55+
#' if (interactive() & requireNamespace("dockerfiler")) {
5656
#' add_dockerfile()
5757
#' }
5858
#' # Crete a 'deploy' folder containing everything needed to deploy
5959
#' # the golem using docker based on {renv}
60-
#' if (interactive()) {
60+
#' if (interactive() & requireNamespace("dockerfiler")) {
6161
#' add_dockerfile_with_renv(
6262
#' # lockfile = "renv.lock", # uncomment to use existing renv.lock file
6363
#' output_dir = "deploy"
6464
#' )
6565
#' }
6666
#' # Add a Dockerfile for ShinyProxy
67-
#' if (interactive()) {
67+
#' if (interactive() & requireNamespace("dockerfiler")) {
6868
#' add_dockerfile_shinyproxy()
6969
#' }
7070
#'
7171
#' # Crete a 'deploy' folder containing everything needed to deploy
7272
#' # the golem with ShinyProxy using docker based on {renv}
73-
#' if (interactive()) {
73+
#' if (interactive() & requireNamespace("dockerfiler")) {
7474
#' add_dockerfile_with_renv(
7575
#' # lockfile = "renv.lock",# uncomment to use existing renv.lock file
7676
#' output_dir = "deploy"
7777
#' )
7878
#' }
7979
#'
8080
#' # Add a Dockerfile for Heroku
81-
#' if (interactive()) {
81+
#' if (interactive() & requireNamespace("dockerfiler")) {
8282
#' add_dockerfile_heroku()
8383
#' }
8484
#' }

R/add_r_files.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ add_r_files <- function(
6767
}
6868

6969
if (with_test) {
70-
check_is_installed("usethis")
7170
usethis::use_test(
7271
basename(
7372
file_path_sans_ext(

R/modules_fn.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ use_module_test <- function(
257257

258258
# We need both testthat, usethis & fs
259259
check_is_installed("testthat")
260-
check_is_installed("usethis")
261260
check_is_installed("fs")
262261

263262
old <- setwd(fs::path_abs(pkg))

R/test_helpers.R

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
#' @return A testthat result.
99
#' @export
1010
#' @rdname testhelpers
11-
#'
12-
#' @examples
13-
#' expect_shinytag(shiny::tags$span("1"))
1411
expect_shinytag <- function(object) {
1512
check_is_installed("testthat")
1613
check_is_installed("rlang")
@@ -25,8 +22,6 @@ expect_shinytag <- function(object) {
2522

2623
#' @export
2724
#' @rdname testhelpers
28-
#' @examples
29-
#' expect_shinytaglist(shiny::tagList(1))
3025
expect_shinytaglist <- function(object) {
3126
check_is_installed("testthat")
3227
check_is_installed("rlang")

R/with_opt.R

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -64,38 +64,38 @@ with_golem_options <- function(
6464
#' @return The value of the option.
6565
#'
6666
#' @examples
67-
#' \dontrun{
6867
#'
6968
#' # Define and use golem_options
69+
#' if (interactive()) {
70+
#' # 1. Pass parameters to `run_app`
7071
#'
71-
#' # 1. Pass parameters to `run_app`
72+
#' # to set default value, edit run_app like this :
7273
#'
73-
#' # to set default value, edit run_app like this :
74-
#' run_app <- function(
74+
#' run_app <- function(
7575
#' title = "this",
7676
#' content = "that"
77-
#' ) {
78-
#' with_golem_options(
79-
#' app = shinyApp(
80-
#' ui = app_ui,
81-
#' server = app_server
82-
#' ),
83-
#' golem_opts = list(
84-
#' p1 = p1,
85-
#' p3 = p3
77+
#' ) {
78+
#' with_golem_options(
79+
#' app = shinyApp(
80+
#' ui = app_ui,
81+
#' server = app_server
82+
#' ),
83+
#' golem_opts = list(
84+
#' p1 = p1,
85+
#' p3 = p3
86+
#' )
8687
#' )
87-
#' )
88-
#' }
88+
#' }
8989
#'
90-
#' # 2. Get the values from the UI side
90+
#' # 2. Get the values from the UI side
9191
#'
92-
#' h1(get_golem_options("title"))
92+
#' h1(get_golem_options("title"))
9393
#'
94-
#' # 3. Get the value from the server-side
94+
#' # 3. Get the value from the server-side
9595
#'
96-
#' output$param <- renderPrint({
97-
#' paste("param p2 = ", get_golem_options("p2"))
98-
#' })
96+
#' output$param <- renderPrint({
97+
#' paste("param p2 = ", get_golem_options("p2"))
98+
#' })
9999
#' }
100100
#'
101101
get_golem_options <- function(which = NULL) {

man/dockerfiles.Rd

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/get_golem_options.Rd

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/testhelpers.Rd

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)