Skip to content

Commit

Permalink
default_eval()
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Jul 21, 2022
1 parent 27ce279 commit b96f172
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion vignettes/setup/setup.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
default_eval <- function() {
# Only build vignettes in pkgdown for now
(Sys.getenv("IN_PKGDOWN") != "") || grepl("^cran-", Sys.getenv("GITHUB_HEAD_REF"))
}

knitr::opts_chunk$set(
error = (Sys.getenv("IN_PKGDOWN") == "") || !dm:::dm_has_financial(),
# Only build vignettes:
# - on pkgdown
# - if not running in GitHub Actions
# - if running in a branch that starts with CRAN in GitHub Actions
eval = (Sys.getenv("IN_PKGDOWN") != "") || (Sys.getenv("GITHUB_WORKFLOW") == "") || grepl("^cran-", Sys.getenv("GITHUB_HEAD_REF")),
eval = default_eval(),
message = TRUE,
collapse = TRUE,
comment = "#>"
Expand Down
2 changes: 1 addition & 1 deletion vignettes/tech-dm-draw.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ flights_dm_w_many_keys_and_colors %>%

Finally, for exporting a drawing to `svg` you could use `DiagrammeRsvg::export_svg()`:

```{r eval = rlang::is_installed("DiagrammeRsvg")}
```{r eval = default_eval() && rlang::is_installed("DiagrammeRsvg")}
flights_dm_w_many_keys_and_colors %>%
dm_select_tbl(flights, airports, planes) %>%
dm_draw() %>%
Expand Down

0 comments on commit b96f172

Please sign in to comment.