diff --git a/R/publish.R b/R/publish.R index 4193a6ce0..816ad274e 100644 --- a/R/publish.R +++ b/R/publish.R @@ -31,8 +31,19 @@ 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")) { + msg = 'The RCurl package is not installed but required for Connect Cloud auth flow.' + if (readline( + paste0(msg, '\nDo you want to install RCurl now? (y/n) ')) == 'y') { + install.packages('RCurl') + } else { + stop(msg, ' Please install the RCurl package. Then run rsconnect::connectCloudUser().') + } + } rsconnect::connectCloudUser() + } } # deploy the book