From cc2adcf1c5ccf624b78da4bdb237ad86c4a2c22a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98topepo=E2=80=99?= <‘mxkuhn@gmail.com’> Date: Wed, 17 Jul 2024 21:02:20 -0400 Subject: [PATCH] conditionally use whoami --- DESCRIPTION | 2 +- R/new-blog-post.R | 1 + tests/testthat/test-new-blog-post.R | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index e97d593..f89a5be 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,7 +27,6 @@ Imports: rstudioapi, tools, utils, - whoami, yaml Suggests: curl, @@ -35,6 +34,7 @@ Suggests: rsconnect (>= 0.8.26), testthat (>= 3.1.7), withr, + whoami, xfun VignetteBuilder: quarto diff --git a/R/new-blog-post.R b/R/new-blog-post.R index ed40ed4..058e554 100644 --- a/R/new-blog-post.R +++ b/R/new-blog-post.R @@ -23,6 +23,7 @@ #' new_blog_post <- function(title, dest = NULL, open = rlang::is_interactive(), call = rlang::current_env(), ...) { + rlang::check_installed("whoami") if (is.null(dest)) { # Scrub title to make directory name diff --git a/tests/testthat/test-new-blog-post.R b/tests/testthat/test-new-blog-post.R index 93a9b46..d805e2e 100644 --- a/tests/testthat/test-new-blog-post.R +++ b/tests/testthat/test-new-blog-post.R @@ -1,5 +1,6 @@ test_that("Create a blog post", { skip_if_no_quarto("1.4") + skip_if_not_installed("whoami") current_dir <- getwd()