Create FAIR Theory Repository
create_fair_theory.RdPartly automates the process of creating a FAIR theory repository, see Details.
Usage
create_fair_theory(
path,
title = NULL,
theory_file = NULL,
remote_repo = NULL,
add_license = "cc0",
...
)Arguments
- path
Character, indicating the directory in which to create the FAIR theory.
- title
Character, indicating the theory title. Default:
NULL- theory_file
Character, referring to existing theory file(s) to be copied, or a new theory file to be created. Default
NULLdoes nothing.- remote_repo
Name of a 'GitHub' repository that exists or should be created on the current authenticated user's account, see
gh_whoami, Default: NULL- add_license
PARAM_DESCRIPTION, Default: 'cc0'
- ...
Additional arguments passed to other functions.
Details
The following steps are executed sequentially:
Create a project folder at
pathInitialize a local 'Git' repository at
pathIf
remote_reporefers to a user's existing 'GitHub' repository, add it as remote to the local 'Git' repository. Otherwise, create a new 'GitHub' repository by that name and add it as remote.Add theory file. If
theory_filerefers to an existing file, copy it topath. Iftheory_filerefers to a new file, create it inpath.Add the license named by
add_licenseAdd a README.md file
Add 'Zenodo' metadata so that it recognizes the repository as a FAIR theory
If it is possible to push to the remote repository, use
git_updateto push the repository to 'GitHub'
Examples
# Create a theory with no remote repository (for safe testing)
theory_dir <- file.path(tempdir(), "theory")
create_fair_theory(path = theory_dir,
title = "This is My Theory",
theory_file = "theory.txt",
remote_repo = NULL,
add_license = "cc0")
# Create a theory with a remote repository
if (FALSE) { # \dontrun{
theory_dir <- file.path(tempdir(), "theory_github")
out <- create_fair_theory(path = theory_dir,
title = "This is My GitHub Theory",
theory_file = "theory.txt",
remote_repo = "delete_test",
add_license = "ccby")
} # }