mirror of https://git.sr.ht/~hrbrmstr/vershist
boB Rudis
5 years ago
10 changed files with 87 additions and 4 deletions
@ -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, |
|||
|
@ -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) |
|||
|
|||
} |
Binary file not shown.
Binary file not shown.
@ -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. |
|||
} |
Loading…
Reference in new issue