build_gitignore {memoiR}R Documentation

Build .gitignore

Description

Build a .gitignore file suitable for R Markdown projects.

Usage

build_gitignore()

Details

The .gitignore file contains the list of files (file name patterns) that must not be controlled by git. Run this function once in each project created from a memoiR template, before activating version control.

Value

The content of the .gitignore file as a vector of characters, invisibly. Each element is a line of the file.

Examples

## Simulate the creation of a new project
# Save working directory
original_wd <- getwd()
# Get a temporary working directory
wd <- tempfile("example")
# Simulate File > New File > R Markdown... > From Template > Simple Article
rmarkdown::draft(wd, template="simple_article", package="memoiR", edit=FALSE)
# Go to temp directory
setwd(wd)
# Make it the current project
usethis::proj_set(path = ".", force = TRUE)

# Build .gitignore file
build_gitignore()
# Content
readLines(".gitignore")

## End of the example: cleanup
# Return to the original working directory and clean up
setwd(original_wd)
unlink(wd, recursive = TRUE)


[Package memoiR version 1.2-9 Index]