Browse Source

added mysql

master
boB Rudis 6 years ago
parent
commit
e095e94773
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 6
      NAMESPACE
  2. 2
      NEWS.md
  3. 70
      R/mysql.R
  4. 3
      R/vershist-package.R
  5. 19
      README.Rmd
  6. 22
      README.md
  7. 3
      README_cache/gfm/__packages
  8. BIN
      README_cache/gfm/apache_64e645fe0c4206c6b0aac44aeaeabcb0.RData
  9. 0
      README_cache/gfm/apache_64e645fe0c4206c6b0aac44aeaeabcb0.rdb
  10. BIN
      README_cache/gfm/apache_64e645fe0c4206c6b0aac44aeaeabcb0.rdx
  11. BIN
      README_cache/gfm/lighttpd_58e541a40f4a190c4f820a1324a0cf7e.RData
  12. 0
      README_cache/gfm/lighttpd_58e541a40f4a190c4f820a1324a0cf7e.rdb
  13. BIN
      README_cache/gfm/lighttpd_58e541a40f4a190c4f820a1324a0cf7e.rdx
  14. BIN
      README_cache/gfm/mongodb_fb06a5aafa251908caeb222e29f1043a.RData
  15. 0
      README_cache/gfm/mongodb_fb06a5aafa251908caeb222e29f1043a.rdb
  16. BIN
      README_cache/gfm/mongodb_fb06a5aafa251908caeb222e29f1043a.rdx
  17. BIN
      README_cache/gfm/mysql_1412a1814e7127876d30c1e602611806.RData
  18. 0
      README_cache/gfm/mysql_1412a1814e7127876d30c1e602611806.rdb
  19. BIN
      README_cache/gfm/mysql_1412a1814e7127876d30c1e602611806.rdx
  20. BIN
      README_cache/gfm/nginx_85a001886458aa7c23e95b712c4c7c13.RData
  21. 0
      README_cache/gfm/nginx_85a001886458aa7c23e95b712c4c7c13.rdb
  22. BIN
      README_cache/gfm/nginx_85a001886458aa7c23e95b712c4c7c13.rdx
  23. BIN
      README_cache/gfm/openresty_df4309ea5aba89af3860f6bd44b525be.RData
  24. 0
      README_cache/gfm/openresty_df4309ea5aba89af3860f6bd44b525be.rdb
  25. BIN
      README_cache/gfm/openresty_df4309ea5aba89af3860f6bd44b525be.rdx
  26. BIN
      README_cache/gfm/sendmail_e84c95f4b2ac14a0543208fba290b19c.RData
  27. 0
      README_cache/gfm/sendmail_e84c95f4b2ac14a0543208fba290b19c.rdb
  28. BIN
      README_cache/gfm/sendmail_e84c95f4b2ac14a0543208fba290b19c.rdx
  29. 25
      man/mysql_version_history.Rd

6
NAMESPACE

@ -4,6 +4,7 @@ export(apache_httpd_version_history)
export(is_valid)
export(lighttpd_version_history)
export(mongodb_version_history)
export(mysql_version_history)
export(nginx_version_history)
export(openresty_version_history)
export(sendmail_version_history)
@ -15,10 +16,15 @@ importFrom(dplyr,as_data_frame)
importFrom(dplyr,bind_cols)
importFrom(dplyr,left_join)
importFrom(dplyr,mutate)
importFrom(dplyr,mutate_at)
importFrom(dplyr,progress_estimated)
importFrom(dplyr,rename)
importFrom(dplyr,select)
importFrom(gh,gh)
importFrom(gh,gh_next)
importFrom(httr,GET)
importFrom(httr,content)
importFrom(httr,user_agent)
importFrom(lubridate,mdy)
importFrom(lubridate,mdy_hms)
importFrom(lubridate,year)

2
NEWS.md

@ -1,3 +1,3 @@
0.1.0
* Initial release
* Support for Apache httpd, nginx, sendmail, lighttpd, openresty and mongodb
* Support for Apache httpd, lighttpd, mongodb, nginx, mysql, openresty and sendmail

70
R/mysql.R

