@@ -40,7 +40,9 @@ read_renv_lock <- function(renv_lock_path = "renv.lock") {
4040# ' renv_remote_pkgs(read_renv_lock()$Packages)
4141# ' }
4242renv_remote_pkgs <- function (
43- renv_lock_remote_pkgs , host = NULL ) {
43+ renv_lock_remote_pkgs ,
44+ host = NULL
45+ ) {
4446 # , "bitbucket", "git", "local", "svn", "url", "version", "cran", "bioc"
4547 supported_pkg_hosts <- c(" api.github.com" , " gitlab.com" )
4648 if (! (is.null(host ) || (host %in% supported_pkg_hosts ))) {
@@ -61,37 +63,50 @@ renv_remote_pkgs <- function(
6163 host <- renv_lock_pkg_info $ RemoteHost
6264 } else {
6365 stop(
64- renv_lock_pkg_info $ Package , " has unsupported remote host: " ,
65- renv_lock_pkg_info $ RemoteHost , " \n Supported hosts are: " ,
66+ renv_lock_pkg_info $ Package ,
67+ " has unsupported remote host: " ,
68+ renv_lock_pkg_info $ RemoteHost ,
69+ " \n Supported hosts are: " ,
6670 paste0(supported_pkg_hosts , collapse = " , " )
6771 )
6872 }
6973 } else {
7074 if (host != renv_lock_pkg_info $ RemoteHost ) {
7175 stop(
72- " Remote host (" , renv_lock_pkg_info $ RemoteHost , " ) of " , renv_lock_pkg_info $ Package ,
73- " does not match the provided host (" , host , " )"
76+ " Remote host (" ,
77+ renv_lock_pkg_info $ RemoteHost ,
78+ " ) of " ,
79+ renv_lock_pkg_info $ Package ,
80+ " does not match the provided host (" ,
81+ host ,
82+ " )"
7483 )
7584 }
7685 }
7786
7887 pkg_info <- vector(mode = " list" , length = 3 )
7988 names(pkg_info ) <- c(" package_name" , " repo_url" , " commit" )
80- switch (host ,
89+ switch (
90+ host ,
8191 " api.github.com" = {
8292 pkg_info [[1 ]] <- renv_lock_pkg_info $ Package
8393 pkg_info [[2 ]] <- paste0(
8494 # RemoteHost is listed as api.github.com for some reason
85- " https://github.com/" , renv_lock_pkg_info $ RemoteUser , " /" ,
95+ " https://github.com/" ,
96+ renv_lock_pkg_info $ RemoteUser ,
97+ " /" ,
8698 renv_lock_pkg_info $ RemoteRepo
8799 )
88100 pkg_info [[3 ]] <- renv_lock_pkg_info $ RemoteSha
89101 },
90102 " gitlab.com" = {
91103 pkg_info [[1 ]] <- renv_lock_pkg_info $ Package
92104 pkg_info [[2 ]] <- paste0(
93- " https://" , renv_lock_pkg_info $ RemoteHost , " /" ,
94- renv_lock_pkg_info $ RemoteUser , " /" ,
105+ " https://" ,
106+ renv_lock_pkg_info $ RemoteHost ,
107+ " /" ,
108+ renv_lock_pkg_info $ RemoteUser ,
109+ " /" ,
95110 renv_lock_pkg_info $ RemoteRepo
96111 )
97112 pkg_info [[3 ]] <- renv_lock_pkg_info $ RemoteSha
@@ -159,12 +174,13 @@ renv_remote_pkgs <- function(
159174# ' }
160175# '
161176renv2nix <- function (
162- renv_lock_path = " renv.lock" ,
163- project_path ,
164- return_rix_call = FALSE ,
165- method = c(" fast" , " accurate" ),
166- override_r_ver = NULL ,
167- ... ) {
177+ renv_lock_path = " renv.lock" ,
178+ project_path ,
179+ return_rix_call = FALSE ,
180+ method = c(" fast" , " accurate" ),
181+ override_r_ver = NULL ,
182+ ...
183+ ) {
168184 method <- match.arg(method , c(" fast" , " accurate" ))
169185 renv_lock <- read_renv_lock(renv_lock_path = renv_lock_path )
170186 if (method == " fast" ) {
@@ -175,13 +191,18 @@ renv2nix <- function(
175191 for (i in seq_along(renv_lock $ Packages )) {
176192 if (renv_lock $ Packages [[i ]]$ Source %in% c(" Repository" , " Bioconductor" )) {
177193 repo_pkgs [[renv_lock_pkg_names [i ]]] <- renv_lock $ Packages [[i ]]
178- } else if (renv_lock $ Packages [[i ]]$ RemoteHost %in% c(" api.github.com" , " gitlab.com" )) {
194+ } else if (
195+ renv_lock $ Packages [[i ]]$ RemoteHost %in%
196+ c(" api.github.com" , " gitlab.com" )
197+ ) {
179198 remote_pkgs [[renv_lock_pkg_names [i ]]] <- renv_lock $ Packages [[i ]]
180199 } else {
181200 # unsupported_pkgs[[renv_lock_pkg_names[i]]] <- renv_lock$Packages[[i]]
182201 warning(
183- renv_lock $ Packages [[i ]]$ Package , " has the unsupported remote host " ,
184- renv_lock $ Packages [[i ]]$ RemoteHost , " and will not be included in the Nix expression." ,
202+ renv_lock $ Packages [[i ]]$ Package ,
203+ " has the unsupported remote host " ,
204+ renv_lock $ Packages [[i ]]$ RemoteHost ,
205+ " and will not be included in the Nix expression." ,
185206 " \n Consider manually specifying the git remote or a local package install."
186207 )
187208 }
0 commit comments