~hrbrmstr/vershist

35bb3feefd271f53b8fbfc6cf3f935a690ce2b34 — boB Rudis 4 years ago 3ed9508
Added Tomcat
M DESCRIPTION => DESCRIPTION +2 -0
@@ 31,6 31,8 @@ Imports:
    utils,
    xml2,
    curl,
    git2r,
    httr,
    tidyr,
    gh,
    Rcpp

M NAMESPACE => NAMESPACE +2 -0
@@ 14,12 14,14 @@ export(openresty_version_history)
export(openssh_version_history)
export(sendmail_version_history)
export(sqlite_version_history)
export(tomcat_version_history)
import(semver)
importFrom(Rcpp,sourceCpp)
importFrom(curl,curl)
importFrom(dplyr,arrange)
importFrom(dplyr,as_data_frame)
importFrom(dplyr,bind_cols)
importFrom(dplyr,data_frame)
importFrom(dplyr,distinct)
importFrom(dplyr,left_join)
importFrom(dplyr,mutate)

A R/tomcat.R => R/tomcat.R +43 -0
@@ 0,0 1,43 @@
#' Retrieve Apache Tomcat Version Release History
#'
#' Scrapes <https://tomcat.apache.org/oldnews-2010.html> to build a data frame of
#' openresty version release numbers and dates with pesudo-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 alpha, beta and RCs are excluded. File an issue if these are needed.
#' @export
tomcat_version_history <- function() {

  xml2::read_html("https://tomcat.apache.org/oldnews-2010.html") %>%
    rvest::html_nodes("a[href*='oldnews']") %>%
    rvest::html_attr("href") %>%
    sprintf("https://tomcat.apache.org/%s", .) %>%
    purrr::map(read_html) %>%
    purrr::map_df(~{
      pg <- .x
      rls <- rvest::html_nodes(pg, "h3[id*='Tomcat'][id*='Released']:not([id*='Conn']):not([id*='Native']):not([id*='Maven']):not([id*='alpha']):not([id*='beta'])")
      dplyr::data_frame(
        vers = rvest::html_attr(rls, "id") %>%
          stri_replace_all_regex("^Tomcat_|_Released$", ""),
        rls_date = as.Date(rvest::html_nodes(rls, "span") %>%
                             rvest::html_text()),
        rls_year = lubridate::year(rls_date)
      )
    }) %>%
    tidyr::separate(vers, c("major", "minor", "patch"), remove=FALSE) %>%
    dplyr::mutate(build = ifelse(
      stri_detect_regex(patch, "[[:alpha:]]"),
      stri_extract_first_regex(patch, "[[:alpha:]]+[[:alnum:]]*"),
      ""
    )) %>%
    dplyr::mutate(patch = stri_replace_first_regex(patch, "[[:alpha:]]+[[:alnum:]]*", "")) %>%
    dplyr::mutate_at(.vars=c("major", "minor", "patch"), .funs=c(as.integer)) %>%
    dplyr::mutate(prerelease = "") %>%
    dplyr::arrange(major, minor, patch) %>%
    dplyr::mutate(vers = factor(vers, levels=vers)) %>%
    dplyr::select(vers, rls_date, rls_year, major, minor, patch, prerelease, build)

}
\ No newline at end of file

M R/vershist-package.R => R/vershist-package.R +1 -1
@@ 10,7 10,7 @@
#' @import semver
#' @importFrom purrr keep discard map map_df %>% safely set_names
#' @importFrom dplyr mutate rename select as_data_frame left_join bind_cols arrange
#' @importFrom dplyr rename progress_estimated mutate_at distinct
#' @importFrom dplyr rename progress_estimated mutate_at distinct data_frame
#' @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

M README.Rmd => README.Rmd +7 -0
@@ 31,6 31,7 @@ Core:
- `openssh_version_history`:	Retrieve OpenSSH Version Release History
- `sendmail_version_history`:	Retrieve sendmail Version Release History
- `sqlite_version_history`:	Retrieve sqlite Version Release History
- `tomcat_version_history`:	Retrieve Apache Tomcat Version Release History

Utility:



@@ 140,3 141,9 @@ sendmail
```{r sendmail, cache=TRUE}
sendmail_version_history()
```

Tomcat

```{r tomcat, cache=TRUE}
tomcat_version_history()
```

M README.md => README.md +23 -0
@@ 33,6 33,8 @@ Core:
  - `sendmail_version_history`: Retrieve sendmail Version Release
    History
  - `sqlite_version_history`: Retrieve sqlite Version Release History
  - `tomcat_version_history`: Retrieve Apache Tomcat Version Release
    History

Utility:



@@ 336,3 338,24 @@ sendmail_version_history()
    ## 14 8.14.9  2014-05-21     2014     8    14     9 ""         ""   
    ## 15 8.15.1  2014-12-06     2014     8    15     1 ""         ""   
    ## 16 8.15.2  2015-07-03     2015     8    15     2 ""         ""

Tomcat

``` r
tomcat_version_history()
```

    ## # A tibble: 131 x 8
    ##    vers   rls_date   rls_year major minor patch prerelease build
    ##    <fct>  <date>        <dbl> <int> <int> <int> <chr>      <chr>
    ##  1 5.5.32 2011-02-01    2011.     5     5    32 ""         ""   
    ##  2 5.5.33 2011-02-10    2011.     5     5    33 ""         ""   
    ##  3 5.5.34 2011-09-22    2011.     5     5    34 ""         ""   
    ##  4 5.5.35 2012-01-16    2012.     5     5    35 ""         ""   
    ##  5 5.5.36 2012-10-10    2012.     5     5    36 ""         ""   
    ##  6 6.0.30 2011-01-13    2011.     6     0    30 ""         ""   
    ##  7 6.0.32 2011-02-04    2011.     6     0    32 ""         ""   
    ##  8 6.0.33 2011-08-18    2011.     6     0    33 ""         ""   
    ##  9 6.0.35 2011-12-05    2011.     6     0    35 ""         ""   
    ## 10 6.0.36 2012-10-19    2012.     6     0    36 ""         ""   
    ## # ... with 121 more rows

A README_cache/gfm/tomcat_75e4b61804ba8a86f5d5cd4140d40324.RData => README_cache/gfm/tomcat_75e4b61804ba8a86f5d5cd4140d40324.RData +0 -0
A README_cache/gfm/tomcat_75e4b61804ba8a86f5d5cd4140d40324.rdb => README_cache/gfm/tomcat_75e4b61804ba8a86f5d5cd4140d40324.rdb +0 -0
A README_cache/gfm/tomcat_75e4b61804ba8a86f5d5cd4140d40324.rdx => README_cache/gfm/tomcat_75e4b61804ba8a86f5d5cd4140d40324.rdx +0 -0
A man/tomcat_version_history.Rd => man/tomcat_version_history.Rd +18 -0
@@ 0,0 1,18 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tomcat.R
\name{tomcat_version_history}
\alias{tomcat_version_history}
\title{Retrieve Apache Tomcat Version Release History}
\usage{
tomcat_version_history()
}
\description{
Scrapes \url{https://tomcat.apache.org/oldnews-2010.html} to build a data frame of
openresty version release numbers and dates with pesudo-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{
alpha, beta and RCs are excluded. File an issue if these are needed.
}