#' @export
install <- function(install_local = FALSE, force = FALSE) {
if(install_local) {
cmdstanr::install_cmdstan(overwrite = TRUE)
}
if(!force) {
if(is_latest_version()) {
stop("Cloudstan CLI already the latest version.")
}
}
message("* Preparing Cloudstan user directory")
dir <- default_path()
if (!dir.exists(dir)) {
dir.create(dir, recursive = TRUE)
}
checkmate::assert_directory_exists(dir, access = "rwx")
current_os <- get_os()
if (current_os == "windows") {
current_os <- paste0(current_os, ".exe")
}
release_url <- cloudstan_url(paste0("/bins/cloudstan-", current_os))
dest_dir <- paste0(dir, "/bin")
if (!dir.exists(dest_dir)) {
dir.create(dest_dir, recursive = TRUE)
}
checkmate::assert_directory_exists(dir, access = "rwx")
dest_file <- bin_path()
message("* Downloading latest Cloudstan CLI from ", release_url)
downloaded <- download_with_retries(release_url, dest_file)
if(!downloaded) {
stop("Download of Cloudstan CLI failed. Please try again.", call. = FALSE)
}
Sys.chmod(dest_file, 0755, use_umask = FALSE)
message("* Download complete! You can start using Cloudstan CLI.")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.