Browse Source

added etcd version history

master
boB Rudis 5 years ago
parent
commit
37a8e5ff9d
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 8
      DESCRIPTION
  2. 1
      NAMESPACE
  3. 3
      NEWS.md
  4. 61
      R/etcd.R
  5. 7
      README.Rmd
  6. 24
      README.md
  7. BIN
      README_cache/gfm/etcd_d62ecf38e5c2f6bab5a807abae636373.RData
  8. 0
      README_cache/gfm/etcd_d62ecf38e5c2f6bab5a807abae636373.rdb
  9. BIN
      README_cache/gfm/etcd_d62ecf38e5c2f6bab5a807abae636373.rdx
  10. 18
      man/etcd_version_history.Rd

8
DESCRIPTION

@ -1,8 +1,8 @@
Package: vershist
Type: Package
Title: Collect Version Histories For Vendor Products
Version: 0.2.0
Date: 2018-12-19
Version: 0.2.1
Date: 2019-01-14
Authors@R: c(
person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-5670-2640"))
@ -10,8 +10,8 @@ Authors@R: c(
Maintainer: Bob Rudis <bob@rud.is>
Description: Provides a set of functions to gather version histories of products
(mainly software products) from their sources (generally websites).
URL: https://github.com/hrbrmstr/vershist
BugReports: https://github.com/hrbrmstr/vershist/issues
URL: https://gitlab.com/hrbrmstr/vershist
BugReports: https://gitlab.com/hrbrmstr/vershist/issues
SystemRequirements: C++11
Encoding: UTF-8
License: AGPL

1
NAMESPACE

@ -3,6 +3,7 @@
export(apache_httpd_version_history)
export(apple_ios_version_history)
export(complete_semver)
export(etcd_version_history)
export(google_chrome_version_history)
export(is_valid_semver)
export(lighttpd_version_history)

3
NEWS.md

@ -1,3 +1,6 @@
0.2.1
* Support for etcd
0.2.0
* Support for PHP

61
R/etcd.R

@ -0,0 +1,61 @@
#' Retrieve etcd Version Release History
#'
#' Reads <https://github.com/etcd-io/etcd/releases> to build a data frame of
#' etcd 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.
#'
#' @md
#' @note This function requires a valid GitHub API key stored in `GITHUB_PAT`
#' @export
etcd_version_history <- function() {
page <- gh::gh("/repos/etcd-io/etcd/tags")
purrr::map_df(
page, ~{
list(
vers = .x$name,
rls_date = gh::gh(.x$commit$url)$commit$author$date # kinda dangerous
)
}) -> xdf
sgh_next <- purrr::safely(gh::gh_next) # to stop on gh_next() error
while(TRUE) {
page <- sgh_next(page)
if (is.null(page$result)) break;
page <- page$result
dplyr::bind_rows(
xdf,
purrr::map_df(
page, ~{
list(
vers = .x$name,
rls_date = gh::gh(.x$commit$url)$commit$author$date # kinda dangerous
)
})
) -> xdf
}
suppressWarnings(
suppressMessages(
dplyr::mutate(xdf, vers = stri_replace_first_fixed(vers, "v", "")) %>%
dplyr::mutate(rls_date = as.Date(stri_sub(rls_date, 1, 10))) %>%
dplyr::mutate(rls_year = lubridate::year(rls_date)) %>%
tidyr::separate(vers, c("major", "minor", "patch", "build"), remove=FALSE) %>%
dplyr::mutate(prerelease = ifelse(
stri_detect_regex(build, "[[:alpha:]]"),
stri_extract_first_regex(build, "[[:alpha:]][[:alnum:]]+"),
""
)) %>%
dplyr::mutate(build = stri_replace_first_regex(build, "[[:alpha:]][[:alnum:]]+", "")) %>%
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)
)
)
}

7
README.Rmd

@ -21,6 +21,7 @@ Core:
- `apache_httpd_version_history`: Retrieve Apache httpd Version Release History
- `apple_ios_version_history`: Retrieve Apple iOS Version Release History
- `etcd_version_history`: Retrieve etcd Version Release History
- `google_chrome_version_history`: Retrieve Google Chrome Version Release History
- `lighttpd_version_history`: Retrieve lighttpd Version Release History
- `memcached_version_history`: Retrieve memcached Version Release History
@ -83,6 +84,12 @@ Apple iOS
apple_ios_version_history()
```
etcd iOS
```{r etcd, cache=TRUE}
etcd_version_history()
```
Google Chrome
```{r chrome, cache=TRUE}

24
README.md

@ -18,6 +18,7 @@ Core:
Release History
- `apple_ios_version_history`: Retrieve Apple iOS Version Release
History
- `etcd_version_history`: Retrieve etcd Version Release History
- `google_chrome_version_history`: Retrieve Google Chrome Version
Release History
- `lighttpd_version_history`: Retrieve lighttpd Version Release
@ -58,7 +59,7 @@ library(vershist)
packageVersion("vershist")
```
## [1] '0.2.0'
## [1] '0.2.1'
Utility
@ -125,6 +126,27 @@ apple_ios_version_history()
## 10 2.0.0 2008-07-11 2 0 0 "" ""
## # ... with 102 more rows
etcd iOS
``` r
etcd_version_history()
```
## # A tibble: 159 x 8
## vers rls_date rls_year major minor patch prerelease build
## <fct> <date> <dbl> <int> <int> <int> <chr> <int>
## 1 0.1.0 2013-08-11 2013 0 1 0 <NA> NA
## 2 0.1.1 2013-08-19 2013 0 1 1 <NA> NA
## 3 0.1.2 2013-10-10 2013 0 1 2 <NA> NA
## 4 0.2.0 2013-12-23 2013 0 2 0 <NA> NA
## 5 0.2.0-rc4 2013-12-23 2013 0 2 0 rc4 NA
## 6 0.2.0-rc3 2013-12-16 2013 0 2 0 rc3 NA
## 7 0.2.0-rc2 2013-12-06 2013 0 2 0 rc2 NA
## 8 0.2.0-rc1 2013-11-14 2013 0 2 0 rc1 NA
## 9 0.2.0-rc0 2013-10-17 2013 0 2 0 rc0 NA
## 10 0.3.0 2014-02-07 2014 0 3 0 <NA> NA
## # … with 149 more rows
Google Chrome
``` r

BIN
README_cache/gfm/etcd_d62ecf38e5c2f6bab5a807abae636373.RData

Binary file not shown.

0
README_cache/gfm/etcd_d62ecf38e5c2f6bab5a807abae636373.rdb

BIN
README_cache/gfm/etcd_d62ecf38e5c2f6bab5a807abae636373.rdx

Binary file not shown.

18
man/etcd_version_history.Rd

@ -0,0 +1,18 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/etcd.R
\name{etcd_version_history}
\alias{etcd_version_history}
\title{Retrieve etcd Version Release History}
\usage{
etcd_version_history()
}
\description{
Reads \url{https://github.com/etcd-io/etcd/releases} to build a data frame of
etcd 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.
}
\note{
This function requires a valid GitHub API key stored in \code{GITHUB_PAT}
}
Loading…
Cancel
Save