Skip to content

Commit

Permalink
RC branch (blastula 0.3.0) (#112)
Browse files Browse the repository at this point in the history
* Modify tests so that they work on CRAN

* Update README

* Update NEWS.md

* Remove Appveyor and fix README

* Fix docs for `add_cta_button()`

* Update version number
  • Loading branch information
rich-iannone authored Nov 22, 2019
1 parent f12c907 commit 16fe481
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 87 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: blastula
Title: Easily Send HTML Email Messages
Version: 0.2.99.9000
Version: 0.3.0
Authors@R: c(
person("Richard", "Iannone", role = c("aut", "cre"), email = "[email protected]",
comment = c(ORCID = "0000-0003-3925-190X")),
Expand Down
16 changes: 13 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# blastula 0.3.0 (Unreleased)
# blastula 0.3.0

The blastula package has transitioned to using the **curl** package for SMTP mailing.
The **blastula** package has transitioned to using the **curl** package for SMTP mailing.

There are new functions for integrating **blastula** with R Markdown publishing on the RStudio Connect service. And sophisticated email bodies can be generated with *HTML Blocks*.

## Breaking Changes

* `send_email_out()` has been removed; the `smtp_send()` function is its replacement for sending email through an SMTP server

* The `create_email_creds_file()` function has been removed in favor of a suite of functions for storing SMTP credentials (`create_smtp_creds_file()`, `create_smtp_creds_key()`); the following credentials helper functions are available for retrieving credentials during sending: `creds_file()`, `creds_key()`, `creds_anonymous()`, and `creds()`
* The revised `smtp_send()` function internally uses `curl::send_mail()` to send RFC2822 email message that **blastula** now independently generates; now, there is no need to download third-party binaries to send via SMTP

* The `smtp_send()` no longer offers text interpolation in `{ }` (which was provided by `glue::glue()`) since this poses a security risk; email strings can be precomposed using `glue::glue()` independently, or, by using `c()`, `paste()`/`paste0`.

* If an email message string contains Markdown text or HTML fragments, the `md()` function must be used to perform rendering

* The `create_email_creds_file()` function has been removed in favor of a suite of functions for storing SMTP configuration info and credentials (`create_smtp_creds_file()`, `create_smtp_creds_key()`); the following credentials helper functions are available for retrieving or directly specifying configuration and credentials during sending: `creds_file()`, `creds_key()`, `creds_anonymous()`, and `creds()`

* The `preview_email()` function has been removed as email objects created by `compose_email()` now have a print method

Expand All @@ -20,6 +26,10 @@ There are new functions for integrating **blastula** with R Markdown publishing

* The `compose_email()` function now has a `header` argument, allowing for content to populate the area above the `body`

* Images embedded in email messages by using `add_image()` are now properly encoded as Base64 in the outgoing message; more MIME types are supported thanks to functions provided by the **mime** package

* The new `add_imgur_image()` function allows us to deploy a local image to Imgur and retrieve the image tag (all in one step); this is useful if you want to use external images in an email message

* We can now build sophisticated email messages with HTML blocks. With these responsive, higher-level components, we can create compose elements within the `header`, `body`, and `footer` components. The functions now available for this system are: `blocks()`, `block_title()`, `block_text()`, `block_spacer()`, `block_articles()`, and `block_social_links()`. Two useful subcomponent functions are `article()` and `social_link()`.

## Notes
Expand Down
15 changes: 8 additions & 7 deletions R/add_cta_button.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@
#' # Include the button in the email
#' # message body by using it as part of
#' # a vector inside of `md()`
#' compose_email(
#' body = md(
#' c(
#' "Pressing the button will take
#' you to an example website",
#' cta_button
#' email <-
#' compose_email(
#' body = md(
#' c(
#' "Pressing the button will take
#' you to an example website",
#' cta_button
#' )
#' )
#' )
#' )
#'
#' if (interactive()) email
#'
Expand Down
17 changes: 11 additions & 6 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ library(blastula)

[![CRAN status](https://www.r-pkg.org/badges/version/blastula)](https://CRAN.R-project.org/package=blastula)
[![Travis-CI Build Status](https://travis-ci.org/rich-iannone/blastula.svg?branch=master)](https://travis-ci.org/rich-iannone/blastula)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/rich-iannone/blastula?branch=master&svg=true)](https://ci.appveyor.com/project/rich-iannone/blastula)
[![Codecov test coverage](https://codecov.io/gh/rich-iannone/blastula/branch/master/graph/badge.svg)](https://codecov.io/gh/rich-iannone/blastula?branch=master)

## Overview
Expand Down Expand Up @@ -76,7 +75,7 @@ After creating the email message, we can look at it to ensure that the formattin

```{r preview_email, eval=FALSE}
# Preview the email
email_object
email
```

<img src="man/figures/rstudio_preview_email.png">
Expand All @@ -89,17 +88,23 @@ Having generated a credentials file, we can use the `smtp_send()` function (alon

```{r smtp_send, eval=FALSE}
# Sending email by SMTP using a credentials file
email_object %>%
email %>%
smtp_send(
to = "[email protected]",
from = "personal@email.net",
to = "[email protected]",
from = "joe_public@example.net",
subject = "Testing the `smtp_send()` function",
credentials = creds_file("email_creds")
)
```

## Installation

The **blastula** package can be installed from CRAN with `install.packages()`.

```{r install_cran, eval=FALSE}
install.packages("blastula")
```

You can install the in-development version of **blastula** from **GitHub** using the **devtools** package.

```{r install_github, eval=FALSE}
Expand All @@ -111,7 +116,7 @@ If you encounter a bug, have usage questions, or want to share ideas to make thi

## Code of Conduct

Please note that the **blastula** project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.
Please note that the **blastula** project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/1/0/0). By contributing to this project, you agree to abide by its terms.

## License

Expand Down
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
status](https://www.r-pkg.org/badges/version/blastula)](https://CRAN.R-project.org/package=blastula)
[![Travis-CI Build
Status](https://travis-ci.org/rich-iannone/blastula.svg?branch=master)](https://travis-ci.org/rich-iannone/blastula)
[![AppVeyor build
status](https://ci.appveyor.com/api/projects/status/github/rich-iannone/blastula?branch=master&svg=true)](https://ci.appveyor.com/project/rich-iannone/blastula)
[![Codecov test
coverage](https://codecov.io/gh/rich-iannone/blastula/branch/master/graph/badge.svg)](https://codecov.io/gh/rich-iannone/blastula?branch=master)

Expand Down Expand Up @@ -80,7 +78,7 @@ displayed in the Viewer.

``` r
# Preview the email
email_object
email
```

<img src="man/figures/rstudio_preview_email.png">
Expand All @@ -99,17 +97,24 @@ send the email through an SMTP server.

``` r
# Sending email by SMTP using a credentials file
email_object %>%
email %>%
smtp_send(
to = "[email protected]",
from = "personal@email.net",
to = "[email protected]",
from = "joe_public@example.net",
subject = "Testing the `smtp_send()` function",
credentials = creds_file("email_creds")
)
```

## Installation

The **blastula** package can be installed from CRAN with
`install.packages()`.

``` r
install.packages("blastula")
```

You can install the in-development version of **blastula** from
**GitHub** using the **devtools** package.

Expand All @@ -125,8 +130,9 @@ make this package better, feel free to file an
## Code of Conduct

Please note that the **blastula** project is released with a
[Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to
this project, you agree to abide by its terms.
[Contributor Code of
Conduct](https://contributor-covenant.org/version/1/0/0). By
contributing to this project, you agree to abide by its terms.

## License

Expand Down
52 changes: 0 additions & 52 deletions appveyor.yml

This file was deleted.

15 changes: 8 additions & 7 deletions man/add_cta_button.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions tests/testthat/test-html_manip.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,15 @@ test_that("src resolution works correctly", {
expect_equal(src_to_filepath("/foo%20bar", "/baz"), "/foo bar")
expect_equal(src_to_filepath("/foo%20bar", "/baz"), "/foo bar")
expect_equal(src_to_filepath("/foo%20bar", "."), "/foo bar")
expect_equal(src_to_filepath("foo%20bar", "."), file.path(getwd(), "foo bar"))
expect_equal(src_to_filepath("../a/b", "/c/d"), "/c/a/b")

# Because of the potential for drive letters to be of
# different cases, we transform the whole string to lower case
expect_equal(tolower(src_to_filepath("foo%20bar", ".")), tolower(file.path(getwd(), "foo bar")))
expect_equal(tolower(src_to_filepath("foo", "")), tolower(file.path(getwd(), "foo")))

expect_equal(src_to_filepath("../a/b", "/c/d"), "/c/a/b")
expect_equal(src_to_filepath("C:\\foo\\bar", "/baz"), "C:/foo/bar")
# Newer versions of fs capitalize drive letters
expect_true(src_to_filepath("foo/bar", "c:\\baz") %in% c("c:/baz/foo/bar", "C:/baz/foo/bar"))
expect_true(src_to_filepath("", "c:\\baz") %in% c("c:/baz", "C:/baz"))
expect_equal(src_to_filepath("foo", ""), file.path(getwd(), "foo"))
})

0 comments on commit 16fe481

Please sign in to comment.