From 0a2111a6fce8b6b6bea6607030ee5e1f7357733a Mon Sep 17 00:00:00 2001 From: wlandau Date: Wed, 20 Mar 2024 07:54:53 -0400 Subject: [PATCH] Fix #20 --- DESCRIPTION | 2 +- NEWS.md | 4 ++-- R/stan_package_compile.R | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index e1ccdb7..1f41e10 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,7 +11,7 @@ Description: Similar to 'rstantools' for 'rstan', migrate from 'rstan' to the more modern 'cmdstanr'. Packages 'rstantools', 'cmdstanr', 'stannis', and 'stanapi' are similar Stan clients with different objectives. -Version: 0.2.1.9000 +Version: 0.2.2 License: MIT + file LICENSE URL: https://wlandau.github.io/instantiate/, https://github.com/wlandau/instantiate diff --git a/NEWS.md b/NEWS.md index 55843cd..98e846a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ -# instantiate 0.2.1.9000 (development) - +# instantiate 0.2.2 +* Allow downstream packages to install even if `CmdStanR` is not installed (#20, @xinxinc476). # instantiate 0.2.1 diff --git a/R/stan_package_compile.R b/R/stan_package_compile.R index 8081dd8..d8b6e71 100644 --- a/R/stan_package_compile.R +++ b/R/stan_package_compile.R @@ -55,10 +55,13 @@ stan_package_compile <- function( threads = FALSE, ... ) { - stan_assert_cmdstanr() # Not possible to test in automated tests in one coverage run. # Covered in GitHub Actions workflows. # nocov start + result <- try(stan_assert_cmdstanr()) + if (inherits(result, "try-error")) { + return(invisible()) + } if (!stan_cmdstan_exists(cmdstan_install = cmdstan_install)) { stan_cmdstan_message() return(invisible())