Skip to content

Commit

Permalink
Start with a PR
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Oct 31, 2023
1 parent b8da7fb commit 7349d7d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
12 changes: 10 additions & 2 deletions R/upkeep.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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()}")`'),
Expand Down
6 changes: 5 additions & 1 deletion tests/testthat/_snaps/upkeep.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Expand Down Expand Up @@ -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")`
Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/test-upkeep.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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")
Expand Down

0 comments on commit 7349d7d

Please sign in to comment.