diff --git a/docker/reprex/alpine.sh b/docker/reprex/alpine.sh index 9fa56c0..94806e5 100644 --- a/docker/reprex/alpine.sh +++ b/docker/reprex/alpine.sh @@ -1,5 +1,35 @@ docker run --rm -it --platform linux/arm64 alpine sh apk add --no-cache R R-dev g++ -install.packages('', repos = "cloud.r-project.org") + +R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/devel/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))' + +R -q -e 'pak::pak(c("gert", "purrr"))' + +R + +package_name <- "DoE.base" +gert::git_clone(sprintf("https://github.com/cran/%s", package_name), + path = sprintf("%s/%s", tempdir(), "tmp1"), + verbose = FALSE +) +# Retrieve all tags +all_tags <- gert::git_tag_list(repo = sprintf("%s/%s", tempdir(), "tmp1")) +# filter out tags that start with R- (= non-valid ones) +all_tags <- all_tags[!grepl("R-", all_tags$name), ] + +unlink(sprintf("%s/%s", tempdir(), "tmp1"), force = TRUE, recursive = TRUE) +tag <- all_tags$name +package_name <- rep(package_name, length(tag)) + +purrr::walk2(package_name[1], tag, \(x, y) { + print(y) + system("git config --global advice.detachedHead false") + system2("git", args = c( + "clone", "-q", sprintf("--branch=%s", tail(y, 1)), + sprintf("https://github.com/cran/%s", x[1]), sprintf("/tmp/%s_%s", x[1], y) + )) + pak::local_install_deps(sprintf("/tmp/%s_%s", x[1], y)) +}) +