From a9caaed2fb085ca976d3717efcf30d3739b6c887 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Tue, 2 Dec 2025 17:38:26 +0100 Subject: [PATCH 1/2] Offer to install RCurl if we detect this is missing but needed due to https://github.com/rstudio/rsconnect/issues/1265 and https://github.com/rstudio/rsconnect/pull/1266 --- R/publish.R | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/R/publish.R b/R/publish.R index 4193a6ce0..9b4777579 100644 --- a/R/publish.R +++ b/R/publish.R @@ -31,8 +31,21 @@ publish_book = function(name = NULL, ...) { # if no accounts other than shinyapps.io and bookdown.org have been set up on # this machine, offer to add one for connect.posit.cloud if (length(setdiff(accounts$server, c('shinyapps.io', 'bookdown.org'))) == 0) { - if (readline('Do you want to connect to connect.posit.cloud? (y/n)') == 'y') + if (readline('Do you want to connect to connect.posit.cloud? (y/n)') == 'y') { + # due to https://github.com/rstudio/rsconnect/pull/1266 we need to install RCurl for rsconnect <= 1.6.2 + if (!xfun::pkg_available("rsconnect", "1.6.3") && !xfun::pkg_available("RCurl")) { + if (readline( + paste0('The rsconnect package version is below 1.6.3 and the RCurl package is not installed but is required for Connect Cloud auth flow.\n', + 'Do you want to install RCurl now? (y/n) ' + )) == 'y') { + install.packages('RCurl') + } else { + stop('The rsconnect package version is below 1.6.3 and the RCurl package is not installed but is required for Connect Cloud auth flow. Please install RCurl package first.', + 'Then retry or run `rsconnect::connectCloudUser()`', call. = FALSE) + } + } rsconnect::connectCloudUser() + } } # deploy the book From 2eebd5d18b5a47d68a807384c53c0faa09c8e68b Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Thu, 4 Dec 2025 20:43:04 -0600 Subject: [PATCH 2/2] tweak message --- R/publish.R | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/R/publish.R b/R/publish.R index 9b4777579..816ad274e 100644 --- a/R/publish.R +++ b/R/publish.R @@ -34,14 +34,12 @@ publish_book = function(name = NULL, ...) { if (readline('Do you want to connect to connect.posit.cloud? (y/n)') == 'y') { # due to https://github.com/rstudio/rsconnect/pull/1266 we need to install RCurl for rsconnect <= 1.6.2 if (!xfun::pkg_available("rsconnect", "1.6.3") && !xfun::pkg_available("RCurl")) { + msg = 'The RCurl package is not installed but required for Connect Cloud auth flow.' if (readline( - paste0('The rsconnect package version is below 1.6.3 and the RCurl package is not installed but is required for Connect Cloud auth flow.\n', - 'Do you want to install RCurl now? (y/n) ' - )) == 'y') { + paste0(msg, '\nDo you want to install RCurl now? (y/n) ')) == 'y') { install.packages('RCurl') } else { - stop('The rsconnect package version is below 1.6.3 and the RCurl package is not installed but is required for Connect Cloud auth flow. Please install RCurl package first.', - 'Then retry or run `rsconnect::connectCloudUser()`', call. = FALSE) + stop(msg, ' Please install the RCurl package. Then run rsconnect::connectCloudUser().') } } rsconnect::connectCloudUser()