From 7349d7d11e6c58bc4517c82a8208acae6b55cea8 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Tue, 31 Oct 2023 08:56:26 -0500 Subject: [PATCH] Start with a PR --- R/upkeep.R | 12 ++++++++++-- tests/testthat/_snaps/upkeep.md | 6 +++++- tests/testthat/test-upkeep.R | 4 +++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/R/upkeep.R b/R/upkeep.R index 540debaa1..e2ae3f66a 100644 --- a/R/upkeep.R +++ b/R/upkeep.R @@ -121,13 +121,21 @@ use_tidy_upkeep_issue <- function(year = NULL) { make_upkeep_issue(year = year, tidy = TRUE) } +# for mocking +Sys.Date <- NULL + tidy_upkeep_checklist <- function(year = NULL, posit_pkg = is_posit_pkg(), posit_person_ok = is_posit_person_canonical(), repo_spec = "OWNER/REPO") { year <- year %||% 2000 - bullets <- c() + bullets <- c( + "### To begin", + "", + todo('`pr_init("upkeep-{format(Sys.Date(), "%Y-%m")}")`'), + "" + ) if (year <= 2000) { bullets <- c( @@ -232,7 +240,7 @@ tidy_upkeep_checklist <- function(year = NULL, bullets <- c( bullets, - "### Eternal", + "### To finish", "", todo("`usethis::use_mit_license()`", grepl("MIT", desc$get_field("License"))), todo('`usethis::use_package("R", "Depends", "{tidy_minimum_r_version()}")`'), diff --git a/tests/testthat/_snaps/upkeep.md b/tests/testthat/_snaps/upkeep.md index 273881226..f6c22b30d 100644 --- a/tests/testthat/_snaps/upkeep.md +++ b/tests/testthat/_snaps/upkeep.md @@ -3,6 +3,10 @@ Code writeLines(tidy_upkeep_checklist(posit_pkg = TRUE, posit_person_ok = FALSE)) Output + ### To begin + + * [ ] `pr_init("upkeep-2023-01")` + ### Pre-history * [ ] `usethis::use_readme_rmd()` @@ -45,7 +49,7 @@ or [file an issue](new) if you don't have time to do it now * [ ] Add alt-text to pictures, plots, etc; see https://posit.co/blog/knitr-fig-alt/ for examples - ### Eternal + ### To finish * [ ] `usethis::use_mit_license()` * [ ] `usethis::use_package("R", "Depends", "3.6")` diff --git a/tests/testthat/test-upkeep.R b/tests/testthat/test-upkeep.R index cb6c04250..78585cb04 100644 --- a/tests/testthat/test-upkeep.R +++ b/tests/testthat/test-upkeep.R @@ -9,6 +9,8 @@ test_that("tidy upkeep bullets don't change accidentally", { License = "MIT + file LICENSE" ) ) + local_mocked_bindings(Sys.Date = function() as.Date("2023-01-01")) + create_local_package() expect_snapshot( @@ -34,7 +36,7 @@ test_that("upkeep bullets don't change accidentally",{ use_testthat() withr::local_file("cran-comments.md") writeLines( - "## Test environments\\n\\n* local Ubuntu\\n\\# R CMD check results\\n", + "## Test environments\\n\\n* local Ubuntu\\n\\# R CMD check results\\n", "cran-comments.md" ) local_mocked_bindings(git_default_branch = function() "master")