Test script to manually validate creating a new rdev package or R analysis package.

Setup

Load devtools. Load package manually using devtools::load_all(".") (command-shift-l).

# devtools already loaded
htmltools::tagList(
  xaringanExtra::use_clipboard(
    button_text = "<i class=\"fa fa-clipboard fa-2xl\"></i>",
    success_text = "<i class=\"fa fa-check fa-2xl\" style=\"color: #90BE6D\"></i>"
  ),
  rmarkdown::html_dependency_font_awesome()
)

Create GitHub Repository

Given:

When:

Creating a new GitHub repository with the following command:

rdev::create_github_repo("rdtest1", "rdev test package 1")

Then:

Regression

Regression tests:

rdev::create_github_repo("rdtest1")

Initialize rdev package

Given:

When:

Following ?quickstart, without committing to git, initialize the rdev package by running init() in the newly created project:

rdev::init()

When prompted, select "Yes" and "implicit mode":

Initialize rdev package (run after create_github_repo)? (yes/No/cancel) y

...

This project contains a DESCRIPTION file.
Which files should renv use for dependency discovery in this project? 

1: Use only the DESCRIPTION file. (explicit mode)
2: Use all files in this project. (implicit mode)

Selection: 2

Then:

There will be 22 new or changed files (new unless otherwise noted):

On GitHub:

Task:

Following ?quickstart, manually update the Title and Description fields in the DESCRIPTION file (without committing):

desc::desc_set(Title = "Rdev Test Package 1")
desc::desc_set(Description = "Used in manual testing of the rdev package.")

Regression

Regression tests:

dir .git/hooks/pre-commit
-rwxr--r--  1 agamemnon  staff  409 Jan 30 15:58 .git/hooks/pre-commit
cat .git/hooks/pre-commit
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#!/bin/bash
# forked from https://github.com/r-lib/usethis/blob/main/inst/templates/readme-rmd-pre-commit.sh
README=($(git diff --cached --name-only | grep -Ei '^README\.[R]?md$'))
MSG="use 'git commit --no-verify' to override this check"

if [[ ${#README[@]} == 0 ]]; then
  exit 0
fi

if [[ README.Rmd -nt README.md ]]; then
  echo -e "README.md is out of date; please re-knit README.Rmd\n$MSG"
  exit 1
fi

Setup rdev

Given:

When:

Following ?quickstart, without committing to git, running setup_rdev() to configure the package as an rdev package:

rdev::setup_rdev()

When prompted, answer "Yes" to all questions:

Set up rdev package (run after init)? (yes/No/cancel) y
...
Do you want to proceed? [Y/n]: y
...
Are you sure you want to update the wordlist?
1: Yes
2: No

Selection: 1
...
Do you want to proceed? [Y/n]: y
...
Do you want to proceed? [Y/n]: y

Additionally, ci() will run successfully, generating the following R CMD check note:

> checking package subdirectories ... NOTE
  Problems with news in ‘NEWS.md’:
  No news entries found.

Then:

If using RStudio, there will be 5 files open:

The following commits will be added to git:

Task:

Revert the changes to test use_analysis_package():

Regression

Regression tests:

Set up analysis package

Given:

When:

Following ?quickstart, without committing to git, running setup_analysis() to configure the package as an analysis package:

rdev::setup_analysis()

When prompted, answer "Yes" to all questions:

Set up analysis package (run after init)? (yes/No/cancel) y
...
Do you want to proceed? [Y/n]: y
...
Do you want to proceed? [Y/n]: y
...
Are you sure you want to update the wordlist?
1: Yes
2: No

Selection: 1

Additionally, ci() will run successfully, generating the following R CMD check note:

> checking package subdirectories ... NOTE
  Problems with news in ‘NEWS.md’:
  No news entries found.

Then:

If using RStudio, there will be 4 files open:

The following commits will be added to git:

Regression

Regression tests:

Build Quarto Site

Test the installation by the Quarto builder, which should throw an error:

build_quarto_site()

#> Error in build_analysis_site() : no *.Rmd or *.qmd files in analysis directory

Create an analysis notebook in RStudio using File > New File > R Markdown... > From Template > Analysis Notebook, save in analysis as test.Rmd, removing all library commands in the setup block except library(dplyr), remove order: in the header, and re-run the checks, which should complete successfully:

build_quarto_site()


jabenninghoff/rdev documentation built on April 21, 2024, 8:43 a.m.