From c8f31c781de095e23ae31914450b98bc78e28342 Mon Sep 17 00:00:00 2001 From: vincent guyader Date: Fri, 6 Jun 2025 14:37:12 +0200 Subject: [PATCH 1/3] fix: ensure path exists in set_gitlab_ci --- R/set_gitlab_ci.R | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/R/set_gitlab_ci.R b/R/set_gitlab_ci.R index ee9d9a5..85a453e 100644 --- a/R/set_gitlab_ci.R +++ b/R/set_gitlab_ci.R @@ -29,6 +29,14 @@ set_gitlab_ci <- function(path) { } } + # Create the destination directory if it doesn't exist + if (!dir.exists(path)) { + dir.create(path, recursive = TRUE, showWarnings = FALSE) + cli::cli_alert_success("Directory created: {path}") + } else { + cli::cli_alert_info("Directory already exists: {path}") + } + cli::cli_alert_info("Copying .gitlab-ci.yml file to: {path}") # Retrieve the source file from the shiny2docker package From 5b41098dbdc4711555e0ceb687abdeb138050828 Mon Sep 17 00:00:00 2001 From: vincent guyader Date: Fri, 6 Jun 2025 14:38:44 +0200 Subject: [PATCH 2/3] Update set_gitlab_ci.R --- R/set_gitlab_ci.R | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/R/set_gitlab_ci.R b/R/set_gitlab_ci.R index 85a453e..6562ab6 100644 --- a/R/set_gitlab_ci.R +++ b/R/set_gitlab_ci.R @@ -33,9 +33,7 @@ set_gitlab_ci <- function(path) { if (!dir.exists(path)) { dir.create(path, recursive = TRUE, showWarnings = FALSE) cli::cli_alert_success("Directory created: {path}") - } else { - cli::cli_alert_info("Directory already exists: {path}") - } + } cli::cli_alert_info("Copying .gitlab-ci.yml file to: {path}") From 0cdb0f02c68148cf2310634a6f44bb58954eb258 Mon Sep 17 00:00:00 2001 From: vincent guyader Date: Fri, 6 Jun 2025 14:53:54 +0200 Subject: [PATCH 3/3] Update R/set_gitlab_ci.R Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- R/set_gitlab_ci.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/set_gitlab_ci.R b/R/set_gitlab_ci.R index 6562ab6..4662e21 100644 --- a/R/set_gitlab_ci.R +++ b/R/set_gitlab_ci.R @@ -31,7 +31,11 @@ set_gitlab_ci <- function(path) { # Create the destination directory if it doesn't exist if (!dir.exists(path)) { - dir.create(path, recursive = TRUE, showWarnings = FALSE) + success <- dir.create(path, recursive = TRUE, showWarnings = FALSE) + if (!isTRUE(success)) { + cli::cli_alert_danger("Failed to create directory: {path}") + stop("Directory creation failed. Please check the path and permissions.") + } cli::cli_alert_success("Directory created: {path}") }