-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
69 lines (51 loc) · 2.52 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# icepalace
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/ropenscilabs/icepalace/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropenscilabs/icepalace/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
The goal of this package is to download entire CRAN-like repositories, for instance R-universe repositories to use the archive as a frozen snapshot.
The frozen snapshot could be kept locally, or for instance served on GitHub Pages.
It might be useful for reproducibility.
The goal of this package is **not** to also snapshot the dependencies of the repository packages that are not in the repository.
If you want such an exhaustive snapshot, use tools like [MRAN](https://mran.microsoft.com/timemachine) or [RStudio Package Manager](https://www.rstudio.com/products/package-manager/).
## Installation
You can install the development version of icepalace from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("ropenscilabs/icepalace")
```
## Example
Let's snapshot the mrc-ide R-universe repository and then install dde from that repo.
```{r example}
library(icepalace)
# In real life do not use a temporary directory :-)
destdir <- withr::local_tempdir()
snapshot_package_repository("https://mrc-ide.r-universe.dev", destdir = destdir)
fs::dir_tree(destdir)
repo <- sprintf("file:///%s", destdir)
repo
install.packages("dde", repos = c(rlib = repo, CRAN = 'https://cloud.r-project.org'))
pkg_info <- sessioninfo::package_info("dde")
pkg_info[pkg_info$package == "dde",]
```
By default the binaries are downloaded for the latest released version of R (`rversions::r_release()`).
If `type` includes `win.binary` or `mac.binary` (by default, `type` includes source and both kinds of binaries), and there are no binary for the R version, the function will warn.
```{r error = TRUE}
snapshot_package_repository("https://mrc-ide.r-universe.dev", type = "win.binary", r_version = "3.3")
```
If there are no package at all (for instance if there is a typo in the URL), the function will error.
```{r error = TRUE}
snapshot_package_repository("https://_blop_.r-universe.dev")
```