create_fair_theory {theorytools} | R Documentation |
Create FAIR Theory Repository
Description
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. |
title |
Character, indicating the theory title. Default: |
theory_file |
Character, referring to existing theory file(s) to be
copied, or a new theory file to be created. Default |
remote_repo |
Name of a 'GitHub' repository that exists or should be
created on the current authenticated user's account, see
|
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'
Value
Invisibly returns a logical value, indicating whether the function was successful or not.
See Also
git_repo
add_license_file
, git_update
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
## Not run:
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")
## End(Not run)