@ -0,0 +1,70 @@
#' Retrieve MySQL Version Release History
#'
#' Scrapes <https://downloads.mysql.com/archives/community/> to build a data frame of
#' openresty version release numbers and dates with pesudo-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.
#'
#' The selector for versioning is "`Generic Linux (Architecture Independent)`" and
#' the first found date is used for the `rls_date`. File an issue or PR if
#' alternate behaviour is required.
#'
#' @md
#' @note This is an *expensive* function as it does quite a bit of scraping.
#' Please consider using some sort of cache for the results unless
#' absolutely necessary.
#' @export
mysql_version_history <- function() {
pg <- xml2::read_html("https://downloads.mysql.com/archives/community/")
rvest::html_nodes(pg, "select#version > option") %>%
rvest::html_attr("value") -> versions
pb <- dplyr::progress_estimated(length(versions))
purrr::map_df(
versions, ~{
pb$tick()$print()
httr::GET(
url = "https://downloads.mysql.com/archives/community/",
query = list(
os = "src",
osva = "Generic Linux (Architecture Independent)",
tpl = "version",
version = .x
),
httr::user_agent("#rstats vershist package : https://github.com/hrbrmstr/vershist")
) -> res
list(
vers = .x,
res = list(res)
)
}
) %>%
mutate(
rls_date = purrr::map_chr(res, content, as="text") %>%
stri_extract_first_regex("[[:alpha:]]+[[:space:]]{1,4}[[:digit:]]{1,2},[[:space:]]{1,4}[[:digit:]]{4}") %>%
lubridate::mdy()
) %>%
mutate(rls_year = lubridate::year(rls_date)) %>%
select(-res) %>%
tidyr::separate(vers, c("major", "minor", "patch"), remove=FALSE) %>%
dplyr::mutate(build = ifelse(
stri_detect_regex(patch, "[[:alpha:]]"),
stri_extract_first_regex(patch, "[[:alpha:]]+[[:alnum:]]*"),
""
)) %>%
dplyr::mutate(patch = stri_replace_first_regex(patch, "[[:alpha:]]+[[:alnum:]]*", "")) %>%
dplyr::mutate_at(.vars=c("major", "minor", "patch"), .funs=c(as.integer)) %>%
dplyr::mutate(prerelease = "") %>%
dplyr::arrange(major, minor, patch) %>%
dplyr::mutate(vers = factor(vers, levels=vers)) %>%
dplyr::select(vers, rls_date, rls_year, major, minor, patch, prerelease, build)
}

3
R/vershist-package.R

@ -10,7 +10,7 @@
#' @import semver
#' @importFrom purrr keep discard map map_df %>% safely
#' @importFrom dplyr mutate rename select as_data_frame left_join bind_cols arrange
#' @importFrom dplyr rename
#' @importFrom dplyr rename progress_estimated mutate_at
#' @importFrom stringi stri_match_first_regex stri_detect_fixed stri_detect_regex
#' @importFrom stringi stri_replace_all_regex stri_replace_first_fixed
#' @importFrom stringi stri_extract_first_regex stri_sub stri_replace_first_regex
@ -22,6 +22,7 @@
#' @importFrom curl curl
#' @importFrom gh gh gh_next
#' @importFrom tidyr separate
#' @importFrom httr content GET user_agent
#' @useDynLib vershist
#' @importFrom Rcpp sourceCpp
NULL

19
README.Rmd

@ -20,6 +20,7 @@ Core:
- `apache_httpd_version_history`: Retrieve Apache httpd Version Release History
- `lighttpd_version_history`: Retrieve lighttpd Version Release History
- `mongodb_version_history`: Retrieve MongoDB Version Release History
- `mysql_version_history`: Retrieve MySQL Version Release History
- `nginx_version_history`: Retrieve nginx Version Release History
- `openresty_version_history`: Retrieve openresty Version Release History
- `sendmail_version_history`: Retrieve sendmail Version Release History
@ -49,36 +50,42 @@ packageVersion("vershist")
Apache
```{r apache}
```{r apache, cache=TRUE}
apache_httpd_version_history()
```
lighttpd
```{r}
```{r lighttpd, cache=TRUE}
lighttpd_version_history()
```
mongodb
```{r}
```{r mongodb, cache=TRUE}
mongodb_version_history()
```
MySQL
```{r mysql, cache=TRUE}
mysql_version_history()
```
nginx
```{r}
```{r nginx, cache=TRUE}
nginx_version_history()
```
openresty
```{r}
```{r openresty, cache=TRUE}
openresty_version_history()
```
sendmail
```{r}
```{r sendmail, cache=TRUE}
sendmail_version_history()
```

22
README.md

@ -19,6 +19,7 @@ Core:
- `lighttpd_version_history`: Retrieve lighttpd Version Release
History
- `mongodb_version_history`: Retrieve MongoDB Version Release History
- `mysql_version_history`: Retrieve MySQL Version Release History
- `nginx_version_history`: Retrieve nginx Version Release History
- `openresty_version_history`: Retrieve openresty Version Release
History
@ -109,6 +110,27 @@ mongodb_version_history()
## 10 0.9.8 2009-08-14 2009 0 9 8 "" ""
## # ... with 184 more rows
MySQL
``` r
mysql_version_history()
```
## # A tibble: 201 x 8
## vers rls_date rls_year major minor patch prerelease build
## <fct> <date> <dbl> <int> <int> <int> <chr> <chr>
## 1 5.0.15a 2005-10-25 2005 5 0 15 "" a
## 2 5.0.15 2005-10-24 2005 5 0 15 "" ""
## 3 5.0.16a 2005-11-19 2005 5 0 16 "" a
## 4 5.0.16 2005-11-18 2005 5 0 16 "" ""
## 5 5.0.17a 2005-12-16 2005 5 0 17 "" a
## 6 5.0.17 2005-12-20 2005 5 0 17 "" ""
## 7 5.0.18 2005-12-29 2005 5 0 18 "" ""
## 8 5.0.19 2006-03-07 2006 5 0 19 "" ""
## 9 5.0.20a 2006-04-20 2006 5 0 20 "" a
## 10 5.0.20 2006-04-10 2006 5 0 20 "" ""
## # ... with 191 more rows
nginx
``` r

3
README_cache/gfm/__packages

@ -0,0 +1,3 @@
base
vershist
bindrcpp

BIN
README_cache/gfm/apache_64e645fe0c4206c6b0aac44aeaeabcb0.RData

Binary file not shown.

0
README_cache/gfm/apache_64e645fe0c4206c6b0aac44aeaeabcb0.rdb

BIN
README_cache/gfm/apache_64e645fe0c4206c6b0aac44aeaeabcb0.rdx

Binary file not shown.

BIN
README_cache/gfm/lighttpd_58e541a40f4a190c4f820a1324a0cf7e.RData

Binary file not shown.

0
README_cache/gfm/lighttpd_58e541a40f4a190c4f820a1324a0cf7e.rdb

BIN
README_cache/gfm/lighttpd_58e541a40f4a190c4f820a1324a0cf7e.rdx

Binary file not shown.

BIN
README_cache/gfm/mongodb_fb06a5aafa251908caeb222e29f1043a.RData

Binary file not shown.

0
README_cache/gfm/mongodb_fb06a5aafa251908caeb222e29f1043a.rdb

BIN
README_cache/gfm/mongodb_fb06a5aafa251908caeb222e29f1043a.rdx

Binary file not shown.

BIN
README_cache/gfm/mysql_1412a1814e7127876d30c1e602611806.RData

Binary file not shown.

0
README_cache/gfm/mysql_1412a1814e7127876d30c1e602611806.rdb

BIN
README_cache/gfm/mysql_1412a1814e7127876d30c1e602611806.rdx

Binary file not shown.

BIN
README_cache/gfm/nginx_85a001886458aa7c23e95b712c4c7c13.RData

Binary file not shown.

0
README_cache/gfm/nginx_85a001886458aa7c23e95b712c4c7c13.rdb

BIN
README_cache/gfm/nginx_85a001886458aa7c23e95b712c4c7c13.rdx

Binary file not shown.

BIN
README_cache/gfm/openresty_df4309ea5aba89af3860f6bd44b525be.RData

Binary file not shown.

0
README_cache/gfm/openresty_df4309ea5aba89af3860f6bd44b525be.rdb

BIN
README_cache/gfm/openresty_df4309ea5aba89af3860f6bd44b525be.rdx

Binary file not shown.

BIN
README_cache/gfm/sendmail_e84c95f4b2ac14a0543208fba290b19c.RData

Binary file not shown.

0
README_cache/gfm/sendmail_e84c95f4b2ac14a0543208fba290b19c.rdb

BIN
README_cache/gfm/sendmail_e84c95f4b2ac14a0543208fba290b19c.rdx

Binary file not shown.

25
man/mysql_version_history.Rd

@ -0,0 +1,25 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mysql.R
\name{mysql_version_history}
\alias{mysql_version_history}
\title{Retrieve MySQL Version Release History}
\usage{
mysql_version_history()
}
\description{
Scrapes \url{https://downloads.mysql.com/archives/community/} to build a data frame of
openresty version release numbers and dates with pesudo-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.
}
\details{
The selector for versioning is "\code{Generic Linux (Architecture Independent)}" and
the first found date is used for the \code{rls_date}. File an issue or PR if
alternate behaviour is required.
}
\note{
This is an \emph{expensive} function as it does quite a bit of scraping.
Please consider using some sort of cache for the results unless
absolutely necessary.
}
Loading…
Cancel
Save