Skip to contents

Creates common project files like .gitignore, README.md. LICENSE.md, etc.#'

Usage

use_gitignore_usgs(home, additions = NULL, open = rlang::is_interactive())

use_readme_usgs(home, open = rlang::is_interactive())

use_readme_rmd_usgs(home, open = rlang::is_interactive())

use_license_usgs(home, open = rlang::is_interactive())

use_code_json_usgs(home, open = rlang::is_interactive())

use_disclaimer_provisional_usgs(home, open = rlang::is_interactive())

use_disclaimer_approved_usgs(home, open = rlang::is_interactive())

use_code_of_conduct_usgs(home, open = rlang::is_interactive())

use_contributing_usgs(home, repo_url = NULL, open = rlang::is_interactive())

use_changelog_usgs(home, open = rlang::is_interactive())

use_gitlab_mr_template_usgs(home, open = FALSE)

Arguments

home

chr, root directory of targets project. To use the current working directory, use ".".

additions

chr vector, other files/directories to be added to .gitignore

open

lgl; whether to open the file for interactive editing

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 for repo_url will be used as the link.

Value

NULL invisibly

Examples

tmp <- file.path(tempdir(), "use_file_usgs_example")
dir.create(tmp, showWarnings = FALSE)

use_gitignore_usgs(home = tmp,
                   additions = c("excluded_file.R",
                                 "excluded_dir",
                                 "*excluded_pattern*"))
#>  Edit /tmp/Rtmp0A2LMx/use_file_usgs_example/.gitignore.
#>  Using .gitignore from mortar template.
# here are the contents of the .gitignore:
cat(readLines(file.path(tmp,".gitignore")), sep = "\n")
#> # **NOTE: this is a template created using the `mortar` package. The contents below are for illustrative purposes and should be edited to reflect your use case. This message can be deleted in acknowledgement that you've added this file to your project.**
#> 
#> ### R ###
#> 
#> # R Environment Variables
#> .Renviron
#> 
#> ### targets ###
#> _targets
#> */out/*
#> */in/*
#> !*.empty
#> 
#> # History files
#> .Rhistory
#> .Rapp.history
#> .RData # Session Data files
#> .Ruserdata # User-specific files
#> .Rproj.user/ # RStudio files
#> 
#> # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
#> .httr-oauth
#> 
#> # knitr and R markdown default cache directories
#> *_cache/
#> /cache/
#> 
#> # Temporary files created by R markdown
#> *.utf8.md
#> *.knit.md
#> 
#> ### vim ###
#> .*.swp
#> .swp
#> excluded_file.R
#> excluded_dir
#> *excluded_pattern*

unlink(tmp, recursive = TRUE, force = TRUE)