diff --git a/update/ep_update.R b/update/ep_update.R index 12393f4..dffd232 100644 --- a/update/ep_update.R +++ b/update/ep_update.R @@ -30,15 +30,16 @@ upload_ep_data <- function(folder_path, version){ cli::cli_alert_success("Completed ep upload! {Sys.time()}") } -update_ep <- function(season, version = "v1.0.0"){ +update_ep <- function(season, version = "v1.0.0", folder_path){ try(piggyback::pb_new_release(repo = "ffverse/ffexpectedpoints", tag = "latest-data")) try(piggyback::pb_new_release(repo = "ffverse/ffexpectedpoints", tag = glue::glue("{version}-data"))) - dir.create("temp") - on.exit(unlink("temp",recursive = TRUE, force = TRUE)) - purrr::walk(season, save_ep_data, folder_path = "temp", version = version) + purrr::walk(season, save_ep_data, folder_path = folder_path, version = version) upload_ep_data(folder_path, version) invisible(NULL) } +temp <- tempdir() +update_ep(nflreadr:::most_recent_season(), version = "latest", folder_path = temp) +update_ep(nflreadr:::most_recent_season(), version = "v1.0.0", folder_path = temp) + +unlink(temp, recursive = TRUE, force = TRUE) -update_ep(nflreadr:::most_recent_season(), version = "latest") -update_ep(nflreadr:::most_recent_season(), version = "v1.0.0")