diff --git a/NAMESPACE b/NAMESPACE index 261f04b..3ebafd8 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) diff --git a/NEWS.md b/NEWS.md index b14fa9c..c3460d3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/R/citrix-netscaler.R b/R/citrix-netscaler.R new file mode 100644 index 0000000..5d1a18a --- /dev/null +++ b/R/citrix-netscaler.R @@ -0,0 +1,43 @@ +#' Citrix Netscaler ADC Version History +#' +#' Reads 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)) + +} + diff --git a/R/virtualbox.R b/R/virtualbox.R new file mode 100644 index 0000000..f160f61 --- /dev/null +++ b/R/virtualbox.R @@ -0,0 +1,37 @@ +#' Retrieve Virtualbox Version Release History +#' +#' Reads 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)) + +} + diff --git a/README.Rmd b/README.Rmd index 00e54de..4145cab 100644 --- a/README.Rmd +++ b/README.Rmd @@ -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 diff --git a/README.md b/README.md index 1dd12a5..cf01534 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/man/citrix_netscaler_version_history.Rd b/man/citrix_netscaler_version_history.Rd new file mode 100644 index 0000000..886b028 --- /dev/null +++ b/man/citrix_netscaler_version_history.Rd @@ -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. +} diff --git a/man/virtualbox_version_history.Rd b/man/virtualbox_version_history.Rd new file mode 100644 index 0000000..f5b2f69 --- /dev/null +++ b/man/virtualbox_version_history.Rd @@ -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. +}