Wraps the other use_*_usgs functions to initialize
multiple files in one directory.
Usage
use_project_usgs(
home,
gitignore_additions = NULL,
readme_type = c("md", "rmd"),
disclaimer_type = c("provisional", "approved"),
repo_url = get_usgs_gitlab_url("origin"),
use_mr_template = TRUE,
open = rlang::is_interactive()
)Arguments
- home
chr, root directory of targets project. To use the current working directory, use
".".- gitignore_additions
chr vector, other files/directories to be added to .gitignore or
NULL(default) for no additions.- readme_type
chr, either "md" to create README as a markdown file (README.md; default) or "rmd" to create it as an R markdown file (README.Rmd). Using an Rmd file will allow you to include R code and output in your README.md.
- disclaimer_type
chr, either "provisional" (default) to include the provisional software disclaimer statement or "approved" for the approved disclaimer statement. It is important to only include the approved disclaimer statement if your software is an approved software release.
- repo_url
chr, URL to Git repository. If
NULL(default) a generic URL will be provided as a link to the repository in CONTRIBUTING.md. Otherwise, the issue page forrepo_urlwill be used as the link.- use_mr_template
lgl, Should GitLab Merge Request template be included in project repository. Default is
TRUE.- open
lgl; whether to open the files for interactive editing.
Examples
tmp <- file.path(tempdir(), "usgs_examples")
dir.create(tmp, showWarnings = FALSE)
use_project_usgs(
home = tmp,
repo_url = "https://code.usgs.gov/water/computational-tools/mortar"
)
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/README.md.
#> ℹ Using README.md from mortar template.
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/DISCLAIMER_PROVISIONAL.md.
#> ℹ Using DISCLAIMER_PROVISIONAL.md from mortar template.
#> ☐ Edit
#> /tmp/Rtmp0A2LMx/usgs_examples/.gitlab/merge_request_templates/Default.md.
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/code.json.
#> ℹ Using code.json from mortar template.
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/CHANGELOG.md.
#> ℹ Using CHANGELOG.md from mortar template.
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/CONTRIBUTING.md.
#> ℹ Using CONTRIBUTING.md from mortar template.
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/CONTRIBUTING.md.
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/CODE_OF_CONDUCT.md.
#> ℹ Using CODE_OF_CONDUCT.md from mortar template.
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/.gitignore.
#> ℹ Using .gitignore from mortar template.
list.files(tmp)
#> [1] "CHANGELOG.md" "CODE_OF_CONDUCT.md"
#> [3] "CONTRIBUTING.md" "DISCLAIMER_PROVISIONAL.md"
#> [5] "README.md" "code.json"
# start over
unlink(tmp, recursive = TRUE, force = TRUE)
dir.create(tmp)
# creates README.Rmd and DISCLAIMER_APPROVED instead
use_project_usgs(
home = tmp,
readme_type = "rmd",
disclaimer_type = "approved",
repo_url = "https://code.usgs.gov/water/computational-tools/mortar"
)
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/README.Rmd.
#> ℹ Using README.Rmd from mortar template.
#> ✔ Setting active project to "/home/runner/work/mortar/mortar".
#> ✔ Writing .git/hooks/pre-commit.
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/DISCLAIMER_APPROVED.md.
#> ℹ Using DISCLAIMER_APPROVED.md from mortar template.
#> ☐ Edit
#> /tmp/Rtmp0A2LMx/usgs_examples/.gitlab/merge_request_templates/Default.md.
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/code.json.
#> ℹ Using code.json from mortar template.
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/CHANGELOG.md.
#> ℹ Using CHANGELOG.md from mortar template.
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/CONTRIBUTING.md.
#> ℹ Using CONTRIBUTING.md from mortar template.
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/CONTRIBUTING.md.
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/CODE_OF_CONDUCT.md.
#> ℹ Using CODE_OF_CONDUCT.md from mortar template.
#> ☐ Edit /tmp/Rtmp0A2LMx/usgs_examples/.gitignore.
#> ℹ Using .gitignore from mortar template.
list.files(tmp)
#> [1] "CHANGELOG.md" "CODE_OF_CONDUCT.md" "CONTRIBUTING.md"
#> [4] "DISCLAIMER_APPROVED.md" "README.Rmd" "code.json"
# Clean up temp files
unlink(tmp, recursive = TRUE, force = TRUE)