Browse Source

memcached

master
boB Rudis 6 years ago
parent
commit
ae08c110c2
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 5
      NAMESPACE
  2. 4
      NEWS.md
  3. 55
      R/memcached.R
  4. 5
      R/vershist-package.R
  5. 7
      README.Rmd
  6. 23
      README.md
  7. BIN
      README_cache/gfm/memcached_7ee3ec5e28bd4701eb680eba6fa9a05b.RData
  8. 0
      README_cache/gfm/memcached_7ee3ec5e28bd4701eb680eba6fa9a05b.rdb
  9. BIN
      README_cache/gfm/memcached_7ee3ec5e28bd4701eb680eba6fa9a05b.rdx
  10. 21
      man/memcached_version_history.Rd

5
NAMESPACE

@ -3,6 +3,7 @@
export(apache_httpd_version_history)
export(is_valid)
export(lighttpd_version_history)
export(memcached_version_history)
export(mongodb_version_history)
export(mysql_version_history)
export(nginx_version_history)
@ -24,11 +25,14 @@ importFrom(dplyr,rename)
importFrom(dplyr,select)
importFrom(gh,gh)
importFrom(gh,gh_next)
importFrom(git2r,clone)
importFrom(git2r,cred_ssh_key)
importFrom(httr,GET)
importFrom(httr,content)
importFrom(httr,user_agent)
importFrom(lubridate,mdy)
importFrom(lubridate,mdy_hms)
importFrom(lubridate,parse_date_time)
importFrom(lubridate,year)
importFrom(purrr,"%>%")
importFrom(purrr,discard)
@ -53,6 +57,7 @@ importFrom(stringi,stri_replace_first_regex)
importFrom(stringi,stri_split_fixed)
importFrom(stringi,stri_sub)
importFrom(stringi,stri_trans_tolower)
importFrom(stringi,stri_trim_both)
importFrom(tidyr,separate)
importFrom(utils,globalVariables)
importFrom(xml2,read_html)

4
NEWS.md

@ -1,4 +1,4 @@
0.1.0
* Initial release
* Support for Apache httpd, lighttpd, mongodb, nginx, mysql, openresty, openssh,
sendmail and sqlite
* Support for Apache httpd, lighttpd, memcached, mongodb, nginx, mysql, openresty,
openssh, sendmail and sqlite

55
R/memcached.R

@ -0,0 +1,55 @@
fix_memcached_dates <- function(x) {
x <- stri_replace_all_fixed(x, c("(", ")", "th", "rd", ","), "", vectorize_all = FALSE)
as.Date(lubridate::parse_date_time(x, c("ymd", "mdy")))
}
#' Retrieve memcached Version Release History
#'
#' Clones the `memcached` wiki and reads `ReleaseNotes.md` to build a data frame of
#' `memcached` version release numbers and dates with semantic version
#' strings parsed and separate fields added. The data frame is also arranged in
#' order from lowest version to latest version and the `vers` column is an
#' ordered factor. It uses [git2r::cred_ssh_key()] so you *must* have SSH keys
#' setup in order for this function to work.
#'
#' @md
#' @note This is an *expensive* function as it does quite a wiki clone.
#' Please consider using some sort of cache for the results unless
#' absolutely necessary.
#' @export
memcached_version_history <- function() {
td <- tempfile("wiki", fileext="git")
dir.create(td)
git2r::clone(
url = "git@github.com:memcached/memcached.wiki.git",
local_path = td,
credentials = git2r::cred_ssh_key(),
progress = FALSE
) -> repo
on.exit(unlink(td, recursive = TRUE), add = TRUE)
readr::read_lines(file.path(repo@path, "ReleaseNotes.md")) %>%
purrr::keep(stri_detect_fixed, "[[ReleaseNotes") %>%
stri_replace_first_regex(" \\* \\[\\[.*]] ", "") %>%
stri_split_fixed(" ", 2, simplify = TRUE) %>%
dplyr::as_data_frame() %>%
purrr::set_names(c("vers", "rls_date")) %>%
dplyr::mutate(string = stri_trim_both(vers)) %>%
dplyr::mutate(rls_date = fix_memcached_dates(rls_date)) %>%
dplyr::mutate(rls_year = lubridate::year(rls_date)) %>%
dplyr::bind_cols(
semver::parse_version(.$vers) %>%
dplyr::as_data_frame()
) %>%
dplyr::arrange(major, minor, patch) %>%
dplyr::mutate(vers = factor(vers, levels = vers))
}

5
R/vershist-package.R

@ -14,8 +14,8 @@
#' @importFrom stringi stri_match_first_regex stri_detect_fixed stri_detect_regex
#' @importFrom stringi stri_replace_all_regex stri_replace_first_fixed stri_trans_tolower
#' @importFrom stringi stri_extract_first_regex stri_sub stri_replace_first_regex
#' @importFrom stringi stri_replace_all_fixed stri_split_fixed stri_count_fixed
#' @importFrom lubridate year mdy mdy_hms
#' @importFrom stringi stri_replace_all_fixed stri_split_fixed stri_count_fixed stri_trim_both
#' @importFrom lubridate year mdy mdy_hms parse_date_time
#' @importFrom readr read_lines
#' @importFrom utils globalVariables
#' @importFrom xml2 read_html read_xml xml_attr
@ -24,6 +24,7 @@
#' @importFrom gh gh gh_next
#' @importFrom tidyr separate
#' @importFrom httr content GET user_agent
#' @importFrom git2r clone cred_ssh_key
#' @useDynLib vershist
#' @importFrom Rcpp sourceCpp
NULL

7
README.Rmd

@ -19,6 +19,7 @@ Core:
- `apache_httpd_version_history`: Retrieve Apache httpd Version Release History
- `lighttpd_version_history`: Retrieve lighttpd Version Release History
- `memcached_version_history`: Retrieve memcached Version Release History
- `mongodb_version_history`: Retrieve MongoDB Version Release History
- `mysql_version_history`: Retrieve MySQL Version Release History
- `nginx_version_history`: Retrieve nginx Version Release History
@ -62,6 +63,12 @@ lighttpd
lighttpd_version_history()
```
memcached
```{r memcached, cache=TRUE}
memcached_version_history()
```
mongodb
```{r mongodb, cache=TRUE}

23
README.md

@ -18,6 +18,8 @@ Core:
Release History
- `lighttpd_version_history`: Retrieve lighttpd Version Release
History
- `memcached_version_history`: Retrieve memcached Version Release
History
- `mongodb_version_history`: Retrieve MongoDB Version Release History
- `mysql_version_history`: Retrieve MySQL Version Release History
- `nginx_version_history`: Retrieve nginx Version Release History
@ -91,6 +93,27 @@ lighttpd_version_history()
## 10 1.4.30 2011-12-18 15:23:06 2011
## # ... with 87 more rows
memcached
``` r
memcached_version_history()
```
## # A tibble: 49 x 9
## vers rls_date string rls_year major minor patch prerelease build
## <fct> <date> <chr> <dbl> <int> <int> <int> <chr> <chr>
## 1 1.2.7 2009-04-03 1.2.7 2009. 1 2 7 "" ""
## 2 1.2.8 2009-04-11 1.2.8 2009. 1 2 8 "" ""
## 3 1.4.0 2009-07-09 1.4.0 2009. 1 4 0 "" ""
## 4 1.4.1 2009-08-29 1.4.1 2009. 1 4 1 "" ""
## 5 1.4.2 2009-10-11 1.4.2 2009. 1 4 2 "" ""
## 6 1.4.3 2009-11-07 1.4.3 2009. 1 4 3 "" ""
## 7 1.4.4 2009-11-26 1.4.4 2009. 1 4 4 "" ""
## 8 1.4.5 2010-04-03 1.4.5 2010. 1 4 5 "" ""
## 9 1.4.6 2011-07-15 1.4.6 2011. 1 4 6 "" ""
## 10 1.4.7 2011-08-16 1.4.7 2011. 1 4 7 "" ""
## # ... with 39 more rows
mongodb
``` r

BIN
README_cache/gfm/memcached_7ee3ec5e28bd4701eb680eba6fa9a05b.RData

Binary file not shown.

0
README_cache/gfm/memcached_7ee3ec5e28bd4701eb680eba6fa9a05b.rdb

BIN
README_cache/gfm/memcached_7ee3ec5e28bd4701eb680eba6fa9a05b.rdx

Binary file not shown.

21
man/memcached_version_history.Rd

@ -0,0 +1,21 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/memcached.R
\name{memcached_version_history}
\alias{memcached_version_history}
\title{Retrieve memcached Version Release History}
\usage{
memcached_version_history()
}
\description{
Clones the \code{memcached} wiki and reads \code{ReleaseNotes.md} to build a data frame of
\code{memcached} version release numbers and dates with semantic version
strings parsed and separate fields added. The data frame is also arranged in
order from lowest version to latest version and the \code{vers} column is an
ordered factor. It uses \code{\link[git2r:cred_ssh_key]{git2r::cred_ssh_key()}} so you \emph{must} have SSH keys
setup in order for this function to work.
}
\note{
This is an \emph{expensive} function as it does quite a wiki clone.
Please consider using some sort of cache for the results unless
absolutely necessary.
}
Loading…
Cancel
Save