Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
24 changes: 24 additions & 0 deletions R/use_remake.R
Original file line number Diff line number Diff line change
@@ -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"))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason for this construct, given that remake_filename is a constant?

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")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file does not exist - I presume you're trying to copy over this file? That file is not installed (only files below inst/ would be). Perhaps it would be better to install a new, heavily commented, file that is custom designed for being easy to start with?

file.copy(template_path, path)

invisible(TRUE)
}
22 changes: 22 additions & 0 deletions man/use_remake.Rd
Original file line number Diff line number Diff line change
@@ -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.
}