From 897264c2a2479322fd0c2838a8a871c108614122 Mon Sep 17 00:00:00 2001 From: Ernest Guevarra Date: Mon, 22 Apr 2024 15:37:52 +0100 Subject: [PATCH 1/2] start issue template functions --- .../ISSUE_TEMPLATE/initial-cran-release.md | 16 +++++++++ NAMESPACE | 1 + R/add_contributing.R | 2 +- R/add_issue_templates.R | 35 +++++++++++++++++++ README.Rmd | 8 ++++- README.md | 23 +++++++++++- inst/CITATION | 10 ++++++ inst/templates/acceptance-cran.md | 15 ++++++++ inst/templates/initial-cran-release.md | 16 +++++++++ inst/templates/submission-cran.md | 13 +++++++ inst/templates/update-cran-release.md | 17 +++++++++ man/add_contributing.Rd | 4 +-- man/add_issue.Rd | 23 ++++++++++++ 13 files changed, 178 insertions(+), 5 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/initial-cran-release.md create mode 100644 R/add_issue_templates.R create mode 100644 inst/CITATION create mode 100644 inst/templates/acceptance-cran.md create mode 100644 inst/templates/initial-cran-release.md create mode 100644 inst/templates/submission-cran.md create mode 100644 inst/templates/update-cran-release.md create mode 100644 man/add_issue.Rd diff --git a/.github/ISSUE_TEMPLATE/initial-cran-release.md b/.github/ISSUE_TEMPLATE/initial-cran-release.md new file mode 100644 index 0000000..c43649d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/initial-cran-release.md @@ -0,0 +1,16 @@ +--- +name: Initial CRAN release +about: Checklist of tasks for initial CRAN release +title: Checklist of tasks for initial CRAN release +labels: documentation +assignees: ernestguevarra +--- + +* [ ] `usethis::use_news_md()` +* [ ] `usethis::use_cran_comments()` +* [ ] Update (aspirational) install instructions in `README` +* [ ] Proofread `Title:` and `Description:` +* [ ] Check that all exported functions have `@returns` and `@examples` +* [ ] Check that `Authors@R:` includes a copyright holder (role 'cph') +* [ ] Check licensing of included files +* [ ] Review https://github.com/DavisVaughan/extrachecks diff --git a/NAMESPACE b/NAMESPACE index 0138983..39968ac 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -3,6 +3,7 @@ export(add_badge_codefactor) export(add_badge_status) export(add_contributing) +export(add_issue_initial_release) export(add_logo) export(add_zenodo_badge) importFrom(jsonlite,fromJSON) diff --git a/R/add_contributing.R b/R/add_contributing.R index e9aafab..b528bc6 100644 --- a/R/add_contributing.R +++ b/R/add_contributing.R @@ -1,5 +1,5 @@ #' -#' Add contributing document +#' Add contributing markdown #' #' @param repo Short remote git repository name. If NULL, is determined based #' on current git settings. diff --git a/R/add_issue_templates.R b/R/add_issue_templates.R new file mode 100644 index 0000000..36967dd --- /dev/null +++ b/R/add_issue_templates.R @@ -0,0 +1,35 @@ +#' +#' Add issue templates +#' +#' @param path Path to file to add issue template into. Set to +#' ".github/ISSUE_TEMPLATE" which is the default location specified by +#' GitHub. +#' +#' @returns A specified issue template markdown file in the specified `path`. +#' +#' @examples +#' if (interactive()) add_issue_initial_release() +#' +#' @rdname add_issue +#' @export +#' + +add_issue_initial_release <- function(path = ".github/ISSUE_TEMPLATE") { + ## Create path ---- + if (!dir.exists(path)) dir.create(path) + + ## Get template ---- + issue_template <- readLines( + con = system.file( + "templates", "initial-cran-release.md", package = "pakete" + ) + ) + + withr::with_output_sink( + new = file.path(path, "initial-cran-release.md"), + code = writeLines( + text = issue_template, con = file.path(path, "initial-cran-release.md") + ) + ) +} + diff --git a/README.Rmd b/README.Rmd index e3609bb..0e5d7ed 100644 --- a/README.Rmd +++ b/README.Rmd @@ -39,7 +39,7 @@ Currently, `pakete` includes functions for: 5. adding `repostatus` badge; -## Installation· +## Installation You can install `pakete` via the [Katilingban R-universe](https://katilingban.r-universe.dev) as follows: @@ -54,6 +54,12 @@ install.packages( ## Citation +If you find the `pakete` package useful please cite using the suggested citation provided by a call to the `citation()` function as follows: + +```{r citation} +citation("pakete") +``` + ## Community guidelines Feedback, bug reports and feature requests are welcome; file issues or seek support [here](https://github.com/katilingban/pakete/issues). If you would like to contribute to the package, please see our [contributing guidelines](https://katilingban.io/pakete/CONTRIBUTING.html). diff --git a/README.md b/README.md index cc41fb0..ce838e2 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Currently, `pakete` includes functions for: 5. adding `repostatus` badge; -## Installation· +## Installation You can install `pakete` via the [Katilingban R-universe](https://katilingban.r-universe.dev) as follows: @@ -51,6 +51,27 @@ install.packages( ## Citation +If you find the `pakete` package useful please cite using the suggested +citation provided by a call to the `citation()` function as follows: + +``` r +citation("pakete") +#> To cite pakete in publications use: +#> +#> Ernest Guevarra (2024). _pakete: Utilities for Package Development_. +#> R package version 0.0.9000, . +#> +#> A BibTeX entry for LaTeX users is +#> +#> @Manual{, +#> title = {pakete: Utilities for Package Development}, +#> author = {{Ernest Guevarra}}, +#> year = {2024}, +#> note = {R package version 0.0.9000}, +#> url = {https://katilingban.io/pakete/}, +#> } +``` + ## Community guidelines Feedback, bug reports and feature requests are welcome; file issues or diff --git a/inst/CITATION b/inst/CITATION new file mode 100644 index 0000000..0fff548 --- /dev/null +++ b/inst/CITATION @@ -0,0 +1,10 @@ +bibentry( + bibtype = "Manual", + header = "To cite pakete in publications use:", + title = "pakete: Utilities for Package Development", + author = person("Ernest Guevarra"), + year = "2024", + note = "R package version 0.0.9000", + url = "https://katilingban.io/pakete/", + doi = "" +) diff --git a/inst/templates/acceptance-cran.md b/inst/templates/acceptance-cran.md new file mode 100644 index 0000000..42c3264 --- /dev/null +++ b/inst/templates/acceptance-cran.md @@ -0,0 +1,15 @@ +--- +name: Post-CRAN acceptance +about: Checklist of tasks for post-CRAN acceptance +title: Checklist of tasks for post-CRAN acceptance +labels: documentation +assignees: ernestguevarra +--- + +* [ ] Accepted +* [ ] `git push` +* [ ] `usethis::use_github_release()` +* [ ] `usethis::use_dev_version()` +* [ ] `git push` +* { ] Finish blog post, share on social media, etc. +* [ ] Add link to blog post in `pkgdown` news menu diff --git a/inst/templates/initial-cran-release.md b/inst/templates/initial-cran-release.md new file mode 100644 index 0000000..c43649d --- /dev/null +++ b/inst/templates/initial-cran-release.md @@ -0,0 +1,16 @@ +--- +name: Initial CRAN release +about: Checklist of tasks for initial CRAN release +title: Checklist of tasks for initial CRAN release +labels: documentation +assignees: ernestguevarra +--- + +* [ ] `usethis::use_news_md()` +* [ ] `usethis::use_cran_comments()` +* [ ] Update (aspirational) install instructions in `README` +* [ ] Proofread `Title:` and `Description:` +* [ ] Check that all exported functions have `@returns` and `@examples` +* [ ] Check that `Authors@R:` includes a copyright holder (role 'cph') +* [ ] Check licensing of included files +* [ ] Review https://github.com/DavisVaughan/extrachecks diff --git a/inst/templates/submission-cran.md b/inst/templates/submission-cran.md new file mode 100644 index 0000000..8b99c06 --- /dev/null +++ b/inst/templates/submission-cran.md @@ -0,0 +1,13 @@ +--- +name: CRAN submission +about: Checklist of tasks for CRAN submission +title: Checklist of tasks for CRAN submission +labels: documentation +assignees: ernestguevarra +--- + +* [ ] `usethis::use_version('minor')` (or ‘patch’ or ‘major’) +* [ ] `devtools::submit_cran()` +* [ ] Approve email + + diff --git a/inst/templates/update-cran-release.md b/inst/templates/update-cran-release.md new file mode 100644 index 0000000..91b7783 --- /dev/null +++ b/inst/templates/update-cran-release.md @@ -0,0 +1,17 @@ +--- +name: Update CRAN release +about: Checklist of tasks for update CRAN release +title: Checklist of tasks for update CRAN release +labels: documentation +assignees: ernestguevarra +--- + +* [ ] Check current CRAN check results +* [ ] Check if any deprecation processes should be advanced, as described in [Gradual deprecation](https://lifecycle.r-lib.org/articles/communicate.html#gradual-deprecation) +* [ ] [Polish NEWS](https://style.tidyverse.org/news.html#news-release) +* [ ] `urlchecker::url_check()` +* [ ] `devtools::build_readme()` +* [ ] `devtools::check(remote = TRUE, manual = TRUE)` +* [ ] `devtools::check_win_devel()` +* [ ] `usethis::use_revdep()` then `revdepcheck::revdep_check(num_workers = 4)` +* [ ] Update `cran-comments.md` diff --git a/man/add_contributing.Rd b/man/add_contributing.Rd index eba5e62..85fab8e 100644 --- a/man/add_contributing.Rd +++ b/man/add_contributing.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/add_contributing.R \name{add_contributing} \alias{add_contributing} -\title{Add contributing document} +\title{Add contributing markdown} \usage{ add_contributing(repo = NULL) } @@ -14,7 +14,7 @@ on current git settings.} A CONTRIBUTING.md file in the `.github` directory } \description{ -Add contributing document +Add contributing markdown } \examples{ if (interactive()) add_contributing("katilingban/pakete") diff --git a/man/add_issue.Rd b/man/add_issue.Rd new file mode 100644 index 0000000..4d79c23 --- /dev/null +++ b/man/add_issue.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/add_issue_templates.R +\name{add_issue_initial_release} +\alias{add_issue_initial_release} +\title{Add issue templates} +\usage{ +add_issue_initial_release(path = ".github/ISSUE_TEMPLATE") +} +\arguments{ +\item{path}{Path to file to add issue template into. Set to +".github/ISSUE_TEMPLATE" which is the default location specified by +GitHub.} +} +\value{ +A specified issue template markdown file in the specified `path`. +} +\description{ +Add issue templates +} +\examples{ +if (interactive()) add_issue_initial_release() + +} From 2cd94335d5faf1cea031f4e2757ae09a4c17ea53 Mon Sep 17 00:00:00 2001 From: Ernest Guevarra Date: Mon, 22 Apr 2024 16:43:07 +0100 Subject: [PATCH 2/2] complete add issue template functions --- NAMESPACE | 2 +- R/add_issue_templates.R | 44 ++++++++++++++++++++++++++++++----------- man/add_issue.Rd | 15 ++++++++++---- 3 files changed, 44 insertions(+), 17 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 39968ac..92992e5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -3,7 +3,7 @@ export(add_badge_codefactor) export(add_badge_status) export(add_contributing) -export(add_issue_initial_release) +export(add_issue_template) export(add_logo) export(add_zenodo_badge) importFrom(jsonlite,fromJSON) diff --git a/R/add_issue_templates.R b/R/add_issue_templates.R index 36967dd..c3ddd2b 100644 --- a/R/add_issue_templates.R +++ b/R/add_issue_templates.R @@ -1,35 +1,55 @@ #' #' Add issue templates #' +#' @param issue A character value of type of issue template to create. Choices +#' are *"initial-cran-release"*, *"update-cran-release"*, +#' *"submission-cran"*, and *"acceptance-cran"*. #' @param path Path to file to add issue template into. Set to #' ".github/ISSUE_TEMPLATE" which is the default location specified by #' GitHub. +#' @param overwrite Logical. If an exising issue template with the same file +#' name is found, should it be overwritten? Default to FALSE. #' #' @returns A specified issue template markdown file in the specified `path`. #' #' @examples -#' if (interactive()) add_issue_initial_release() +#' if (interactive()) add_issue_template("initial-cran-release") #' #' @rdname add_issue #' @export #' -add_issue_initial_release <- function(path = ".github/ISSUE_TEMPLATE") { +add_issue_template <- function(issue, + path = ".github/ISSUE_TEMPLATE", + overwrite = FALSE) { ## Create path ---- if (!dir.exists(path)) dir.create(path) - ## Get template ---- - issue_template <- readLines( - con = system.file( - "templates", "initial-cran-release.md", package = "pakete" + ## Get issue template file name ---- + template_file_name <- paste0(issue, ".md") + + ## Check if file already exists ---- + if (file.exists(file.path(path, template_file_name)) & !overwrite) { + message( + "Issue template already exists and overwrite = FALSE. No changes made." + ) + } else { + ## Get template ---- + issue_template <- readLines( + con = system.file("templates", template_file_name, package = "pakete") + ) + + withr::with_output_sink( + new = file.path(path, template_file_name), + code = writeLines( + text = issue_template, con = file.path(path, template_file_name) + ) ) - ) - withr::with_output_sink( - new = file.path(path, "initial-cran-release.md"), - code = writeLines( - text = issue_template, con = file.path(path, "initial-cran-release.md") + message( + paste0( + "Issue template created at ", file.path(path, template_file_name), ".") ) - ) + } } diff --git a/man/add_issue.Rd b/man/add_issue.Rd index 4d79c23..5168cf7 100644 --- a/man/add_issue.Rd +++ b/man/add_issue.Rd @@ -1,15 +1,22 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/add_issue_templates.R -\name{add_issue_initial_release} -\alias{add_issue_initial_release} +\name{add_issue_template} +\alias{add_issue_template} \title{Add issue templates} \usage{ -add_issue_initial_release(path = ".github/ISSUE_TEMPLATE") +add_issue_template(issue, path = ".github/ISSUE_TEMPLATE", overwrite = FALSE) } \arguments{ +\item{issue}{A character value of type of issue template to create. Choices +are *"initial-cran-release"*, *"update-cran-release"*, +*"submission-cran"*, and *"acceptance-cran"*.} + \item{path}{Path to file to add issue template into. Set to ".github/ISSUE_TEMPLATE" which is the default location specified by GitHub.} + +\item{overwrite}{Logical. If an exising issue template with the same file +name is found, should it be overwritten? Default to FALSE.} } \value{ A specified issue template markdown file in the specified `path`. @@ -18,6 +25,6 @@ A specified issue template markdown file in the specified `path`. Add issue templates } \examples{ -if (interactive()) add_issue_initial_release() +if (interactive()) add_issue_template("initial-cran-release") }