From 68d9aa5169cae568f25c52d7f6dd1f0b7d44a9c6 Mon Sep 17 00:00:00 2001 From: Francisco Cardozo Date: Thu, 15 Aug 2024 14:17:22 -0700 Subject: [PATCH] Add quarto::quarto_create_project --- DESCRIPTION | 1 + NAMESPACE | 1 + R/create.R | 18 +++++++++++++++++- man/create_package.Rd | 8 ++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index e779235bf..95ce691ef 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -48,6 +48,7 @@ Suggests: knitr, magick, pkgload (>= 1.3.2.1), + quarto, rmarkdown, roxygen2 (>= 7.1.2), spelling (>= 1.2), diff --git a/NAMESPACE b/NAMESPACE index 0a1e4ae87..f0b3f5673 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -19,6 +19,7 @@ export(create_from_github) export(create_github_token) export(create_package) export(create_project) +export(create_quarto_project) export(create_tidy_package) export(edit_file) export(edit_git_config) diff --git a/R/create.R b/R/create.R index 0275ed886..153c52ffd 100644 --- a/R/create.R +++ b/R/create.R @@ -5,6 +5,7 @@ #' * `create_package()` creates an R package #' * `create_project()` creates a non-package project, i.e. a data analysis #' project +#' * `create_quarto_project()` creates a Quarto project #' #' Both functions can be called on an existing project; you will be asked before #' any existing files are changed. @@ -28,7 +29,8 @@ #' * If using RStudio desktop, the package is opened in a new session. #' * If on RStudio server, the current RStudio project is activated. #' * Otherwise, the working directory and active project is changed. -#' +#' @param ... pass quarto_create_project aditional arguments. +#' @param name name for quarto project folder #' @return Path to the newly created project or package, invisibly. #' @seealso [create_tidy_package()] is a convenience function that extends #' `create_package()` by immediately applying as many of the tidyverse @@ -109,6 +111,18 @@ create_project <- function(path, invisible(proj_get()) } + + +#' @rdname create_package +#' @export +create_quarto_project <- function(name, ...) { + + rlang::check_installed("quarto", reason = "to use `quarto_create_project()`") + + quarto::quarto_create_project(name = name, ...) + +} + #' Create a project from a GitHub repo #' #' @description @@ -380,3 +394,5 @@ challenge_home_directory <- function(path) { } invisible() } + + diff --git a/man/create_package.Rd b/man/create_package.Rd index 1a2c1d1f8..48d5da7c5 100644 --- a/man/create_package.Rd +++ b/man/create_package.Rd @@ -3,6 +3,7 @@ \name{create_package} \alias{create_package} \alias{create_project} +\alias{create_quarto_project} \title{Create a package or project} \usage{ create_package( @@ -19,6 +20,8 @@ create_project( rstudio = rstudioapi::isAvailable(), open = rlang::is_interactive() ) + +create_quarto_project(name, ...) } \arguments{ \item{path}{A path. If it exists, it is used. If it does not exist, it is @@ -46,6 +49,10 @@ error if not.} \item If on RStudio server, the current RStudio project is activated. \item Otherwise, the working directory and active project is changed. }} + +\item{name}{name for quarto project folder} + +\item{...}{pass quarto_create_project aditional arguments.} } \value{ Path to the newly created project or package, invisibly. @@ -56,6 +63,7 @@ These functions create an R project: \item \code{create_package()} creates an R package \item \code{create_project()} creates a non-package project, i.e. a data analysis project +\item \code{create_quarto_project()} creates a Quarto project } Both functions can be called on an existing project; you will be asked before