diff --git a/NAMESPACE b/NAMESPACE index 48d5b0c4..0e49bfe7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -25,6 +25,7 @@ export(make_script) export(remake_verbose) export(remodel) export(source_character) +export(use_remake) importFrom(R6,R6Class) importFrom(crayon,make_style) importFrom(storr,storr_rds) diff --git a/R/use_remake.R b/R/use_remake.R new file mode 100644 index 00000000..0909f88d --- /dev/null +++ b/R/use_remake.R @@ -0,0 +1,24 @@ +##' Add a remake file template +##' +##' This function adds a simple remake file template to a +##' target directory. +##' +##' @param dir directory in which to create. Defaults to +##' current directory. +##' @return This function is primarily useful for its side +##' effect, which is to add a template remake.yml file to +##' the home directory. +##' @export +use_remake <- function(dir = ".") { + remake_filename <- "remake" + path <- file.path(dir, paste0(remake_filename, ".yml")) + if (file.exists(path)) { + stop(remake_filename, ".yml already exists", call. = FALSE) + } + message("Adding remake.yaml file") + + template_path <- system.file("doc/remake.yml", package = "remake") + file.copy(template_path, path) + + invisible(TRUE) +} \ No newline at end of file diff --git a/man/use_remake.Rd b/man/use_remake.Rd new file mode 100644 index 00000000..72ac28df --- /dev/null +++ b/man/use_remake.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/use_remake.R +\name{use_remake} +\alias{use_remake} +\title{Add a remake file template} +\usage{ +use_remake(dir = ".") +} +\arguments{ +\item{dir}{directory in which to create. Defaults to +current directory.} +} +\value{ +This function is primarily useful for its side + effect, which is to add a template remake.yml file to + the home directory. +} +\description{ +This function adds a simple remake file template to a +target directory. +} +