Skip to content

Commit

Permalink
RStudio Connect => Posit Connect (#334)
Browse files Browse the repository at this point in the history
* RStudio Connect => Posit Connect

* Update R/connect_email.R

---------

Co-authored-by: Neal Richardson <[email protected]>
  • Loading branch information
aronatkins and nealrichardson authored Jul 9, 2024
1 parent 8ff958a commit 4b34845
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Description: Compose and send out responsive HTML email messages that render
perfectly across a range of email clients and device sizes. Helper functions
let the user insert embedded images, web link buttons, and 'ggplot2' plot
objects into the message body. Messages can be sent through an 'SMTP'
server, through the 'RStudio Connect' service, or through the 'Mailgun' API
server, through the 'Posit Connect' service, or through the 'Mailgun' API
service <https://www.mailgun.com/>.
Authors@R: c(
person("Richard", "Iannone", role = c("aut", "cre"), email = "[email protected]",
Expand Down Expand Up @@ -51,7 +51,7 @@ Suggests:
withr
SystemRequirements: pandoc (>= 1.12.3) - http://pandoc.org
Encoding: UTF-8
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
Config/testthat/edition: 3
Language: en-US
12 changes: 6 additions & 6 deletions R/connect_email.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Associate an email when publishing an R Markdown document to RStudio Connect
#' Associate an email when publishing an R Markdown document to Posit Connect
#'
#' This function is used to customize emails sent by RStudio Connect in
#' This function is used to customize emails sent by Posit Connect in
#' conjunction with publishing an R Markdown document. It associates a custom
#' email message with the main R Markdown document, which Connect can send to
#' selected recipients. The main input is a rendered email message, which can be
Expand All @@ -19,7 +19,7 @@
#' @param subject An option to specify the the email subject while attaching the
#' email object.
#' @param attachments A vector of attachments for the Connect email. These files
#' can be any of those deployed when publishing to RStudio Connect, and, any
#' can be any of those deployed when publishing to Posit Connect, and, any
#' generated files (via R Markdown rendering).
#' @param attach_output Should the rendered output of the main R Markdown
#' document be included as an email attachment? By default, this is `FALSE`.
Expand Down Expand Up @@ -93,7 +93,7 @@ attach_connect_email <- function(
}
}

# Set the RStudio Connect output metadata options for the email message
# Set the Posit Connect output metadata options for the email message
# body and for the images therein
rmarkdown::output_metadata$set(rsc_email_body_html = email$html_str)
rmarkdown::output_metadata$set(rsc_email_images = email$images)
Expand Down Expand Up @@ -128,7 +128,7 @@ attach_connect_email <- function(
invisible()
}

#' Suppress any scheduled emailing in RStudio Connect
#' Suppress any scheduled emailing in Posit Connect
#'
#' This function is useful for suppressing the scheduled emailing of a published
#' R Markdown document. It can be invoked anywhere in the R Markdown document
Expand Down Expand Up @@ -171,7 +171,7 @@ create_rmd_preview_message <- function(subject = NULL) {
paste0(
"<div style=\"text-align: center; background:#fcfcfc\">",
"<h2 style=\"margin-bottom: 0; padding-bottom: 0;\">",
"This is an email preview for RStudio Connect</h2>",
"This is an email preview for Posit Connect</h2>",
"<p style=\"text-align: center; background:#fcfcfc; ",
"padding-top: 0; margin-top: 0;\">",
"Use <code>attach_connect_email(preview = FALSE)</code> ",
Expand Down
6 changes: 3 additions & 3 deletions R/prepare_rsc_example_files.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Prepare example files for RStudio Connect emailing with R Markdown
#' Prepare example files for Posit Connect emailing with R Markdown
#'
#' A set of example files relevant to emailing with R Markdown in RStudio
#' Connect can be spawned in a specified location. There is a set of three files
Expand All @@ -22,10 +22,10 @@
#' The main report and associated email can be published by opening
#' `"connect-example-main.Rmd"` and pressing the Publish button at the top-right
#' of the Editor pane (please ensure beforehand that you are set up work with
#' RStudio Connect). If asked `"What do you want to publish?"`, choose the first
#' Posit Connect). If asked `"What do you want to publish?"`, choose the first
#' option where only the `"connect-example-main"` document is published. All
#' three files should be checked in the final dialog box, press the `Publish`
#' button to publish to RStudio Connect.
#' button to publish to Posit Connect.
#'
#' There is also the single `"connect-example-text-only.Rmd"` file that, when
#' published, serves as a mechanism to send a text-only email. The content of
Expand Down
2 changes: 1 addition & 1 deletion R/render_email.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' with the output specified as `output: blastula::blastula_email`. While the
#' `render_email()` and `render_connect_email()` functions have similar
#' arguments, the `render_connect_email()` is preferred when publishing to the
#' RStudio Connect service. It allows for the inclusion of a predefined footer
#' Posit Connect service. It allows for the inclusion of a predefined footer
#' that contains useful links for email recipients.
#'
#' @param input The input file to be rendered. This should be an R Markdown
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ email |>
)
```

### Sending Email Messages through RStudio Connect
### Sending Email Messages through Posit Connect

We can also send email based on **R Markdown** files through **RStudio Connect**. The `prepare_rsc_example_files()` function provides .Rmd files that facilitate a main report + email report workflow. The key components are the `blastula::blastula_email` output type for the email report, and the use of `render_connect_email()` and `attach_connect_email()` in the main report.
We can also send email based on **R Markdown** files through **Posit Connect**. The `prepare_rsc_example_files()` function provides .Rmd files that facilitate a main report + email report workflow. The key components are the `blastula::blastula_email` output type for the email report, and the use of `render_connect_email()` and `attach_connect_email()` in the main report.

### Installation

Expand Down
6 changes: 3 additions & 3 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ reference:
- delete_credential_key
- delete_all_credential_keys

- title: Email Sending through RStudio Connect
- title: Email Sending through Posit Connect
desc: >
Using the RStudio Connect service, it's possible to publish R Markdown
Using the Posit Connect service, it's possible to publish R Markdown
documents and provide a scheduled email based on the report. Example
.Rmd documents can be generated by using the `prepare_rsc_example_files()`
function. These files constitute a working example for a publishing
Expand Down Expand Up @@ -105,7 +105,7 @@ navbar:
menu:
- text: "Custom Emails with R Markdown and Blastula"
href: https://solutions.rstudio.com/r/blastula/
- text: "Customized Conditional Emails with RStudio Connect"
- text: "Customized Conditional Emails with Posit Connect"
href: https://solutions.rstudio.com/r/blastula/conditional-example/
- text: "Scheduling Data Science Tasks"
href: https://solutions.rstudio.com/data-science-admin/scheduling/
Expand Down
4 changes: 2 additions & 2 deletions inst/examples/connect-example-main.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ It looks like the year `r dallas_home_sales %>% filter(total_sales == max(total_
dallas_home_sales %>% write_csv("dallas_home_sales.csv")
```

We can create an email on **RStudio Connect** that aligns with the content from this report. We do this with the `render_connect_email()` and `attach_connect_email()` functions from the **blastula** package. The email subdocument (`"connect-example-email.Rmd"`) is used to craft the contents of the email, drawing upon results available in this document. Attachments for the email can added by using the arguments:
We can create an email on **Posit Connect** that aligns with the content from this report. We do this with the `render_connect_email()` and `attach_connect_email()` functions from the **blastula** package. The email subdocument (`"connect-example-email.Rmd"`) is used to craft the contents of the email, drawing upon results available in this document. Attachments for the email can added by using the arguments:

- `attachments` (for any output files or included files)
- `attach_output` (which attaches the rendered report)

```{r connect_email_setup, echo=FALSE}
render_connect_email(input = "connect-example-email.Rmd") %>%
attach_connect_email(
subject = "RStudio Connect HTML Email",
subject = "Posit Connect HTML Email",
attach_output = TRUE,
attachments = c("dallas_home_sales.csv", "austin_home_sales.csv")
)
Expand Down
4 changes: 2 additions & 2 deletions inst/examples/connect-example-text-only.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ library(blastula)

# An R Markdown Document for Sending an Email

We can create a text-only email using **RStudio Connect**. Only one function is required: `attach_connect_email()`. Files can be attached using the `attachments` argument.
We can create a text-only email using **Posit Connect**. Only one function is required: `attach_connect_email()`. Files can be attached using the `attachments` argument.

None of the content from this R Markdown file will be included in the email message body, but, if we wanted to, we could elect to attach the output file using `attach_output = TRUE`.

```{r connect_email, echo=FALSE}
attach_connect_email(
subject = "RStudio Connect Text Email",
subject = "Posit Connect Text Email",
attachments = "austin_home_sales.csv",
text = "
Expand Down
6 changes: 3 additions & 3 deletions man/attach_connect_email.Rd

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

6 changes: 3 additions & 3 deletions man/prepare_rsc_example_files.Rd

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

2 changes: 1 addition & 1 deletion man/render_email.Rd

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

2 changes: 1 addition & 1 deletion man/suppress_scheduled_email.Rd

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

2 changes: 1 addition & 1 deletion tests/testthat/test-connect_emailing.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test_that("The `create_rmd_preview_message()` function works properly", {
paste0(
"^<div style=\"text-align: center; background:#fcfcfc\">",
"<h2 style=\"margin-bottom: 0; padding-bottom: 0;\">",
"This is an email preview for RStudio Connect</h2>",
"This is an email preview for Posit Connect</h2>",
"<p style=\"text-align: center; background:#fcfcfc; padding-top: 0;.*?",
"</span></strong>Connect test message<br></p><hr></div>$"
)
Expand Down

0 comments on commit 4b34845

Please sign in to comment.