~hrbrmstr/vershist

3d55fe389ccc741fb96558353d5163459fd47226 — hrbrmstr 2 years ago e66db1d master
added citrix netscaler
M NAMESPACE => NAMESPACE +2 -0
@@ 2,6 2,7 @@

export(apache_httpd_version_history)
export(apple_ios_version_history)
export(citrix_netscaler_version_history)
export(complete_semver)
export(etcd_version_history)
export(exim_version_history)


@@ 19,6 20,7 @@ export(php_version_history)
export(sendmail_version_history)
export(sqlite_version_history)
export(tomcat_version_history)
export(virtualbox_version_history)
import(semver)
importFrom(Rcpp,sourceCpp)
importFrom(curl,curl)

M NEWS.md => NEWS.md +1 -0
@@ 1,4 1,5 @@
0.4.2
* Added `citrix_netscaler_version_history()`
* Fixed a cpl functions that use scraping (sites changed HTML)
* Added caching/refresh capability to mysql and etcd given how expensive they are to compute


A R/citrix-netscaler.R => R/citrix-netscaler.R +43 -0
@@ 0,0 1,43 @@
#' Citrix Netscaler ADC Version History
#'
#' Reads <https://support.citrix.com/article/CTX121840> to build a data frame of
#' Citrix Netscaler ADC 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
citrix_netscaler_version_history <- function() {

  pg <- xml2::read_html("https://support.citrix.com/article/CTX121840")

  v <- rvest::html_nodes(pg, xpath = ".//h3[contains(., 'NetScaler Software Release')]")

  purrr::map_df(v, ~{
    cols <- ifelse(grepl("11.1", html_text(.x)), 2, 1)
    tibble::tibble(
      bld = rvest::html_nodes(.x, xpath = sprintf(".//following-sibling::table[1]//td[%s]", cols)) %>% rvest::html_text(trim = TRUE),
      rls_date = rvest::html_nodes(.x, xpath = sprintf(".//following-sibling::table[1]//td[%s]", cols+1)) %>% rvest::html_text(trim = TRUE)
    ) %>%
      mutate(bld = gsub("[[:space:]]*\\(.*$", "", bld)) %>%
      mutate(mm = gsub("NetScaler Software Release ", "", html_text(.x)))
  }) %>%
    dplyr::select(mm, bld, rls_date) %>%
    dplyr::filter(!grepl("^10", mm)) %>%
    dplyr::filter(!grepl("Build", bld)) %>%
    tidyr::separate_rows(bld, sep = "/") %>%
    dplyr::mutate(bld = gsub("[[:space:]]*[[:alpha:]].*$", "", trimws(bld))) %>%
    tidyr::separate(mm, c("maj", "min"), sep="\\.") %>%
    tidyr::separate(bld, c("pat", "bld"), sep="\\.", fill = "right") %>%
    dplyr::mutate(bld = ifelse(is.na(bld), "0", bld)) %>%
    dplyr::mutate(vers = sprintf("%s.%s.%s.%s", maj, min, pat, bld)) %>%
    dplyr::mutate(rls_date = lubridate::mdy(rls_date)) %>%
    dplyr::mutate(rls_year = lubridate::year(rls_date)) %>%
    dplyr::select(vers, rls_date, rls_year, maj, min, pat, bld) %>%
    dplyr::distinct() %>%
    dplyr::arrange(rls_date) %>%
    dplyr::mutate(vers = forcats::fct_inorder(vers, ordered = TRUE))

}


A R/virtualbox.R => R/virtualbox.R +37 -0
@@ 0,0 1,37 @@
#' Retrieve Virtualbox Version Release History
#'
#' Reads <https://download.virtualbox.org/virtualbox/> to build a data frame of
#' Virtualbox 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
virtualbox_version_history <- function() {

  pg <- xml2::read_html("https://download.virtualbox.org/virtualbox/")

  rvest::html_node(pg, "pre") %>%
    rvest::html_text() %>%
    stri_split_lines() %>%
    unlist() %>%
    stri_trim_both() %>%
    keep(stri_detect_regex, "^[[:digit:]]") %>%
    discard(stri_detect_fixed, "_") %>%
    stri_match_first_regex("^([^/]+)/[[:space:]]+([[:digit:]]{2}-[[:alpha:]]{3}-[[:digit:]]{4})") %>%
    .[,2:3] %>%
    as.data.frame(stringsAsFactors=FALSE) %>%
    dplyr::as_tibble() %>%
    dplyr::select(vers = V1, rls_date = V2) %>%
    tidyr::separate(vers, into = c("major", "minor", "patch"), sep = "\\.", remove = FALSE) %>%
    dplyr::mutate(
      rls_date = lubridate::dmy(rls_date),
      rls_year = lubridate::year(rls_date)
    ) %>%
    dplyr::select(vers, rls_date, rls_year, major, minor, patch) %>%
    dplyr::arrange(as.integer(major), as.integer(minor), as.integer(patch)) %>%
    dplyr::mutate(vers = factor(vers, levels = vers))

}


M README.Rmd => README.Rmd +1 -0
@@ 28,6 28,7 @@ Core:

- `apache_httpd_version_history`: Retrieve Apache httpd Version Release History
- `apple_ios_version_history`:  Retrieve Apple iOS Version Release History
- `citrix_netscaler_version_history`: Citrix Netscaler ADC Version History
- `etcd_version_history`: Retrieve etcd Version Release History
- `google_chrome_version_history`:  Retrieve Google Chrome Version Release History
- `isc_bind_version_history` : Retrieve ISC BIND Version Release History

M README.md => README.md +1 -0
@@ 18,6 18,7 @@ Core:
    Release History
  - `apple_ios_version_history`: Retrieve Apple iOS Version Release
    History
  - `citrix_netscaler_version_history`: Citrix Netscaler ADC Version History
  - `etcd_version_history`: Retrieve etcd Version Release History
  - `google_chrome_version_history`: Retrieve Google Chrome Version
    Release History

A man/citrix_netscaler_version_history.Rd => man/citrix_netscaler_version_history.Rd +15 -0
@@ 0,0 1,15 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/citrix-netscaler.R
\name{citrix_netscaler_version_history}
\alias{citrix_netscaler_version_history}
\title{Citrix Netscaler ADC Version History}
\usage{
citrix_netscaler_version_history()
}
\description{
Reads \url{https://support.citrix.com/article/CTX121840} to build a data frame of
Citrix Netscaler ADC 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.
}

A man/virtualbox_version_history.Rd => man/virtualbox_version_history.Rd +15 -0
@@ 0,0 1,15 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/virtualbox.R
\name{virtualbox_version_history}
\alias{virtualbox_version_history}
\title{Retrieve Virtualbox Version Release History}
\usage{
virtualbox_version_history()
}
\description{
Reads \url{https://download.virtualbox.org/virtualbox/} to build a data frame of
Virtualbox 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.
}