R/setup.R

# setup -------------------------------------------------------------------
#
#' @title
#' Initialise the Project Environment
#'
#' @description
#' Load the project's global variables, required packages and functions.
#'
#' @section Prerequisites:
#' \code{setup} is designed to work with standard projects. It requires:
#' * \code{config.yml} with an \code{option} field under which items will be
#' loaded into the \code{.project} environment.
#' * \code{DESCRIPTION} file where packages declared in its dependencies fields
#' \code{("Depends", "Imports", "LinkingTo", "Suggests", "Enhances")} are
#' loaded.
#'
#' @param path (`character`) A path to the project's root folder.
#'
#' @examples
#' \donttest{
#'   \dontrun{
#'     setup(path = rprojroot::find_rstudio_root_file())
#'   }
#' }
#'
#' @export
#'
setup <- function(path){
    set_project_env(path)
    tidylab.utils::load_packages_mentioned_in_description(path = .project$path_project)
    tidylab.utils::load_functions(path = .project$path_functions)
    return(invisible())
}
tidylab/tidylab.deployment documentation built on June 9, 2019, 11:41 a.m.