~hrbrmstr/markdowntemplates

29b3c1996ed40f71a5394b6dfdc012753924acb5 — hrbrmstr 1 year, 27 days ago 30d9538 master
google drive auto-upload template
A inst/rmarkdown/templates/gdriveupload/skeleton/skeleton.Rmd => inst/rmarkdown/templates/gdriveupload/skeleton/skeleton.Rmd +58 -0
@@ 0,0 1,58 @@
---
title: ""
author: ""
date: ""
params:
  gdrive_folder_url: "https://drive.google.com/drive/u/0/folders/FIXME"
output:
  html_document:
    keep_md: true
    theme: simplex
    highlight: monochrome
---
```{r init, include=FALSE}
knitr::opts_chunk$set(
  message = FALSE,
  warning = FALSE, dev = c("png", "cairo_pdf"),
  echo = FALSE,
  fig.retina = 2,
  fig.width = 10,
  fig.height = 6,
  fig.path = "prod/charts/"
)
```

```{r boilerplate-libraries, cache=FALSE}
library(gt)
library(stringi)
library(hrbrthemes)
library(googledrive)
library(tidyverse)

# ensure fonts are available
extrafont::loadfonts("postscript", quiet = TRUE)
extrafont::loadfonts("pdf", quiet = TRUE)
```

# analysis code goes here -------------------------------------------------


# Upload to production ----------------------------------------------------

```{r prod-upload, echo = TRUE, message = TRUE, warning = TRUE}
googledrive::drive_auth()

# locate the folder
gdrive_prod_folder <- googledrive::as_id(params$gdrive_folder_url)

# clean it out
gdrls <- googledrive::drive_ls(gdrive_prod_folder)
if (nrow(gdrls) > 0) {
  dplyr::pull(gdrls, id) %>%
    purrr::walk(~googledrive::drive_rm(googledrive::as_id(.x)))
}

# upload new
list.files(here::here("prod/charts"), recursive = TRUE, full.names = TRUE) %>%
  purrr::walk(googledrive::drive_upload, path = gdrive_prod_folder)
```
\ No newline at end of file

A inst/rmarkdown/templates/gdriveupload/template.yaml => inst/rmarkdown/templates/gdriveupload/template.yaml +4 -0
@@ 0,0 1,4 @@
name: Google Drive Auto-Uploader
description: >
  Pre-configured Production Template for Automatic Artifact Uplaods to Google Drive
create_dir: false

M man/bulma.Rd => man/bulma.Rd +1 -1
@@ 18,7 18,7 @@ bulma(number_sections = FALSE, fig_width = 7, fig_height = 5,

\item{fig_width}{Default width (in inches) for figures}

\item{fig_height}{Default width (in inches) for figures}
\item{fig_height}{Default height (in inches) for figures}

\item{fig_retina}{Scaling to perform for retina displays (defaults to 2, which
currently works for all widely used retina displays). Set to \code{NULL} to

M man/hrbrmrkdn.Rd => man/hrbrmrkdn.Rd +1 -1
@@ 17,7 17,7 @@ hrbrmrkdn(number_sections = FALSE, fig_width = 7, fig_height = 5,

\item{fig_width}{Default width (in inches) for figures}

\item{fig_height}{Default width (in inches) for figures}
\item{fig_height}{Default height (in inches) for figures}

\item{fig_retina}{Scaling to perform for retina displays (defaults to 2, which
currently works for all widely used retina displays). Set to \code{NULL} to

M man/hugo.Rd => man/hugo.Rd +1 -1
@@ 15,7 15,7 @@ hugo(toc = FALSE, toc_depth = 3, fig_width = 7, fig_height = 5,

\item{fig_width}{Default width (in inches) for figures}

\item{fig_height}{Default width (in inches) for figures}
\item{fig_height}{Default height (in inches) for figures}

\item{fig_retina}{Scaling to perform for retina displays. Defaults to
\code{NULL} which performs no scaling. A setting of 2 will work for all

M man/kickstart.Rd => man/kickstart.Rd +1 -1
@@ 18,7 18,7 @@ kickstart(number_sections = FALSE, fig_width = 7, fig_height = 5,

\item{fig_width}{Default width (in inches) for figures}

\item{fig_height}{Default width (in inches) for figures}
\item{fig_height}{Default height (in inches) for figures}

\item{fig_retina}{Scaling to perform for retina displays (defaults to 2, which
currently works for all widely used retina displays). Set to \code{NULL} to

M man/kube.Rd => man/kube.Rd +1 -1
@@ 18,7 18,7 @@ kube(number_sections = FALSE, fig_width = 7, fig_height = 5,

\item{fig_width}{Default width (in inches) for figures}

\item{fig_height}{Default width (in inches) for figures}
\item{fig_height}{Default height (in inches) for figures}

\item{fig_retina}{Scaling to perform for retina displays (defaults to 2, which
currently works for all widely used retina displays). Set to \code{NULL} to

M man/minimal.Rd => man/minimal.Rd +1 -1
@@ 17,7 17,7 @@ minimal(number_sections = FALSE, fig_width = 7, fig_height = 5,

\item{fig_width}{Default width (in inches) for figures}

\item{fig_height}{Default width (in inches) for figures}
\item{fig_height}{Default height (in inches) for figures}

\item{fig_retina}{Scaling to perform for retina displays (defaults to 2, which
currently works for all widely used retina displays). Set to \code{NULL} to

M man/prismpress.Rd => man/prismpress.Rd +1 -1
@@ 16,7 16,7 @@ prismpress(toc = FALSE, toc_depth = 3, fig_width = 7,

\item{fig_width}{Default width (in inches) for figures}

\item{fig_height}{Default width (in inches) for figures}
\item{fig_height}{Default height (in inches) for figures}

\item{dev}{Graphics device to use for figure output (defaults to png)}


M man/prismskel.Rd => man/prismskel.Rd +1 -1
@@ 18,7 18,7 @@ prismskel(number_sections = FALSE, fig_width = 7, fig_height = 5,

\item{fig_width}{Default width (in inches) for figures}

\item{fig_height}{Default width (in inches) for figures}
\item{fig_height}{Default height (in inches) for figures}

\item{fig_retina}{Scaling to perform for retina displays (defaults to 2, which
currently works for all widely used retina displays). Set to \code{NULL} to

M man/rst_skeleton.Rd => man/rst_skeleton.Rd +1 -1
@@ 18,7 18,7 @@ rst_skeleton(number_sections = FALSE, fig_width = 7, fig_height = 5,

\item{fig_width}{Default width (in inches) for figures}

\item{fig_height}{Default width (in inches) for figures}
\item{fig_height}{Default height (in inches) for figures}

\item{fig_retina}{Scaling to perform for retina displays (defaults to 2, which
currently works for all widely used retina displays). Set to \code{NULL} to

M man/skeleton.Rd => man/skeleton.Rd +1 -1
@@ 21,7 21,7 @@ default(...)

\item{fig_width}{Default width (in inches) for figures}

\item{fig_height}{Default width (in inches) for figures}
\item{fig_height}{Default height (in inches) for figures}

\item{fig_retina}{Scaling to perform for retina displays (defaults to 2, which
currently works for all widely used retina displays). Set to \code{NULL} to

M man/to_jupyter.Rd => man/to_jupyter.Rd +1 -1
@@ 25,7 25,7 @@ You specify this as a \code{knit:} replacement in an Rmd YAML header:
\preformatted{---
title: "ggplot2 example"
knit: markdowntemplates::to_jupyter
output: md_document
run: true
---

## Introduction to ggplot2