Skip to content

Commit

Permalink
Update ep_update.R
Browse files Browse the repository at this point in the history
  • Loading branch information
tanho63 authored Jan 17, 2022
1 parent 6929e2a commit 95ed6c7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions update/ep_update.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit 95ed6c7

Please sign in to comment.