Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ export(add_testthat)
export(add_to_buildignore)
export(add_to_gitignore)
export(add_vignette)
export(create_new_compendium)
export(create_new_package)
export(get_all_dependencies)
export(get_all_functions)
export(get_available_gh_actions)
export(get_available_issue_templates)
export(get_licenses)
export(get_minimal_r_version)
export(new_compendium)
export(new_package)
export(set_credentials)
importFrom(usethis,ui_code)
importFrom(usethis,ui_done)
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Remove all `add_github_actions_*()` functions. A new generic function `add_github_action()` has been implemented to set up any GitHub Action. This function downloads YAML files from the GitHub repository (see above), providing more flexibility in updating these files ([#87](https://github.com/FRBCesab/rcompendium/pull/87)).
* `refresh()` is no more available in this version ([#91](https://github.com/FRBCesab/rcompendium/pull/91))
* Refactor all functions by introducing new helpers ([#102](https://github.com/FRBCesab/rcompendium/pull/102))
* A new argument (user credential) has been implemented: `github_user`. The GitHub username is not guessed from `gh::gh_whoami()` anymore and the user needs to provide it. This new argument has been added to `set_credentials()` ([#125](https://github.com/FRBCesab/rcompendium/pull/125)) to permanently store this value.
* Rename `new_*()` functions in `create_new_*()`

* **New features**

Expand All @@ -14,6 +16,7 @@
* `add_dependabot()` creates a `.github/dependabot.yaml` file ([#102](https://github.com/FRBCesab/rcompendium/pull/102))
* `add_github_action()` automatically creates a `.github/dependabot.yaml` file if one GitHub Action is set up ([#89](https://github.com/FRBCesab/rcompendium/pull/89))
* `add_cran_downloads_badge()` & `add_cran_total_download_badge()` adds CRAN downloads badge to the `README.Rmd` ([#96](https://github.com/FRBCesab/rcompendium/pull/96))
* `add_issue_template()` creates a `.github/ISSUE_TEMPLATE` directory and store GitHub issue templates ([#119](https://github.com/FRBCesab/rcompendium/pull/119))

* **Bug fixes**

Expand Down
2 changes: 1 addition & 1 deletion R/add_dependencies.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#' `data/`, `outputs/`, `figures/`, etc. have been created in this folder),
#' `'.'` (if folders `data/`, `outputs/`, `figures/`, etc. have been created
#' at the root of the project), etc.
#' See [new_compendium()] for further information.
#' See [create_new_compendium()] for further information.
#'
#' Default is `compendium = NULL` (i.e. no additional folder are inspected
#' but `R/`, `NAMESPACE`, `vignettes/`, and `tests/` are still inspected).
Expand Down
2 changes: 1 addition & 1 deletion R/add_makefile.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' This function creates a Make-like R file (`make.R`) at the root of the
#' project based on a template. To be used only if the project is a research
#' compendium. The content of this file provides some guidelines. See also
#' [new_compendium()] for further information.
#' [create_new_compendium()] for further information.
#'
#' @inheritParams add_citation
#' @inheritParams set_credentials
Expand Down
21 changes: 13 additions & 8 deletions R/new_compendium.R → R/create_new_compendium.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#' This function creates a research compendium (i.e. a predefined files/folders
#' structure) to help user organizing files/folders to run analysis.
#'
#' In addition to common R packages files/folders (see [new_package()] for
#' further information) this function will created these following folders:
#' In addition to common R packages files/folders (see [create_new_package()]
#' for further information) this function will created these following folders:
#'
#' * `data/`: a folder to store raw data. Note that these data must never be
#' modified. If user want to modify them it is recommended to export new data
Expand Down Expand Up @@ -101,7 +101,7 @@
#' @param create_repo A logical value. If `TRUE` (default) creates a repository
#' (public if `private = FALSE` or private if `private = TRUE`) on GitHub.
#' See the section **Creating a GitHub repo** of the help page of
#' [new_package()].
#' [create_new_package()].
#'
#' @param private A logical value. If `TRUE` creates a private repository on
#' user GitHub account (or organisation). Default is `private = FALSE`.
Expand Down Expand Up @@ -204,18 +204,23 @@
#' library(rcompendium)
#'
#' ## Define **ONCE FOR ALL** your credentials ----
#' set_credentials(given = "John", family = "Doe",
#' email = "john.doe@@domain.com",
#' orcid = "9999-9999-9999-9999", protocol = "ssh")
#' set_credentials(
#' given = "John",
#' family = "Doe",
#' email = "john.doe@@domain.com",
#' orcid = "9999-9999-9999-9999",
#' github_user = "jdoe",
#' protocol = "ssh"
#' )
#'
#' ## Create an R package ----
#' new_compendium()
#' create_new_compendium()
#'
#' ## Start adding data and developing functions and scripts ----
#' ## ...
#' }

new_compendium <- function(
create_new_compendium <- function(
compendium = NULL,
license = "GPL (>= 2)",
status = NULL,
Expand Down
21 changes: 13 additions & 8 deletions R/new_package.R → R/create_new_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
#' The recommended workflow is:
#' 1. Create an empty RStudio project;
#' 2. Store your credentials with [set_credentials()] (if not already done);
#' 3. Run [new_package()] to create a new package structure (and the GitHub
#' 3. Run [create_new_package()] to create a new package structure (and the GitHub
#' repository);
#' 4. Edit some metadata in `DESCRIPTION`, `CITATION`, and `README.Rmd`;
#' 5. Implement, document & test functions (the fun part);
Expand All @@ -211,7 +211,7 @@
#'
#'
#' You can use the arguments `given`, `family`, `email`, and `orcid`
#' directly with the function [new_package()] (and others). But if you create
#' directly with the function [create_new_package()] (and others). But if you create
#' a lot a projects (packages and/or compendiums) it can be frustrating in the
#' long run.
#'
Expand All @@ -223,7 +223,7 @@
#'
#' Even if you have stored your information in the `.Rprofile` file you will
#' always be able to modify them on-the-fly (i.e. by using arguments of the
#' [new_package()]) or permanently by re-running [set_credentials()].
#' [create_new_package()]) or permanently by re-running [set_credentials()].
#'
#'
#' @section Configuring git:
Expand Down Expand Up @@ -299,18 +299,23 @@
#' library(rcompendium)
#'
#' ## Define **ONCE FOR ALL** your credentials ----
#' set_credentials(given = "John", family = "Doe",
#' email = "john.doe@@domain.com",
#' orcid = "9999-9999-9999-9999", protocol = "ssh")
#' set_credentials(
#' given = "John",
#' family = "Doe",
#' email = "john.doe@@domain.com",
#' orcid = "9999-9999-9999-9999",
#' github_user = "jdoe",
#' protocol = "ssh"
#' )
#'
#' ## Create an R package ----
#' new_package()
#' create_new_package()
#'
#' ## Start developing functions ----
#' ## ...
#' }

new_package <- function(
create_new_package <- function(
license = "GPL (>= 2)",
status = NULL,
lifecycle = NULL,
Expand Down
2 changes: 1 addition & 1 deletion R/get_licenses.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' @description
#' This function returns a list of all available licenses. This is particularly
#' useful to get the right spelling of the license to be passed to
#' [new_package()], [new_compendium()], or [add_license()].
#' [create_new_package()], [create_new_compendium()], or [add_license()].
#'
#' @return A `data.frame` with the following two variables:
#' * `tag`, the license name to be used with [add_license()];
Expand Down
12 changes: 6 additions & 6 deletions R/rcompendium-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#' 1. Store your credentials (given and family names, email, ORCID, etc.) with
#' [set_credentials()] (if not already done);
#' 2. Create an new empty RStudio project;
#' 3. Run [new_package()] to create a new package structure or
#' [new_compendium()] to create a new research compendium structure;
#' 3. Run [create_new_package()] to create a new package structure or
#' [create_new_compendium()] to create a new research compendium structure;
#' 4. Edit some metadata in `DESCRIPTION`, `CITATION`, and `README.Rmd`;
#' 5. Start working (add data, write and document R functions, etc.);
#' 6. And do not forget to commit your changes.
Expand All @@ -25,9 +25,9 @@
#' @section Managing credentials:
#'
#' You can use the arguments `given`, `family`, `email`, and `orcid`
#' directly with the functions `new_*()` and `add_*()`. But if you create
#' a lot a projects (packages and/or compendia) it can be frustrating in the
#' long run.
#' directly with the functions `create_new_*()` and `add_*()`. But if you
#' create a lot a projects (packages and/or compendia) it can be frustrating in
#' the long run.
#'
#' An alternative way is to use **ONCE AND FOR ALL** the function
#' [set_credentials()] to permanently store this information in the
Expand All @@ -37,7 +37,7 @@
#'
#' Even if you have stored your credentials in the `~/.Rprofile` file you will
#' always be able to modify them on-the-fly (i.e. by using credentials arguments
#' in the functions `new_*()` and `add_*()`) or permanently by re-running
#' in the functions `create_new_*()` and `add_*()`) or permanently by re-running
#' [set_credentials()].
#'
#'
Expand Down
14 changes: 7 additions & 7 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ reference:
These four functions are usually the only ones user needs to run. The use of
`set_credentials` is strongly recommended to permanently store user
information (name, email, orcid, etc.) in the `.Rprofile`. This function
must be run one time. The function `new_package` must be used to create an
R package structure whereas `new_compendium` creates a new research
must be run one time. The function `create_new_package` must be used to create an
R package structure whereas `create_new_compendium` creates a new research
compendium structure (i.e. R package structure with some additional
files/folders). After that user can start to develop his/her project and
frequently update the package/compendium components (`Rd`
files, `NAMESPACE`, dependencies, badges, `README.md`, etc.)
contents:
- set_credentials
- new_package
- new_compendium
- create_new_package
- create_new_compendium

- title: Create files
desc: |
These function write files specific to R package and research compendium
(`add_makefile`). They are called by the main functions `new_package` and
`new_compendium` but they also can be used to overwrite files
(`add_makefile`). They are called by the main functions `create_new_package` and
`create_new_compendium` but they also can be used to overwrite files
(with `overwrite = TRUE`) in case of broken code. When `open = TRUE` and
`overwrite = FALSE` (default) files are open in the editor.
contents:
Expand All @@ -53,7 +53,7 @@ reference:
- title: README badges
desc: |
These functions add badges to the `README.Rmd`. They are called by the main
functions `new_package` and `new_compendium` but they also can
functions `create_new_package` and `create_new_compendium` but they also can
be used to update badges if license, lifecycle, repository status change or
to update number of dependencies (`add_dependencies_badge`).
contents:
Expand Down
2 changes: 1 addition & 1 deletion man/add_dependencies.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/add_makefile.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 17 additions & 12 deletions man/new_compendium.Rd → man/create_new_compendium.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 17 additions & 12 deletions man/new_package.Rd → man/create_new_package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading