~hrbrmstr/vershist

205189550fe60ba30cbe54c0884c95b8cf1f0092 — boB Rudis 4 years ago e23a8ad
openssh
M NAMESPACE => NAMESPACE +2 -0
@@ 7,6 7,7 @@ export(mongodb_version_history)
export(mysql_version_history)
export(nginx_version_history)
export(openresty_version_history)
export(openssh_version_history)
export(sendmail_version_history)
export(sqlite_version_history)
import(semver)


@@ 40,6 41,7 @@ importFrom(readr,read_lines)
importFrom(rvest,html_nodes)
importFrom(rvest,html_text)
importFrom(rvest,xml_nodes)
importFrom(stringi,stri_count_fixed)
importFrom(stringi,stri_detect_fixed)
importFrom(stringi,stri_detect_regex)
importFrom(stringi,stri_extract_first_regex)

M NEWS.md => NEWS.md +2 -1
@@ 1,3 1,4 @@
0.1.0 
* Initial release
* Support for Apache httpd, lighttpd, mongodb, nginx, mysql, openresty, sendmail and sqlite
\ No newline at end of file
* Support for Apache httpd, lighttpd, mongodb, nginx, mysql, openresty, openssh,
  sendmail and sqlite
\ No newline at end of file

A R/openssh.R => R/openssh.R +44 -0
@@ 0,0 1,44 @@
#' Retrieve OpenSSH (non-portable) Version Release History
#'
#' Reads <https://www.openssh.com/releasenotes.html> to build a data frame of
#' OpenSSH (non-portable) 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 File an issue or PR if the "portable" equivalent is needed
#' @export
openssh_version_history <- function() {

  pg <- xml2::read_html("https://www.openssh.com/releasenotes.html")

  dplyr::data_frame(

    vers = rvest::html_nodes(
      pg, xpath=".//h3/a[contains(@href, 'release') and not(contains(@name, 'p'))]"
    ) %>%
      rvest::html_attr("name"),

    rls_date = rvest::html_nodes(
      pg, xpath=".//h3/a[contains(@href, 'release') and not(contains(@name, 'p'))]/.."
    ) %>%
      rvest::html_text() %>%
      stri_extract_first_regex("[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}")

  ) %>%
    dplyr::filter(!is.na(rls_date)) %>% # 3.8.1p1 is portable only and we grab non-p
    dplyr::mutate(rls_date = as.Date(rls_date)) %>%
    dplyr::mutate(rls_year = lubridate::year(rls_date)) %>%
    dplyr::mutate(
      vers = ifelse(stri_count_fixed(vers, ".") == 1, sprintf("%s.0", vers), vers)
    ) %>%
    dplyr::bind_cols(
      semver::parse_version(.$vers) %>%
        dplyr::as_data_frame()
    ) %>%
    dplyr::arrange(major, minor, patch) %>%
    dplyr::mutate(vers = factor(vers, levels = vers))

}


M R/vershist-package.R => R/vershist-package.R +1 -1
@@ 14,7 14,7 @@
#' @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
#' @importFrom stringi stri_replace_all_fixed stri_split_fixed stri_count_fixed
#' @importFrom lubridate year mdy mdy_hms
#' @importFrom readr read_lines
#' @importFrom utils globalVariables

M README.Rmd => README.Rmd +7 -0
@@ 23,6 23,7 @@ Core:
- `mysql_version_history`:	Retrieve MySQL Version Release History
- `nginx_version_history`:	Retrieve nginx Version Release History
- `openresty_version_history`:	Retrieve openresty Version Release History
- `openssh_version_history`:	Retrieve OpenSSH Version Release History
- `sendmail_version_history`:	Retrieve sendmail Version Release History
- `sqlite_version_history`:	Retrieve sqlite Version Release History



@@ 85,6 86,12 @@ openresty
openresty_version_history()
```

OpenSSH

```{r openssh, cache=TRUE}
openssh_version_history()
```

SQLite

```{r sqlite, cache=TRUE}

M README.md => README.md +22 -0
@@ 23,6 23,7 @@ Core:
  - `nginx_version_history`: Retrieve nginx Version Release History
  - `openresty_version_history`: Retrieve openresty Version Release
    History
  - `openssh_version_history`: Retrieve OpenSSH Version Release History
  - `sendmail_version_history`: Retrieve sendmail Version Release
    History
  - `sqlite_version_history`: Retrieve sqlite Version Release History


@@ 174,6 175,27 @@ openresty_version_history()
    ## 10 1.0.5.1  2011-09-04     2011     1     0     5 ""             1
    ## # ... with 143 more rows

OpenSSH

``` r
openssh_version_history()
```

    ## # A tibble: 54 x 8
    ##    vers  rls_date   rls_year major minor patch prerelease build
    ##    <fct> <date>        <dbl> <int> <int> <int> <chr>      <chr>
    ##  1 2.9.0 2001-04-29    2001.     2     9     0 ""         ""   
    ##  2 2.9.9 2001-09-25    2001.     2     9     9 ""         ""   
    ##  3 3.0.0 2001-11-06    2001.     3     0     0 ""         ""   
    ##  4 3.0.1 2001-11-19    2001.     3     0     1 ""         ""   
    ##  5 3.0.2 2002-12-04    2002.     3     0     2 ""         ""   
    ##  6 3.1.0 2004-04-09    2004.     3     1     0 ""         ""   
    ##  7 3.2.2 2002-05-16    2002.     3     2     2 ""         ""   
    ##  8 3.2.3 2002-05-23    2002.     3     2     3 ""         ""   
    ##  9 3.3.0 2002-06-21    2002.     3     3     0 ""         ""   
    ## 10 3.4.0 2002-06-26    2002.     3     4     0 ""         ""   
    ## # ... with 44 more rows

SQLite

``` r

A README_cache/gfm/openssh_9fa675ad5752675b7c64af74834210e0.RData => README_cache/gfm/openssh_9fa675ad5752675b7c64af74834210e0.RData +0 -0
A README_cache/gfm/openssh_9fa675ad5752675b7c64af74834210e0.rdb => README_cache/gfm/openssh_9fa675ad5752675b7c64af74834210e0.rdb +0 -0
A README_cache/gfm/openssh_9fa675ad5752675b7c64af74834210e0.rdx => README_cache/gfm/openssh_9fa675ad5752675b7c64af74834210e0.rdx +0 -0
A man/openssh_version_history.Rd => man/openssh_version_history.Rd +18 -0
@@ 0,0 1,18 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/openssh.R
\name{openssh_version_history}
\alias{openssh_version_history}
\title{Retrieve OpenSSH (non-portable) Version Release History}
\usage{
openssh_version_history()
}
\description{
Reads \url{https://www.openssh.com/releasenotes.html} to build a data frame of
OpenSSH (non-portable) 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{
File an issue or PR if the "portable" equivalent is needed
}