--- title: "Getting started with bigbang" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Getting started with bigbang} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set(collapse = TRUE, comment = "#>") library(bigbang) ``` ## A complete disposable example This guide creates a component archive and a metapackage source tree entirely under `tempdir()`. It does not write to the working directory, install anything, or contact a repository. ```{r create-component} root <- tempfile("bigbang-vignette-") source_root <- file.path(root, "sources") archive_root <- file.path(root, "archives") destination <- file.path(root, "generated") dir.create(file.path(source_root, "toycomponent", "R"), recursive = TRUE) dir.create(archive_root) dir.create(destination) writeLines(c( "Package: toycomponent", "Type: Package", "Title: Toy Component", "Version: 0.1.0", "Authors@R: person('Test', 'Author', email='test@example.org', role=c('aut','cre'))", "Description: A disposable component used by the bigbang vignette.", "License: MIT" ), file.path(source_root, "toycomponent", "DESCRIPTION"), useBytes = TRUE) writeLines( "export(toy_value)", file.path(source_root, "toycomponent", "NAMESPACE"), useBytes = TRUE ) writeLines( "toy_value <- function() 'hello from the component'", file.path(source_root, "toycomponent", "R", "toy.R"), useBytes = TRUE ) withr::with_dir(source_root, utils::tar( file.path(archive_root, "toycomponent_0.1.0.tar.gz"), files = "toycomponent", compression = "gzip" )) ``` The archive stem includes the version; `ext` is supplied separately. ```{r generate-metapackage} result <- create_metapackage( name = "toyverse", packages = "toycomponent_0.1.0", pkg_dir = archive_root, dest_dir = destination, document = FALSE, verbose = FALSE, import_deps = character(), force_deps = character() ) result list.files(result$path) ``` The generated tree can be scanned without loading it: ```{r scan-metapackage} scan <- scan_bigbang_artifact(result$path) scan stopifnot(!scan$vulnerable) ``` ## Build, install, and use In a real project, build and install the generated package using the standard R workflow. Loading the metapackage never installs components: ```{r, eval = FALSE} system2(file.path(R.home("bin"), "R"), c("CMD", "build", result$path)) install.packages("toyverse_0.1.0.tar.gz", repos = NULL, type = "source") library(toyverse) toyverse_install(cran_deps = "skip") ``` `cran_deps = "skip"` is the offline default. Choose `"error"` for strict offline validation or `"install"` only when an explicit repository is available. ```{r cleanup, include = FALSE} unlink(root, recursive = TRUE) ```