@@ 7,9 7,15 @@
#' ordered factor.
#'
#' @md
+#' @param refresh if `TRUE` and there `~/.vershist` cache dir exists, will
+#' cause the version history database for apache to be rebuilt. Defaults
+#' to `FALSE` and has no effect if `~/.vershist` cache dir does not exist.
#' @note This function requires a valid GitHub API key stored in `GITHUB_PAT`
#' @export
-openresty_version_history <- function() {
+openresty_version_history <- function(refresh = FALSE) {
+
+ tech <- "openresty"
+ if (use_cache() && (!refresh) && is_cached(tech)) return(read_from_cache(tech))
page <- gh::gh("/repos/openresty/openresty/tags")
@@ 52,6 58,11 @@ openresty_version_history <- function() {
dplyr::mutate_at(.vars=c("major", "minor", "patch", "build"), .funs=c(as.integer)) %>%
dplyr::arrange(major, minor, patch) %>%
dplyr::mutate(vers = factor(vers, levels=vers)) %>%
- dplyr::select(vers, rls_date, rls_year, major, minor, patch, prerelease, build)
+ dplyr::select(vers, rls_date, rls_year, major, minor, patch, prerelease, build) -> out
+
+
+ if (use_cache() && (refresh || (!is_cached(tech)))) write_to_cache(out, tech)
+
+ out
}=
\ No newline at end of file
@@ 4,7 4,12 @@
\alias{openresty_version_history}
\title{Retrieve openresty Version Release History}
\usage{
-openresty_version_history()
+openresty_version_history(refresh = FALSE)
+}
+\arguments{
+\item{refresh}{if \code{TRUE} and there \verb{~/.vershist} cache dir exists, will
+cause the version history database for apache to be rebuilt. Defaults
+to \code{FALSE} and has no effect if \verb{~/.vershist} cache dir does not exist.}
}
\description{
Reads \url{https://github.com/openresty/openresty/releases} to build a data frame of