Skip to content

Latest commit

 

History

History
69 lines (58 loc) · 2.18 KB

README.md

File metadata and controls

69 lines (58 loc) · 2.18 KB

plumbpkg

Travis build status

This is a simple package illustrating how to incorporate Plumber APIs into an R package. There are two main motivations behind this example:

  1. Demonstrate how to build Plumber APIs into a package
  2. Demonstrate how to test Plumber APIs using testthat

Installation

# install.packages("remotes")
remotes::install_github("sol-eng/plumbpkg")

Architecture

The design of this package is heavily influenced by this discussion on RStudio Community.

── DESCRIPTION
├── LICENSE
├── LICENSE.md
├── NAMESPACE
├── R
│   ├── api1.R
│   └── api2.R
├── README.md
├── inst
│   └── plumber
│       ├── api1
│       │   └── plumber.R
│       └── api2
│           ├── entrypoint.R
│           └── plumber.R
├── man
├── plumbpkg.Rproj
└── tests
    ├── testthat
    │   ├── test-api1.R
    │   ├── test-api2.R
    │   └── test-plumber.R
    └── testthat.R

The R/ directory contains all of the R functions used in the Plumber APIs. This enables the functions to be tested using files in the tests/ directory. The Plumber APIs are defined in files in inst/plumber/ and are also tested using testthat and httr.

Deploy

This repository deploys both APIs to RStudio Connect using Travis. The deployment is managed by scripts/deploy-rsc.sh and uses the RStudio Connect API. Because this repository uses Travis, the APIs will only be deployed after tests have successfully completed.

There are certainly other ways this content could be deployed, either using other CI/CD solutions or using RStudio Connect's ability to publish content from a git repository.