~hrbrmstr/vershist

65ebf80625e20c35f9f3ccc607035324f9d897a0 — hrbrmstr 3 years ago 35bb3fe
Support for PHP
M DESCRIPTION => DESCRIPTION +3 -3
@@ 1,8 1,8 @@
Package: vershist
Type: Package
Title: Collect Version Histories For Vendor Products
Version: 0.1.0
Date: 2018-03-20
Version: 0.2.0
Date: 2018-12-19
Authors@R: c(
    person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"), 
           comment = c(ORCID = "0000-0001-5670-2640"))


@@ 36,5 36,5 @@ Imports:
    tidyr,
    gh,
    Rcpp
RoxygenNote: 6.0.1.9000
RoxygenNote: 6.1.1
LinkingTo: Rcpp

M NAMESPACE => NAMESPACE +1 -0
@@ 12,6 12,7 @@ export(mysql_version_history)
export(nginx_version_history)
export(openresty_version_history)
export(openssh_version_history)
export(php_version_history)
export(sendmail_version_history)
export(sqlite_version_history)
export(tomcat_version_history)

M NEWS.md => NEWS.md +3 -0
@@ 1,3 1,6 @@
0.2.0
* Support for PHP

0.1.0 
* Initial release
* Support for Apache httpd, Apple iOS, Google Chrome lighttpd, memcached, mongodb, nginx, 

A R/php.R => R/php.R +36 -0
@@ 0,0 1,36 @@
#' Retrieve PHP Version Release History
#'
#' Reads <https://secure.php.net/releases/> to build a data frame of PHP 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
#' @export
php_version_history <- function() {

  php_changes_url <- "https://secure.php.net/releases/"

  doc <- suppressWarnings(xml2::read_html(php_changes_url))

  rls <- html_nodes(doc, xpath = ".//h2/following-sibling::ul")

  dplyr::data_frame(
    vers = rvest::html_nodes(rls, xpath=".//preceding-sibling::h2") %>%
      rvest::html_text(trim=TRUE) %>%
      stringi::stri_replace_all_fixed("x", 0),
    ts = rvest::html_nodes(rls, xpath=".//li[contains(., 'Released:')]") %>%
      rvest::html_text(trim=TRUE) %>%
      stringi::stri_replace_first_fixed("Released: ", "") %>%
      as.Date(format = "%d %b %Y"),
    year = lubridate::year(ts)
  ) %>%
    dplyr::bind_cols(
      semver::parse_version(.$vers) %>%
        dplyr::as_data_frame()
    ) %>%
    dplyr::arrange(major, minor, patch) %>%
    dplyr::mutate(vers = factor(vers, levels=vers)) %>%
    dplyr::rename(rls_date = ts, rls_year = year)

}
\ No newline at end of file

M README.Rmd => README.Rmd +7 -0
@@ 29,6 29,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
- `php_version_history`:  Retrieve PHP 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


@@ 130,6 131,12 @@ OpenSSH
openssh_version_history()
```

PHP

```{r php, cache=TRUE}
php_version_history()
```

SQLite

```{r sqlite, cache=TRUE}

M README.md => README.md +23 -1
@@ 30,6 30,7 @@ Core:
  - `openresty_version_history`: Retrieve openresty Version Release
    History
  - `openssh_version_history`: Retrieve OpenSSH Version Release History
  - `php_version_history`: Retrieve PHP Version Release History
  - `sendmail_version_history`: Retrieve sendmail Version Release
    History
  - `sqlite_version_history`: Retrieve sqlite Version Release History


@@ 57,7 58,7 @@ library(vershist)
packageVersion("vershist")
```

    ## [1] '0.1.0'
    ## [1] '0.2.0'

Utility



@@ 292,6 293,27 @@ openssh_version_history()
    ## 10 3.4.0 2002-06-26    2002.     3     4     0 ""         ""   
    ## # ... with 44 more rows

PHP

``` r
php_version_history()
```

    ## # A tibble: 292 x 8
    ##    vers  rls_date   rls_year major minor patch prerelease build
    ##    <fct> <date>        <dbl> <int> <int> <int> <chr>      <chr>
    ##  1 3.0.0 2000-10-20     2000     3     0     0 ""         ""   
    ##  2 4.0.0 2000-05-22     2000     4     0     0 ""         ""   
    ##  3 4.0.1 2000-06-28     2000     4     0     1 ""         ""   
    ##  4 4.0.2 2000-08-29     2000     4     0     2 ""         ""   
    ##  5 4.0.3 2000-10-11     2000     4     0     3 ""         ""   
    ##  6 4.0.4 2000-12-19     2000     4     0     4 ""         ""   
    ##  7 4.0.5 2001-04-30     2001     4     0     5 ""         ""   
    ##  8 4.0.6 2001-06-23     2001     4     0     6 ""         ""   
    ##  9 4.1.0 2001-12-10     2001     4     1     0 ""         ""   
    ## 10 4.1.1 2001-12-26     2001     4     1     1 ""         ""   
    ## # ... with 282 more rows

SQLite

``` r

A README_cache/gfm/php_7238bf9d28779ec7d787ab4b553f0094.RData => README_cache/gfm/php_7238bf9d28779ec7d787ab4b553f0094.RData +0 -0
A README_cache/gfm/php_7238bf9d28779ec7d787ab4b553f0094.rdb => README_cache/gfm/php_7238bf9d28779ec7d787ab4b553f0094.rdb +0 -0
A README_cache/gfm/php_7238bf9d28779ec7d787ab4b553f0094.rdx => README_cache/gfm/php_7238bf9d28779ec7d787ab4b553f0094.rdx +0 -0
A man/php_version_history.Rd => man/php_version_history.Rd +14 -0
@@ 0,0 1,14 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/php.R
\name{php_version_history}
\alias{php_version_history}
\title{Retrieve PHP Version Release History}
\usage{
php_version_history()
}
\description{
Reads \url{https://secure.php.net/releases/} to build a data frame of PHP 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.
}