diff --git a/.Rbuildignore b/.Rbuildignore index 6cf1f4a4a..b70381d94 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -6,3 +6,6 @@ inst/analog-keys.R inst/examples/03-github/github-key.txt .httr-oauth docs +scripts +^revdep$ +^cran-comments\.md$ diff --git a/DESCRIPTION b/DESCRIPTION index 9673bdaa8..ede67c185 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,7 @@ Encoding: UTF-8 Package: plumber Type: Package Title: An API Generator for R -Version: 0.4.5 -Date: 2018-05-09 +Version: 0.4.6 Roxygen: list(markdown = TRUE) Authors@R: c( person(family="Trestle Technology, LLC", role="aut", email="cran@trestletech.com"), @@ -37,7 +36,7 @@ Suggests: htmlwidgets, visNetwork, analogsea -Collate: +Collate: 'content-types.R' 'cookie-parser.R' 'parse-globals.R' diff --git a/NEWS.md b/NEWS.md index 93bcb0b3e..87d0e2815 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,8 @@ -plumber 0.4.5 +plumber 0.4.6 -------------------------------------------------------------------------------- -* BUGFIX: Hooks that accept a `value` argument (`postroute`, `preserialize`, +* BUGFIX: Hooks that accept a `value` argument (`postroute`, `preserialize`, and `postserialize`) now modify the incoming value as documented. -* BUGFIX: The `postserialize` hook is now given the serialized data as its +* BUGFIX: The `postserialize` hook is now given the serialized data as its `value` parameter. * BUGFIX: properly handle cookie expiration values ([#216](https://github.com/trestletech/plumber/issues/216)). * Add support for tags in Swagger docs ([#230](https://github.com/trestletech/plumber/pull/230)). @@ -12,24 +12,24 @@ plumber 0.4.5 plumber 0.4.4 -------------------------------------------------------------------------------- -* Support Expiration, HTTPOnly, and Secure flags on cookies (#87). **EDIT**: - see [#216](https://github.com/trestletech/plumber/issues/216) which prevented +* Support Expiration, HTTPOnly, and Secure flags on cookies (#87). **EDIT**: + see [#216](https://github.com/trestletech/plumber/issues/216) which prevented expiration from working. -* BUGFIX: properly handle named query string and post body arguments in +* BUGFIX: properly handle named query string and post body arguments in mounted subrouters. -* Added support for static sizing of images. `@png` and `@jpeg` now accept a - parenthetical list of arguments that will be passed into the `png()` or - `jpeg()` call. This enables annotations like +* Added support for static sizing of images. `@png` and `@jpeg` now accept a + parenthetical list of arguments that will be passed into the `png()` or + `jpeg()` call. This enables annotations like `#' @png (width = 200, height=500)`. * Enable `ByteCompile` flag * Set working directory for DigitalOcean APIs. * Respect `setErrorHandler` * BUGFIX: export `PlumberStatic` -* Case-insensitive matching on `plumber.r` and `entrypoint.r` when +* Case-insensitive matching on `plumber.r` and `entrypoint.r` when `plumb()`ing a directory. -* Support query strings with keys that appear more than once +* Support query strings with keys that appear more than once ([#165](https://github.com/trestletech/plumber/pull/165)) -* Fix the validation error warning at the bottom of deployed Swagger files +* Fix the validation error warning at the bottom of deployed Swagger files which would have appeared any time your `swagger.json` file was hosted in such a way that a hosted validator service would not have been able to access it. For now we just suppress validation of swagger.json files. (#149) @@ -37,7 +37,7 @@ plumber 0.4.4 * Make adding swap file idempotent in `do_provision()` so you can now call that on a single droplet multiple times. * Support an `exit` hook which can define a function that will be - evaluated when the API is interrupted. e.g. + evaluated when the API is interrupted. e.g. `pr <- plumb("plumber.R"); pr$registerHook("exit", function(){ print("Bye bye!") })` * Fixed bug in which a single function couldn't support multiple paths for a single verb (#203). @@ -53,31 +53,31 @@ plumber 0.4.2 plumber 0.4.0 -------------------------------------------------------------------------------- * BREAKING: Listen on localhost instead of listening publicly by default. -* BREAKING: We no longer set the `Access-Control-Allow-Origin` HTTP header to +* BREAKING: We no longer set the `Access-Control-Allow-Origin` HTTP header to `*`. This was previously done for convenience but we've decided to prioritize security here by removing this default. You can still add this header to any route you want to be accessible from other origins. * BREAKING: Listen on a random port by default instead of always on 8000. This - can be controlled using the `port` parameter in `run()`, or by setting the + can be controlled using the `port` parameter in `run()`, or by setting the `plumber.port` option. -* BREAKING: Removed `PlumberProcessor` class and replaced with a notion of +* BREAKING: Removed `PlumberProcessor` class and replaced with a notion of hooks. See `registerHook` and `registerHooks` on the Plumber router. * BREAKING: `addGlobalProcessor` method on Plumber routers now takes a list which are added as hooks instead of a Processor. Note that `sessionCookie` has also been updated to behave accordingly, meaning that the convention of `pr$addGlobalProcessor(sessionCookie("secret", "cookieName"))` will continue to work for this release. -* BREAKING: `sessionCookie` now returns a list instead of a Processor. Note - that `addGlobalProcessor` has also been updated to behave accordingly, - meaning that the convention of +* BREAKING: `sessionCookie` now returns a list instead of a Processor. Note + that `addGlobalProcessor` has also been updated to behave accordingly, + meaning that the convention of `pr$addGlobalProcessor(sessionCookie("secret", "cookieName"))` will continue to work for this release. -* DEPRECATION: Deprecated the `addAssets` method on Plumber routers. Use +* DEPRECATION: Deprecated the `addAssets` method on Plumber routers. Use `PlumberStatic` and the `mount` method to attach a static router. -* DEPRECATION: Deprecated the `addEndpoint` method in favor of the `handle` - method for Plumber routers. Removed support for the `processors`, `params`, +* DEPRECATION: Deprecated the `addEndpoint` method in favor of the `handle` + method for Plumber routers. Removed support for the `processors`, `params`, and `comments` parameters are no longer supported. -* DEPRECATION: Deprecated the `addFilter` method on Plumber routers in favor +* DEPRECATION: Deprecated the `addFilter` method on Plumber routers in favor of the new `filter` method. Removed support for the processor parameter. * DEPRECATION: Deprecated the `addGlobalProcessor` method on Plumber routers. * The undocumented `setDefaultErrorHandler` method on Plumber routers now takes @@ -85,7 +85,7 @@ plumber 0.4.0 takes a single param named `debug` which is managed by the `debug` parameter in the `run()` method. * Added support for `OPTIONS` HTTP requests via the `@options` annotation. -* Add support for `entrypoint.R` when `plumb()`ing a directory. If this file +* Add support for `entrypoint.R` when `plumb()`ing a directory. If this file exists, it is expected to return a Plumber router representing the API contained in this directory. If it doesn't exist, the behavior is unaltered. If both `plumber.R` and `entrypoint.R` exist, `entrypoint.R` takes precedence. @@ -100,13 +100,13 @@ plumber 0.3.3 plumber 0.3.2 -------------------------------------------------------------------------------- -* Introduced the `do_provision()`, `do_deploy_api()`, `do_remove_api()` and - `do_configure_https()` functions to provision and manage your APIs on a +* Introduced the `do_provision()`, `do_deploy_api()`, `do_remove_api()` and + `do_configure_https()` functions to provision and manage your APIs on a cloud server running on DigitalOcean. -* `source()` the referenced R file to plumb inside of a new environment that +* `source()` the referenced R file to plumb inside of a new environment that inherits directly from the GlobalEnv. This provides more explicit control over exactly how this environment should behave. -* Added `@serializer htmlwidget` to support rendering and returning a +* Added `@serializer htmlwidget` to support rendering and returning a self-contained htmlwidget from a plumber endpoint. * Properly handle cookies with no value. (#88) * Don't convert `+` character in a query string to a space. @@ -118,10 +118,10 @@ plumber 0.3.1 plumber 0.3.0 -------------------------------------------------------------------------------- -* BREAKING CHANGE: serializer factories are now registered instead of the +* BREAKING CHANGE: serializer factories are now registered instead of the serializer themselves. Thus, `addSerializer()` now expects a function that returns a serializer, and `Response$new()` now expects a serializer itself - rather than a character string naming a serializer. Internally it is the + rather than a character string naming a serializer. Internally it is the serializer itself that is attached to the response rather than the name of the serializer. This allows for a serializer to customize its behavior. * Accept an additional argument on the `@serializer` annotation -- R code that @@ -138,7 +138,7 @@ plumber 0.2.4 plumber 0.2.3 -------------------------------------------------------------------------------- -* Set options(warn=1) during execution of user code so that warnings are +* Set options(warn=1) during execution of user code so that warnings are immediately visible in the console, rather than storing them until the server is stopped. @@ -150,7 +150,7 @@ plumber 0.2.2 * Added `setCookie` method to response which (primitively) allows you to set a cookie to be included in the response. * Add `addGlobalProcessor` method on `plumber` class to support a processor that - runs a processor only a single time, before and then after all other filters + runs a processor only a single time, before and then after all other filters and the endpoint. * Document all public params so CHECK passes diff --git a/R/digital-ocean.R b/R/digital-ocean.R index b3711938a..f048a4bd0 100644 --- a/R/digital-ocean.R +++ b/R/digital-ocean.R @@ -144,7 +144,7 @@ install_new_r <- function(droplet){ #' IP address associated with your droplet. If you don't already have a domain #' name, you can register one [here](http://tres.tl/domain). Point a (sub)domain #' to the IP address associated with your plumber droplet before calling this -#' function. These changes may take a few minutes or hours to propogate around +#' function. These changes may take a few minutes or hours to propagate around #' the Internet, but once complete you can then execute this function with the #' given domain to be granted a TLS/SSL certificate for that domain. #' @details Obtains a free TLS/SSL certificate from diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 000000000..551ca3a0b --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,88 @@ +# Comments + +## 2018-6-4 +This submission is done by Barret Schloerke on behalf of Jeff Allen . Please submit any changes to be made to . + +- Barret + + +## Test environments + +All NOTEs related to invalid URLs http:localhost:8000 are **false positives**. The URL makes sense when looking at the example within the README.md file. + +* local OS X install, R 3.5.0, --run-dontcheck + * checking CRAN incoming feasibility ... NOTE + Found the following (possibly) invalid URLs: + URL: http://localhost:8000/echo?msg=hello + From: README.md + Status: Error + Message: libcurl error code 7: + Failed to connect to localhost port 8000: Connection refused + URL: http://localhost:8000/plot + From: README.md + Status: Error + Message: libcurl error code 7: + Failed to connect to localhost port 8000: Connection refused + * 0 errors | 0 warnings | 1 notes + +* ubuntu 14.04.5 (on travis-ci), R version 3.5.0 (2017-01-27) + * 0 errors | 0 warnings | 0 notes + +* devtools::build_win() + * x86_64-w64-mingw32, R version 3.5.0 (2018-04-23) + * x86_64-w64-mingw32, R Under development (unstable) (2018-06-03 r74839) + * checking CRAN incoming feasibility ... NOTE + Found the following (possibly) invalid URLs: + URL: http://localhost:8000/echo?msg=hello + From: README.md + Status: Error + Message: libcurl error code 7: + Failed to connect to localhost port 8000: Connection refused + URL: http://localhost:8000/plot + From: README.md + Status: Error + Message: libcurl error code 7: + Failed to connect to localhost port 8000: Connection refused + * 0 errors | 0 warnings | 1 note + + +* r-hub + + * Platform: Ubuntu Linux 16.04 LTS, R-release, GCC + * checked with `_R_CHECK_FORCE_SUGGESTS_=0` + http://builder.r-hub.io/status/plumber_0.4.6.tar.gz-7eb7117f2cf74e1b8880c46e7819ab61 + ❯ checking CRAN incoming feasibility ... NOTE + Maintainer: ‘Jeff Allen ’ + + Found the following (possibly) invalid URLs: + URL: http://localhost:8000/echo?msg=hello + From: README.md + Status: Error + Message: libcurl error code 7: + Failed to connect to localhost port 8000: Connection refused + URL: http://localhost:8000/plot + From: README.md + Status: Error + Message: libcurl error code 7: + Failed to connect to localhost port 8000: Connection refused + 0 errors ✔ | 0 warnings ✔ | 1 note ✖ + + + * rhub platform issues not related to code. These operating systems failed to complete properly and I do not have the ability to fix the error. + * Windows Server 2008 R2 SP1, R-release, 32/64 bit + * 'stringi' is not available + * Windows Server 2008 R2 SP1, R-devel, 32/64 bit + * 'stringi' is not available + * Fedora Linux, R-devel, clang, gfortran + * Has trouble opening a png device + + +## Reverse dependencies + +* Revdep maintainers were not contacted as this release is for bug fixes and enhancements from particular maintainers. + +* I have run R CMD check on the 3 downstream dependencies. + * https://github.com/trestletech/plumber/blob/master/revdep/problems.md + * No errors, warnings, or notes were introduced due to changes in leaflet + +* All revdeps were able to be tested diff --git a/docs/release.md b/docs/release.md index bb7c98fe1..581f2c7d6 100644 --- a/docs/release.md +++ b/docs/release.md @@ -1,11 +1,31 @@ +## Check Steps + +1. `devtools::document()` +1. `devtools::check()` +1. `devtools::install()` +1. `source("scripts/rhub.R")` + * Copy urls and final outputs into cran comments +1. `source("scripts/revdepcheck.R")` +1. `devtools::release()`, + * (don't actually release in the last step) + * DON'T LIE!! +1. Run the docker image in inst/check on the release candidate. Note that you will need to change the CMD to checkout the release branch so you're testing it, not master. + 1. ```{bash} +cd inst/check +docker build -t plumber_docker . +docker run plumber_docker +``` + + ## Release Steps 1. Create a release branch for the next release. -1. Bump the version # and the date in DESCRIPTION to the next even number for release +1. Bump the version # in DESCRIPTION to the next even number for release 1. Bump the version # in NEWS.md to align with ^ -1. Run the docker image in inst/check on the release candidate. Note that you will need to change the CMD to checkout the release branch so you're testing it, not master. +1. Run check steps above 1. Submit to CRAN. + 1. `devtools::release()` (actually release) 1. Do any revisions CRAN requests on the release branch 1. Once accepted to CRAN, merge the release branch to master and tag the release. 1. Bump the version # in DESCRIPTION to the next odd number on master for development of next release. diff --git a/inst/check/Dockerfile b/inst/check/Dockerfile index ddb640c31..272fd1aaf 100644 --- a/inst/check/Dockerfile +++ b/inst/check/Dockerfile @@ -2,6 +2,7 @@ FROM rocker/drd MAINTAINER Jeff Allen RUN apt-get update -qq && apt-get install -y \ + curl \ libxml2-dev \ git-core \ libssl-dev/unstable \ @@ -13,14 +14,13 @@ RUN apt-get update -qq && apt-get install -y \ RUN R -e 'install.packages(c("XML", "devtools", "testthat", "PKI", "httpuv", "rmarkdown"))' # Install pandoc -RUN mkdir /pandoc && \ - cd /pandoc && \ - wget https://s3.amazonaws.com/rstudio-buildtools/pandoc-debian-x86_64-1.15.2.zip && \ - unzip pandoc-debian* && \ - rm pandoc-debian*.zip +RUN curl -fLo /tmp/pandoc-2.2-1-amd64.deb https://github.com/jgm/pandoc/releases/download/2.2/pandoc-2.2-1-amd64.deb && \ + dpkg -i /tmp/pandoc-2.2-1-amd64.deb && \ + apt-get install -f && \ + rm /tmp/pandoc-2.2-1-amd64.deb -ENV RSTUDIO_PANDOC=/pandoc -ENV PATH=$PATH:/pandoc +# ENV RSTUDIO_PANDOC=/pandoc +# ENV PATH=$PATH:/pandoc RUN R -e "install.packages(c('htmlwidgets', 'visNetwork', 'analogsea'))" @@ -29,6 +29,6 @@ RUN R -e "install.packages(c('htmlwidgets', 'visNetwork', 'analogsea'))" RUN R -e "install.packages('PKI',,'https://www.rforge.net/')" -CMD git clone https://github.com/trestletech/plumber.git /plumber && \ +CMD git clone -b "release-v0.4.6" https://github.com/schloerke/plumber.git /plumber && \ R CMD build /plumber && \ R CMD check plumber_*.tar.gz --as-cran diff --git a/man/do_configure_https.Rd b/man/do_configure_https.Rd index 1b278ed2f..2bd6720cc 100644 --- a/man/do_configure_https.Rd +++ b/man/do_configure_https.Rd @@ -33,7 +33,7 @@ In order to get a TLS/SSL certificate, you need to point a domain name to the IP address associated with your droplet. If you don't already have a domain name, you can register one \href{http://tres.tl/domain}{here}. Point a (sub)domain to the IP address associated with your plumber droplet before calling this -function. These changes may take a few minutes or hours to propogate around +function. These changes may take a few minutes or hours to propagate around the Internet, but once complete you can then execute this function with the given domain to be granted a TLS/SSL certificate for that domain. diff --git a/revdep/.gitignore b/revdep/.gitignore new file mode 100644 index 000000000..31f6c40d7 --- /dev/null +++ b/revdep/.gitignore @@ -0,0 +1,6 @@ +checks +library +checks.noindex +library.noindex +data.sqlite +*.html diff --git a/revdep/README.md b/revdep/README.md new file mode 100644 index 000000000..e7235e387 --- /dev/null +++ b/revdep/README.md @@ -0,0 +1,31 @@ +# Platform + +|field |value | +|:--------|:----------------------------| +|version |R version 3.5.0 (2018-04-23) | +|os |macOS High Sierra 10.13.4 | +|system |x86_64, darwin15.6.0 | +|ui |X11 | +|language |(EN) | +|collate |en_US.UTF-8 | +|tz |America/New_York | +|date |2018-06-04 | + +# Dependencies + +|package |old |new |Δ | +|:-------|:-----|:-------|:--| +|plumber |0.4.4 |0.4.6 |* | +|Rcpp |NA |0.12.17 |* | +|rlang |NA |0.2.1 |* | + +# Revdeps + +## All (3) + +|package |version |error |warning |note | +|:----------------------------------|:-------|:-----|:-------|:----| +|bayesAB |1.1.0 | | | | +|[rjsonapi](problems.md#rjsonapi) |0.1.0 | | |1 | +|[rsconnect](problems.md#rsconnect) |0.8.8 | | |2 | + diff --git a/revdep/email.yml b/revdep/email.yml new file mode 100644 index 000000000..18c2a5975 --- /dev/null +++ b/revdep/email.yml @@ -0,0 +1,4 @@ +release_date: ??? +rel_release_date: ??? +my_news_url: ??? +release_version: ??? diff --git a/revdep/problems.md b/revdep/problems.md new file mode 100644 index 000000000..aeb2b64d8 --- /dev/null +++ b/revdep/problems.md @@ -0,0 +1,28 @@ +# rjsonapi + +Version: 0.1.0 + +## In both + +* checking dependencies in R code ... NOTE + ``` + Namespace in Imports field not imported from: ‘crul’ + All declared Imports should be used. + ``` + +# rsconnect + +Version: 0.8.8 + +## In both + +* checking package dependencies ... NOTE + ``` + Package which this enhances but not available for checking: ‘BiocInstaller’ + ``` + +* checking Rd cross-references ... NOTE + ``` + Packages unavailable to check Rd xrefs: ‘keras’, ‘tensorflow’ + ``` + diff --git a/scripts/git_clean.R b/scripts/git_clean.R new file mode 100644 index 000000000..31a0a3f88 --- /dev/null +++ b/scripts/git_clean.R @@ -0,0 +1,2 @@ +# run without --dry-run +system("git clean -xfd -e node_modules") diff --git a/scripts/revdepcheck.R b/scripts/revdepcheck.R new file mode 100644 index 000000000..520a2fcd7 --- /dev/null +++ b/scripts/revdepcheck.R @@ -0,0 +1,6 @@ +source("scripts/git_clean.R") + +if (!require("revdepcheck")) devtools::install_github("r-lib/revdepcheck") + +# revdepcheck::revdep_reset() +revdepcheck::revdep_check(num_workers = 4) diff --git a/scripts/rhub.R b/scripts/rhub.R new file mode 100644 index 000000000..dee6cb2a5 --- /dev/null +++ b/scripts/rhub.R @@ -0,0 +1,24 @@ +source("scripts/git_clean.R") + +if (!require("rhub", quietly = TRUE)) install.packages("rhub") + +cat("building...\n") +dir.create("../builds", recursive = TRUE, showWarnings = FALSE) +build_file <- rhub:::build_package(".", "../builds") + +platforms <- c("windows-x86_64-release", rhub:::default_cran_check_platforms(build_file)) +check_output <- rhub::check_for_cran( + build_file, + email = "barret@rstudio.com", + platforms = platforms, + env_vars = c("_R_CHECK_FORCE_SUGGESTS_" = "0"), + show_status = FALSE +) + +for (i in seq_along(platforms)) { + check_output$livelog(i) +} + +# check_output$web() + +print(check_output) diff --git a/tests/testthat/test-plumber.R b/tests/testthat/test-plumber.R index 80c23b58a..c6ad79a14 100644 --- a/tests/testthat/test-plumber.R +++ b/tests/testthat/test-plumber.R @@ -49,7 +49,18 @@ test_that("plumb accepts a file", { }) test_that("plumb gives a good error when passing in a dir instead of a file", { - expect_error(plumb("files/"), "Expecting a file but found a directory: 'files/'") + + if (identical( + tolower(Sys.info()[["sysname"]]), + "windows" + )) { + # https://stat.ethz.ch/R-manual/R-devel/library/base/html/files.html + # "However, directory names must not include a trailing backslash or slash on Windows" + expect_error(plumb("files/"), "File does not exist:") + } else { + expect_error(plumb("files/"), "Expecting a file but found a directory: 'files/'") + } + }) test_that("plumb accepts a directory with a `plumber.R` file", {