Partly 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. The default value
"."
points to the current directory.- title
Character, indicating the theory title. Default:
NULL
- theory_file
Character, referring to an existing theory file to be copied, or a new theory file to be created. Default
NULL
does 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
path
Initialize a local Git repository at
path
If
remote_repo
refers 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_file
refers to an existing file, copy it topath
. Iftheory_file
refers to a new file, create it inpath
.Add the license named by
add_license
Add 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_update
to 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 project folder
#> ✔ Create project folder ... done
#>
#> ℹ Initialize Git repository
#> ✔ Initialize Git repository ... done
#>
#> ℹ Creating new theory file "theory.txt"
#> ✔ Creating new theory file "theory.txt" ... done
#>
#> ℹ Writing license file
#> ✔ Writing license file ... done
#>
#> ℹ Creating README.md
#> ✔ Creating README.md ... done
#>
# Create a theory with a remote repository
theory_dir <- file.path(tempdir(), "theory_github")
if (FALSE) {
out <- create_fair_theory(path = theory_dir,
title = "This is My GitHub Theory",
theory_file = "theory.txt",
remote_repo = "delete_test",
add_license = "ccby")
}