This function detects whether the current R environment is a
CRAN machine or not. It returns FALSE
if the NOT_CRAN
environment
variable used in "github/r-lib" packages like devtools and
testthat is set to "true". If that variable is not set, the function
examines other environment variables typically set on CRAN machines, as
documented in the issue on this packages' GitHub repository at
https://github.com/briandconnelly/ami/issues/14.
Examples
on_cran()
#> [1] FALSE
withr::with_envvar(
list("NOT_CRAN" = "false", "_R_1" = 1, "_R_2" = 2),
on_cran(n_cran_envvars = 2L)
)
#> [1] TRUE