Browse Source

added citrix netscaler

master
boB Rudis 4 years ago
parent
commit
3d55fe389c
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 2
      NAMESPACE
  2. 1
      NEWS.md
  3. 43
      R/citrix-netscaler.R
  4. 37
      R/virtualbox.R
  5. 1
      README.Rmd
  6. 1
      README.md
  7. 15
      man/citrix_netscaler_version_history.Rd
  8. 15
      man/virtualbox_version_history.Rd

2
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)

1
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

43
R/citrix-netscaler.R

@ -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))
}

37
R/virtualbox.R

@ -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))
}

1
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

1
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

15
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.
}

15
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.
}
Loading…
Cancel
Save