jcheng5 commited on
Commit
d0f45e2
·
1 Parent(s): 1392349

Try simpler Dockerfile approach

Browse files
Files changed (8) hide show
  1. .Rprofile +0 -1
  2. .dockerignore +0 -1
  3. Dockerfile +6 -10
  4. prepare.R +0 -24
  5. renv.lock +0 -1181
  6. renv/.gitignore +0 -7
  7. renv/activate.R +0 -1032
  8. renv/settings.json +0 -17
.Rprofile DELETED
@@ -1 +0,0 @@
1
- source("renv/activate.R")
 
 
.dockerignore DELETED
@@ -1 +0,0 @@
1
- renv
 
 
Dockerfile CHANGED
@@ -2,17 +2,13 @@ FROM rocker/shiny-verse:latest
2
 
3
  WORKDIR /code
4
 
5
- # Cache doesn't help for single-use containers (and huggingface
6
- # spaces don't let us write to renv's default cache path)
7
- ENV RENV_CONFIG_CACHE_ENABLED=FALSE
8
 
9
- RUN R --quiet -e "install.packages('renv'); renv::init()"
10
-
11
- COPY ./renv.lock /code/renv.lock
12
-
13
- RUN R --quiet -e "renv::restore()"
14
- RUN R --quiet -e "renv::install('rstudio/httpuv@ping')"
15
- RUN ls
16
 
17
  COPY . .
18
 
 
2
 
3
  WORKDIR /code
4
 
5
+ RUN install2.r --ncpus 2 --error \
6
+ ggExtra \
7
+ bslib
8
 
9
+ # RUN installGithub.r \
10
+ # rstudio/shiny \
11
+ # rstudio/httpuv@ping
 
 
 
 
12
 
13
  COPY . .
14
 
prepare.R DELETED
@@ -1,24 +0,0 @@
1
- capitalize <- function(str) {
2
- sub("^.", toupper(substr(str, 1, 1)), str)
3
- }
4
-
5
- renamer <- function(name) {
6
- parts <- strsplit(name, "_", fixed = TRUE)[[1]]
7
- units <- NULL
8
-
9
- if (length(parts) > 1 && tail(parts, 1) %in% c("mm", "g")) {
10
- units <- paste0(" (", tail(parts, 1), ")")
11
- parts <- head(parts, -1)
12
- }
13
-
14
- parts <- vapply(parts, capitalize, character(1))
15
- paste0(paste(parts, collapse = " "), units)
16
- }
17
-
18
- rename_all <- function(names) {
19
- vapply(names, renamer, character(1))
20
- }
21
-
22
- palmerpenguins::penguins |>
23
- dplyr::rename_with(rename_all) |>
24
- readr::write_csv("penguins.csv")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
renv.lock DELETED
@@ -1,1181 +0,0 @@
1
- {
2
- "R": {
3
- "Version": "4.2.3",
4
- "Repositories": [
5
- {
6
- "Name": "CRAN",
7
- "URL": "https://cloud.r-project.org"
8
- }
9
- ]
10
- },
11
- "Packages": {
12
- "MASS": {
13
- "Package": "MASS",
14
- "Version": "7.3-58.3",
15
- "Source": "Repository",
16
- "Repository": "CRAN",
17
- "Requirements": [
18
- "R",
19
- "grDevices",
20
- "graphics",
21
- "methods",
22
- "stats",
23
- "utils"
24
- ],
25
- "Hash": "9586b552d57f5516fe4d25398c1bacd6"
26
- },
27
- "Matrix": {
28
- "Package": "Matrix",
29
- "Version": "1.5-1",
30
- "Source": "Repository",
31
- "Repository": "CRAN",
32
- "Requirements": [
33
- "R",
34
- "graphics",
35
- "grid",
36
- "lattice",
37
- "methods",
38
- "stats",
39
- "utils"
40
- ],
41
- "Hash": "539dc0c0c05636812f1080f473d2c177"
42
- },
43
- "R6": {
44
- "Package": "R6",
45
- "Version": "2.5.1",
46
- "Source": "Repository",
47
- "Repository": "CRAN",
48
- "Requirements": [
49
- "R"
50
- ],
51
- "Hash": "470851b6d5d0ac559e9d01bb352b4021"
52
- },
53
- "RColorBrewer": {
54
- "Package": "RColorBrewer",
55
- "Version": "1.1-3",
56
- "Source": "Repository",
57
- "Repository": "CRAN",
58
- "Requirements": [
59
- "R"
60
- ],
61
- "Hash": "45f0398006e83a5b10b72a90663d8d8c"
62
- },
63
- "Rcpp": {
64
- "Package": "Rcpp",
65
- "Version": "1.0.10",
66
- "Source": "Repository",
67
- "Repository": "CRAN",
68
- "Requirements": [
69
- "methods",
70
- "utils"
71
- ],
72
- "Hash": "e749cae40fa9ef469b6050959517453c"
73
- },
74
- "askpass": {
75
- "Package": "askpass",
76
- "Version": "1.1",
77
- "Source": "Repository",
78
- "Repository": "CRAN",
79
- "Requirements": [
80
- "sys"
81
- ],
82
- "Hash": "e8a22846fff485f0be3770c2da758713"
83
- },
84
- "base64enc": {
85
- "Package": "base64enc",
86
- "Version": "0.1-3",
87
- "Source": "Repository",
88
- "Repository": "CRAN",
89
- "Requirements": [
90
- "R"
91
- ],
92
- "Hash": "543776ae6848fde2f48ff3816d0628bc"
93
- },
94
- "bit": {
95
- "Package": "bit",
96
- "Version": "4.0.5",
97
- "Source": "Repository",
98
- "Repository": "CRAN",
99
- "Requirements": [
100
- "R"
101
- ],
102
- "Hash": "d242abec29412ce988848d0294b208fd"
103
- },
104
- "bit64": {
105
- "Package": "bit64",
106
- "Version": "4.0.5",
107
- "Source": "Repository",
108
- "Repository": "CRAN",
109
- "Requirements": [
110
- "R",
111
- "bit",
112
- "methods",
113
- "stats",
114
- "utils"
115
- ],
116
- "Hash": "9fe98599ca456d6552421db0d6772d8f"
117
- },
118
- "bslib": {
119
- "Package": "bslib",
120
- "Version": "0.4.2.9000",
121
- "Source": "GitHub",
122
- "RemoteType": "github",
123
- "RemoteHost": "api.github.com",
124
- "RemoteRepo": "bslib",
125
- "RemoteUsername": "rstudio",
126
- "RemotePkgRef": "rstudio/bslib",
127
- "RemoteRef": "HEAD",
128
- "RemoteSha": "4c3073a4bb4d135e21086253592ec857b99daed1",
129
- "Requirements": [
130
- "R",
131
- "base64enc",
132
- "cachem",
133
- "grDevices",
134
- "htmltools",
135
- "jquerylib",
136
- "jsonlite",
137
- "memoise",
138
- "mime",
139
- "rlang",
140
- "sass"
141
- ],
142
- "Hash": "007572b82ef9ce87e65a09e4145de631"
143
- },
144
- "cachem": {
145
- "Package": "cachem",
146
- "Version": "1.0.7",
147
- "Source": "Repository",
148
- "Repository": "CRAN",
149
- "Requirements": [
150
- "fastmap",
151
- "rlang"
152
- ],
153
- "Hash": "cda74447c42f529de601fe4d4050daef"
154
- },
155
- "cli": {
156
- "Package": "cli",
157
- "Version": "3.6.1",
158
- "Source": "Repository",
159
- "Repository": "CRAN",
160
- "Requirements": [
161
- "R",
162
- "utils"
163
- ],
164
- "Hash": "89e6d8219950eac806ae0c489052048a"
165
- },
166
- "clipr": {
167
- "Package": "clipr",
168
- "Version": "0.8.0",
169
- "Source": "Repository",
170
- "Repository": "CRAN",
171
- "Requirements": [
172
- "utils"
173
- ],
174
- "Hash": "3f038e5ac7f41d4ac41ce658c85e3042"
175
- },
176
- "colorspace": {
177
- "Package": "colorspace",
178
- "Version": "2.1-0",
179
- "Source": "Repository",
180
- "Repository": "CRAN",
181
- "Requirements": [
182
- "R",
183
- "grDevices",
184
- "graphics",
185
- "methods",
186
- "stats"
187
- ],
188
- "Hash": "f20c47fd52fae58b4e377c37bb8c335b"
189
- },
190
- "colourpicker": {
191
- "Package": "colourpicker",
192
- "Version": "1.2.0",
193
- "Source": "Repository",
194
- "Repository": "CRAN",
195
- "Requirements": [
196
- "R",
197
- "ggplot2",
198
- "htmltools",
199
- "htmlwidgets",
200
- "jsonlite",
201
- "miniUI",
202
- "shiny",
203
- "shinyjs",
204
- "utils"
205
- ],
206
- "Hash": "ca4d99d106687d68392ffe270081bfc0"
207
- },
208
- "commonmark": {
209
- "Package": "commonmark",
210
- "Version": "1.9.0",
211
- "Source": "Repository",
212
- "Repository": "CRAN",
213
- "Hash": "d691c61bff84bd63c383874d2d0c3307"
214
- },
215
- "cpp11": {
216
- "Package": "cpp11",
217
- "Version": "0.4.3",
218
- "Source": "Repository",
219
- "Repository": "CRAN",
220
- "Hash": "ed588261931ee3be2c700d22e94a29ab"
221
- },
222
- "crayon": {
223
- "Package": "crayon",
224
- "Version": "1.5.2",
225
- "Source": "Repository",
226
- "Repository": "CRAN",
227
- "Requirements": [
228
- "grDevices",
229
- "methods",
230
- "utils"
231
- ],
232
- "Hash": "e8a1e41acf02548751f45c718d55aa6a"
233
- },
234
- "curl": {
235
- "Package": "curl",
236
- "Version": "5.0.0",
237
- "Source": "Repository",
238
- "Repository": "CRAN",
239
- "RemoteType": "standard",
240
- "RemotePkgRef": "curl",
241
- "RemoteRef": "curl",
242
- "RemoteRepos": "https://cloud.r-project.org",
243
- "RemotePkgPlatform": "source",
244
- "RemoteSha": "5.0.0",
245
- "Requirements": [
246
- "R"
247
- ],
248
- "Hash": "e4f97056611e8e6b8b852d13b7400cf1"
249
- },
250
- "digest": {
251
- "Package": "digest",
252
- "Version": "0.6.31",
253
- "Source": "Repository",
254
- "Repository": "CRAN",
255
- "Requirements": [
256
- "R",
257
- "utils"
258
- ],
259
- "Hash": "8b708f296afd9ae69f450f9640be8990"
260
- },
261
- "dplyr": {
262
- "Package": "dplyr",
263
- "Version": "1.1.1",
264
- "Source": "Repository",
265
- "Repository": "CRAN",
266
- "Requirements": [
267
- "R",
268
- "R6",
269
- "cli",
270
- "generics",
271
- "glue",
272
- "lifecycle",
273
- "magrittr",
274
- "methods",
275
- "pillar",
276
- "rlang",
277
- "tibble",
278
- "tidyselect",
279
- "utils",
280
- "vctrs"
281
- ],
282
- "Hash": "eb5742d256a0d9306d85ea68756d8187"
283
- },
284
- "ellipsis": {
285
- "Package": "ellipsis",
286
- "Version": "0.3.2",
287
- "Source": "Repository",
288
- "Repository": "CRAN",
289
- "Requirements": [
290
- "R",
291
- "rlang"
292
- ],
293
- "Hash": "bb0eec2fe32e88d9e2836c2f73ea2077"
294
- },
295
- "evaluate": {
296
- "Package": "evaluate",
297
- "Version": "0.20",
298
- "Source": "Repository",
299
- "Repository": "CRAN",
300
- "Requirements": [
301
- "R",
302
- "methods"
303
- ],
304
- "Hash": "4b68aa51edd89a0e044a66e75ae3cc6c"
305
- },
306
- "fansi": {
307
- "Package": "fansi",
308
- "Version": "1.0.4",
309
- "Source": "Repository",
310
- "Repository": "CRAN",
311
- "Requirements": [
312
- "R",
313
- "grDevices",
314
- "utils"
315
- ],
316
- "Hash": "1d9e7ad3c8312a192dea7d3db0274fde"
317
- },
318
- "farver": {
319
- "Package": "farver",
320
- "Version": "2.1.1",
321
- "Source": "Repository",
322
- "Repository": "CRAN",
323
- "Hash": "8106d78941f34855c440ddb946b8f7a5"
324
- },
325
- "fastmap": {
326
- "Package": "fastmap",
327
- "Version": "1.1.1",
328
- "Source": "Repository",
329
- "Repository": "CRAN",
330
- "Hash": "f7736a18de97dea803bde0a2daaafb27"
331
- },
332
- "fontawesome": {
333
- "Package": "fontawesome",
334
- "Version": "0.5.0",
335
- "Source": "Repository",
336
- "Repository": "CRAN",
337
- "Requirements": [
338
- "R",
339
- "htmltools",
340
- "rlang"
341
- ],
342
- "Hash": "e80750aec5717dedc019ad7ee40e4a7c"
343
- },
344
- "fs": {
345
- "Package": "fs",
346
- "Version": "1.6.1",
347
- "Source": "Repository",
348
- "Repository": "CRAN",
349
- "Requirements": [
350
- "R",
351
- "methods"
352
- ],
353
- "Hash": "f4dcd23b67e33d851d2079f703e8b985"
354
- },
355
- "generics": {
356
- "Package": "generics",
357
- "Version": "0.1.3",
358
- "Source": "Repository",
359
- "Repository": "CRAN",
360
- "Requirements": [
361
- "R",
362
- "methods"
363
- ],
364
- "Hash": "15e9634c0fcd294799e9b2e929ed1b86"
365
- },
366
- "ggExtra": {
367
- "Package": "ggExtra",
368
- "Version": "0.10.0",
369
- "Source": "Repository",
370
- "Repository": "CRAN",
371
- "Requirements": [
372
- "R",
373
- "R6",
374
- "colourpicker",
375
- "ggplot2",
376
- "grDevices",
377
- "grid",
378
- "gtable",
379
- "miniUI",
380
- "scales",
381
- "shiny",
382
- "shinyjs",
383
- "utils"
384
- ],
385
- "Hash": "f505d7f3058403787145fe0f7b1ff84c"
386
- },
387
- "ggplot2": {
388
- "Package": "ggplot2",
389
- "Version": "3.4.2",
390
- "Source": "Repository",
391
- "Repository": "CRAN",
392
- "Requirements": [
393
- "MASS",
394
- "R",
395
- "cli",
396
- "glue",
397
- "grDevices",
398
- "grid",
399
- "gtable",
400
- "isoband",
401
- "lifecycle",
402
- "mgcv",
403
- "rlang",
404
- "scales",
405
- "stats",
406
- "tibble",
407
- "vctrs",
408
- "withr"
409
- ],
410
- "Hash": "3a147ee02e85a8941aad9909f1b43b7b"
411
- },
412
- "glue": {
413
- "Package": "glue",
414
- "Version": "1.6.2",
415
- "Source": "Repository",
416
- "Repository": "CRAN",
417
- "Requirements": [
418
- "R",
419
- "methods"
420
- ],
421
- "Hash": "4f2596dfb05dac67b9dc558e5c6fba2e"
422
- },
423
- "gtable": {
424
- "Package": "gtable",
425
- "Version": "0.3.3",
426
- "Source": "Repository",
427
- "Repository": "CRAN",
428
- "Requirements": [
429
- "R",
430
- "cli",
431
- "glue",
432
- "grid",
433
- "lifecycle",
434
- "rlang"
435
- ],
436
- "Hash": "b44addadb528a0d227794121c00572a0"
437
- },
438
- "highr": {
439
- "Package": "highr",
440
- "Version": "0.10",
441
- "Source": "Repository",
442
- "Repository": "CRAN",
443
- "Requirements": [
444
- "R",
445
- "xfun"
446
- ],
447
- "Hash": "06230136b2d2b9ba5805e1963fa6e890"
448
- },
449
- "hms": {
450
- "Package": "hms",
451
- "Version": "1.1.3",
452
- "Source": "Repository",
453
- "Repository": "CRAN",
454
- "Requirements": [
455
- "lifecycle",
456
- "methods",
457
- "pkgconfig",
458
- "rlang",
459
- "vctrs"
460
- ],
461
- "Hash": "b59377caa7ed00fa41808342002138f9"
462
- },
463
- "htmltools": {
464
- "Package": "htmltools",
465
- "Version": "0.5.5",
466
- "Source": "Repository",
467
- "Repository": "CRAN",
468
- "Requirements": [
469
- "R",
470
- "base64enc",
471
- "digest",
472
- "ellipsis",
473
- "fastmap",
474
- "grDevices",
475
- "rlang",
476
- "utils"
477
- ],
478
- "Hash": "ba0240784ad50a62165058a27459304a"
479
- },
480
- "htmlwidgets": {
481
- "Package": "htmlwidgets",
482
- "Version": "1.6.2",
483
- "Source": "Repository",
484
- "Repository": "CRAN",
485
- "Requirements": [
486
- "grDevices",
487
- "htmltools",
488
- "jsonlite",
489
- "knitr",
490
- "rmarkdown",
491
- "yaml"
492
- ],
493
- "Hash": "a865aa85bcb2697f47505bfd70422471"
494
- },
495
- "httpuv": {
496
- "Package": "httpuv",
497
- "Version": "1.6.9",
498
- "Source": "Repository",
499
- "Repository": "CRAN",
500
- "Requirements": [
501
- "R",
502
- "R6",
503
- "Rcpp",
504
- "later",
505
- "promises",
506
- "utils"
507
- ],
508
- "Hash": "1046aa31a57eae8b357267a56a0b6d8b"
509
- },
510
- "isoband": {
511
- "Package": "isoband",
512
- "Version": "0.2.7",
513
- "Source": "Repository",
514
- "Repository": "CRAN",
515
- "Requirements": [
516
- "grid",
517
- "utils"
518
- ],
519
- "Hash": "0080607b4a1a7b28979aecef976d8bc2"
520
- },
521
- "jquerylib": {
522
- "Package": "jquerylib",
523
- "Version": "0.1.4",
524
- "Source": "Repository",
525
- "Repository": "CRAN",
526
- "Requirements": [
527
- "htmltools"
528
- ],
529
- "Hash": "5aab57a3bd297eee1c1d862735972182"
530
- },
531
- "jsonlite": {
532
- "Package": "jsonlite",
533
- "Version": "1.8.4",
534
- "Source": "Repository",
535
- "Repository": "CRAN",
536
- "Requirements": [
537
- "methods"
538
- ],
539
- "Hash": "a4269a09a9b865579b2635c77e572374"
540
- },
541
- "knitr": {
542
- "Package": "knitr",
543
- "Version": "1.42",
544
- "Source": "Repository",
545
- "Repository": "CRAN",
546
- "Requirements": [
547
- "R",
548
- "evaluate",
549
- "highr",
550
- "methods",
551
- "tools",
552
- "xfun",
553
- "yaml"
554
- ],
555
- "Hash": "8329a9bcc82943c8069104d4be3ee22d"
556
- },
557
- "labeling": {
558
- "Package": "labeling",
559
- "Version": "0.4.2",
560
- "Source": "Repository",
561
- "Repository": "CRAN",
562
- "Requirements": [
563
- "graphics",
564
- "stats"
565
- ],
566
- "Hash": "3d5108641f47470611a32d0bdf357a72"
567
- },
568
- "later": {
569
- "Package": "later",
570
- "Version": "1.3.0",
571
- "Source": "Repository",
572
- "Repository": "CRAN",
573
- "Requirements": [
574
- "Rcpp",
575
- "rlang"
576
- ],
577
- "Hash": "7e7b457d7766bc47f2a5f21cc2984f8e"
578
- },
579
- "lattice": {
580
- "Package": "lattice",
581
- "Version": "0.20-45",
582
- "Source": "Repository",
583
- "Repository": "CRAN",
584
- "Requirements": [
585
- "R",
586
- "grDevices",
587
- "graphics",
588
- "grid",
589
- "stats",
590
- "utils"
591
- ],
592
- "Hash": "b64cdbb2b340437c4ee047a1f4c4377b"
593
- },
594
- "lifecycle": {
595
- "Package": "lifecycle",
596
- "Version": "1.0.3",
597
- "Source": "Repository",
598
- "Repository": "CRAN",
599
- "Requirements": [
600
- "R",
601
- "cli",
602
- "glue",
603
- "rlang"
604
- ],
605
- "Hash": "001cecbeac1cff9301bdc3775ee46a86"
606
- },
607
- "magrittr": {
608
- "Package": "magrittr",
609
- "Version": "2.0.3",
610
- "Source": "Repository",
611
- "Repository": "CRAN",
612
- "Requirements": [
613
- "R"
614
- ],
615
- "Hash": "7ce2733a9826b3aeb1775d56fd305472"
616
- },
617
- "memoise": {
618
- "Package": "memoise",
619
- "Version": "2.0.1",
620
- "Source": "Repository",
621
- "Repository": "CRAN",
622
- "Requirements": [
623
- "cachem",
624
- "rlang"
625
- ],
626
- "Hash": "e2817ccf4a065c5d9d7f2cfbe7c1d78c"
627
- },
628
- "mgcv": {
629
- "Package": "mgcv",
630
- "Version": "1.8-42",
631
- "Source": "Repository",
632
- "Repository": "CRAN",
633
- "Requirements": [
634
- "Matrix",
635
- "R",
636
- "graphics",
637
- "methods",
638
- "nlme",
639
- "splines",
640
- "stats",
641
- "utils"
642
- ],
643
- "Hash": "3460beba7ccc8946249ba35327ba902a"
644
- },
645
- "mime": {
646
- "Package": "mime",
647
- "Version": "0.12",
648
- "Source": "Repository",
649
- "Repository": "CRAN",
650
- "Requirements": [
651
- "tools"
652
- ],
653
- "Hash": "18e9c28c1d3ca1560ce30658b22ce104"
654
- },
655
- "miniUI": {
656
- "Package": "miniUI",
657
- "Version": "0.1.1.1",
658
- "Source": "Repository",
659
- "Repository": "CRAN",
660
- "Requirements": [
661
- "htmltools",
662
- "shiny",
663
- "utils"
664
- ],
665
- "Hash": "fec5f52652d60615fdb3957b3d74324a"
666
- },
667
- "munsell": {
668
- "Package": "munsell",
669
- "Version": "0.5.0",
670
- "Source": "Repository",
671
- "Repository": "CRAN",
672
- "Requirements": [
673
- "colorspace",
674
- "methods"
675
- ],
676
- "Hash": "6dfe8bf774944bd5595785e3229d8771"
677
- },
678
- "nlme": {
679
- "Package": "nlme",
680
- "Version": "3.1-162",
681
- "Source": "Repository",
682
- "Repository": "CRAN",
683
- "Requirements": [
684
- "R",
685
- "graphics",
686
- "lattice",
687
- "stats",
688
- "utils"
689
- ],
690
- "Hash": "0984ce8da8da9ead8643c5cbbb60f83e"
691
- },
692
- "openssl": {
693
- "Package": "openssl",
694
- "Version": "2.0.6",
695
- "Source": "Repository",
696
- "Repository": "CRAN",
697
- "Requirements": [
698
- "askpass"
699
- ],
700
- "Hash": "0f7cd2962e3044bb940cca4f4b5cecbe"
701
- },
702
- "packrat": {
703
- "Package": "packrat",
704
- "Version": "0.9.1",
705
- "Source": "Repository",
706
- "Repository": "CRAN",
707
- "Requirements": [
708
- "R",
709
- "tools",
710
- "utils"
711
- ],
712
- "Hash": "481428983c19a7c443f7ea1beff0a2de"
713
- },
714
- "palmerpenguins": {
715
- "Package": "palmerpenguins",
716
- "Version": "0.1.1",
717
- "Source": "Repository",
718
- "Repository": "CRAN",
719
- "RemoteType": "standard",
720
- "RemotePkgRef": "palmerpenguins",
721
- "RemoteRef": "palmerpenguins",
722
- "RemoteRepos": "https://cloud.r-project.org",
723
- "RemotePkgPlatform": "source",
724
- "RemoteSha": "0.1.1",
725
- "Requirements": [
726
- "R"
727
- ],
728
- "Hash": "6c6861efbc13c1d543749e9c7be4a592"
729
- },
730
- "pillar": {
731
- "Package": "pillar",
732
- "Version": "1.9.0",
733
- "Source": "Repository",
734
- "Repository": "CRAN",
735
- "Requirements": [
736
- "cli",
737
- "fansi",
738
- "glue",
739
- "lifecycle",
740
- "rlang",
741
- "utf8",
742
- "utils",
743
- "vctrs"
744
- ],
745
- "Hash": "15da5a8412f317beeee6175fbc76f4bb"
746
- },
747
- "pkgconfig": {
748
- "Package": "pkgconfig",
749
- "Version": "2.0.3",
750
- "Source": "Repository",
751
- "Repository": "CRAN",
752
- "Requirements": [
753
- "utils"
754
- ],
755
- "Hash": "01f28d4278f15c76cddbea05899c5d6f"
756
- },
757
- "prettyunits": {
758
- "Package": "prettyunits",
759
- "Version": "1.1.1",
760
- "Source": "Repository",
761
- "Repository": "CRAN",
762
- "Hash": "95ef9167b75dde9d2ccc3c7528393e7e"
763
- },
764
- "progress": {
765
- "Package": "progress",
766
- "Version": "1.2.2",
767
- "Source": "Repository",
768
- "Repository": "CRAN",
769
- "Requirements": [
770
- "R6",
771
- "crayon",
772
- "hms",
773
- "prettyunits"
774
- ],
775
- "Hash": "14dc9f7a3c91ebb14ec5bb9208a07061"
776
- },
777
- "promises": {
778
- "Package": "promises",
779
- "Version": "1.2.0.1",
780
- "Source": "Repository",
781
- "Repository": "CRAN",
782
- "Requirements": [
783
- "R6",
784
- "Rcpp",
785
- "later",
786
- "magrittr",
787
- "rlang",
788
- "stats"
789
- ],
790
- "Hash": "4ab2c43adb4d4699cf3690acd378d75d"
791
- },
792
- "rappdirs": {
793
- "Package": "rappdirs",
794
- "Version": "0.3.3",
795
- "Source": "Repository",
796
- "Repository": "CRAN",
797
- "Requirements": [
798
- "R"
799
- ],
800
- "Hash": "5e3c5dc0b071b21fa128676560dbe94d"
801
- },
802
- "readr": {
803
- "Package": "readr",
804
- "Version": "2.1.4",
805
- "Source": "Repository",
806
- "Repository": "CRAN",
807
- "Requirements": [
808
- "R",
809
- "R6",
810
- "cli",
811
- "clipr",
812
- "cpp11",
813
- "crayon",
814
- "hms",
815
- "lifecycle",
816
- "methods",
817
- "rlang",
818
- "tibble",
819
- "tzdb",
820
- "utils",
821
- "vroom"
822
- ],
823
- "Hash": "b5047343b3825f37ad9d3b5d89aa1078"
824
- },
825
- "renv": {
826
- "Package": "renv",
827
- "Version": "0.17.3",
828
- "Source": "Repository",
829
- "Repository": "CRAN",
830
- "Requirements": [
831
- "utils"
832
- ],
833
- "Hash": "4543b8cd233ae25c6aba8548be9e747e"
834
- },
835
- "rlang": {
836
- "Package": "rlang",
837
- "Version": "1.1.0",
838
- "Source": "Repository",
839
- "Repository": "CRAN",
840
- "Requirements": [
841
- "R",
842
- "utils"
843
- ],
844
- "Hash": "dc079ccd156cde8647360f473c1fa718"
845
- },
846
- "rmarkdown": {
847
- "Package": "rmarkdown",
848
- "Version": "2.21",
849
- "Source": "Repository",
850
- "Repository": "CRAN",
851
- "Requirements": [
852
- "R",
853
- "bslib",
854
- "evaluate",
855
- "fontawesome",
856
- "htmltools",
857
- "jquerylib",
858
- "jsonlite",
859
- "knitr",
860
- "methods",
861
- "stringr",
862
- "tinytex",
863
- "tools",
864
- "utils",
865
- "xfun",
866
- "yaml"
867
- ],
868
- "Hash": "493df4ae51e2e984952ea4d5c75786a3"
869
- },
870
- "rsconnect": {
871
- "Package": "rsconnect",
872
- "Version": "0.8.29",
873
- "Source": "Repository",
874
- "Repository": "CRAN",
875
- "Requirements": [
876
- "R",
877
- "curl",
878
- "digest",
879
- "jsonlite",
880
- "openssl",
881
- "packrat",
882
- "rstudioapi",
883
- "tools",
884
- "yaml"
885
- ],
886
- "Hash": "fe178fc15af80952f546aafedf655b36"
887
- },
888
- "rstudioapi": {
889
- "Package": "rstudioapi",
890
- "Version": "0.14",
891
- "Source": "Repository",
892
- "Repository": "CRAN",
893
- "Hash": "690bd2acc42a9166ce34845884459320"
894
- },
895
- "sass": {
896
- "Package": "sass",
897
- "Version": "0.4.5",
898
- "Source": "Repository",
899
- "Repository": "CRAN",
900
- "Requirements": [
901
- "R6",
902
- "fs",
903
- "htmltools",
904
- "rappdirs",
905
- "rlang"
906
- ],
907
- "Hash": "2bb4371a4c80115518261866eab6ab11"
908
- },
909
- "scales": {
910
- "Package": "scales",
911
- "Version": "1.2.1",
912
- "Source": "Repository",
913
- "Repository": "CRAN",
914
- "Requirements": [
915
- "R",
916
- "R6",
917
- "RColorBrewer",
918
- "farver",
919
- "labeling",
920
- "lifecycle",
921
- "munsell",
922
- "rlang",
923
- "viridisLite"
924
- ],
925
- "Hash": "906cb23d2f1c5680b8ce439b44c6fa63"
926
- },
927
- "shiny": {
928
- "Package": "shiny",
929
- "Version": "1.7.4",
930
- "Source": "Repository",
931
- "Repository": "CRAN",
932
- "Requirements": [
933
- "R",
934
- "R6",
935
- "bslib",
936
- "cachem",
937
- "commonmark",
938
- "crayon",
939
- "ellipsis",
940
- "fastmap",
941
- "fontawesome",
942
- "glue",
943
- "grDevices",
944
- "htmltools",
945
- "httpuv",
946
- "jsonlite",
947
- "later",
948
- "lifecycle",
949
- "methods",
950
- "mime",
951
- "promises",
952
- "rlang",
953
- "sourcetools",
954
- "tools",
955
- "utils",
956
- "withr",
957
- "xtable"
958
- ],
959
- "Hash": "c2eae3d8c670fa9dfa35a12066f4a1d5"
960
- },
961
- "shinyjs": {
962
- "Package": "shinyjs",
963
- "Version": "2.1.0",
964
- "Source": "Repository",
965
- "Repository": "CRAN",
966
- "Requirements": [
967
- "R",
968
- "digest",
969
- "jsonlite",
970
- "shiny"
971
- ],
972
- "Hash": "802e4786b353a4bb27116957558548d5"
973
- },
974
- "sourcetools": {
975
- "Package": "sourcetools",
976
- "Version": "0.1.7-1",
977
- "Source": "Repository",
978
- "Repository": "CRAN",
979
- "Requirements": [
980
- "R"
981
- ],
982
- "Hash": "5f5a7629f956619d519205ec475fe647"
983
- },
984
- "stringi": {
985
- "Package": "stringi",
986
- "Version": "1.7.12",
987
- "Source": "Repository",
988
- "Repository": "CRAN",
989
- "Requirements": [
990
- "R",
991
- "stats",
992
- "tools",
993
- "utils"
994
- ],
995
- "Hash": "ca8bd84263c77310739d2cf64d84d7c9"
996
- },
997
- "stringr": {
998
- "Package": "stringr",
999
- "Version": "1.5.0",
1000
- "Source": "Repository",
1001
- "Repository": "CRAN",
1002
- "Requirements": [
1003
- "R",
1004
- "cli",
1005
- "glue",
1006
- "lifecycle",
1007
- "magrittr",
1008
- "rlang",
1009
- "stringi",
1010
- "vctrs"
1011
- ],
1012
- "Hash": "671a4d384ae9d32fc47a14e98bfa3dc8"
1013
- },
1014
- "sys": {
1015
- "Package": "sys",
1016
- "Version": "3.4.1",
1017
- "Source": "Repository",
1018
- "Repository": "CRAN",
1019
- "Hash": "34c16f1ef796057bfa06d3f4ff818a5d"
1020
- },
1021
- "tibble": {
1022
- "Package": "tibble",
1023
- "Version": "3.2.1",
1024
- "Source": "Repository",
1025
- "Repository": "CRAN",
1026
- "Requirements": [
1027
- "R",
1028
- "fansi",
1029
- "lifecycle",
1030
- "magrittr",
1031
- "methods",
1032
- "pillar",
1033
- "pkgconfig",
1034
- "rlang",
1035
- "utils",
1036
- "vctrs"
1037
- ],
1038
- "Hash": "a84e2cc86d07289b3b6f5069df7a004c"
1039
- },
1040
- "tidyselect": {
1041
- "Package": "tidyselect",
1042
- "Version": "1.2.0",
1043
- "Source": "Repository",
1044
- "Repository": "CRAN",
1045
- "Requirements": [
1046
- "R",
1047
- "cli",
1048
- "glue",
1049
- "lifecycle",
1050
- "rlang",
1051
- "vctrs",
1052
- "withr"
1053
- ],
1054
- "Hash": "79540e5fcd9e0435af547d885f184fd5"
1055
- },
1056
- "tinytex": {
1057
- "Package": "tinytex",
1058
- "Version": "0.45",
1059
- "Source": "Repository",
1060
- "Repository": "CRAN",
1061
- "Requirements": [
1062
- "xfun"
1063
- ],
1064
- "Hash": "e4e357f28c2edff493936b6cb30c3d65"
1065
- },
1066
- "tzdb": {
1067
- "Package": "tzdb",
1068
- "Version": "0.3.0",
1069
- "Source": "Repository",
1070
- "Repository": "CRAN",
1071
- "Requirements": [
1072
- "R",
1073
- "cpp11"
1074
- ],
1075
- "Hash": "b2e1cbce7c903eaf23ec05c58e59fb5e"
1076
- },
1077
- "utf8": {
1078
- "Package": "utf8",
1079
- "Version": "1.2.3",
1080
- "Source": "Repository",
1081
- "Repository": "CRAN",
1082
- "Requirements": [
1083
- "R"
1084
- ],
1085
- "Hash": "1fe17157424bb09c48a8b3b550c753bc"
1086
- },
1087
- "vctrs": {
1088
- "Package": "vctrs",
1089
- "Version": "0.6.1",
1090
- "Source": "Repository",
1091
- "Repository": "CRAN",
1092
- "Requirements": [
1093
- "R",
1094
- "cli",
1095
- "glue",
1096
- "lifecycle",
1097
- "rlang"
1098
- ],
1099
- "Hash": "06eceb3a5d716fd0654cc23ca3d71a99"
1100
- },
1101
- "viridisLite": {
1102
- "Package": "viridisLite",
1103
- "Version": "0.4.1",
1104
- "Source": "Repository",
1105
- "Repository": "CRAN",
1106
- "Requirements": [
1107
- "R"
1108
- ],
1109
- "Hash": "62f4b5da3e08d8e5bcba6cac15603f70"
1110
- },
1111
- "vroom": {
1112
- "Package": "vroom",
1113
- "Version": "1.6.1",
1114
- "Source": "Repository",
1115
- "Repository": "CRAN",
1116
- "Requirements": [
1117
- "R",
1118
- "bit64",
1119
- "cli",
1120
- "cpp11",
1121
- "crayon",
1122
- "glue",
1123
- "hms",
1124
- "lifecycle",
1125
- "methods",
1126
- "progress",
1127
- "rlang",
1128
- "stats",
1129
- "tibble",
1130
- "tidyselect",
1131
- "tzdb",
1132
- "vctrs",
1133
- "withr"
1134
- ],
1135
- "Hash": "7015a74373b83ffaef64023f4a0f5033"
1136
- },
1137
- "withr": {
1138
- "Package": "withr",
1139
- "Version": "2.5.0",
1140
- "Source": "Repository",
1141
- "Repository": "CRAN",
1142
- "Requirements": [
1143
- "R",
1144
- "grDevices",
1145
- "graphics",
1146
- "stats"
1147
- ],
1148
- "Hash": "c0e49a9760983e81e55cdd9be92e7182"
1149
- },
1150
- "xfun": {
1151
- "Package": "xfun",
1152
- "Version": "0.38",
1153
- "Source": "Repository",
1154
- "Repository": "CRAN",
1155
- "Requirements": [
1156
- "stats",
1157
- "tools"
1158
- ],
1159
- "Hash": "1ed71215d45e85562d3b1b29a068ccec"
1160
- },
1161
- "xtable": {
1162
- "Package": "xtable",
1163
- "Version": "1.8-4",
1164
- "Source": "Repository",
1165
- "Repository": "CRAN",
1166
- "Requirements": [
1167
- "R",
1168
- "stats",
1169
- "utils"
1170
- ],
1171
- "Hash": "b8acdf8af494d9ec19ccb2481a9b11c2"
1172
- },
1173
- "yaml": {
1174
- "Package": "yaml",
1175
- "Version": "2.3.7",
1176
- "Source": "Repository",
1177
- "Repository": "CRAN",
1178
- "Hash": "0d0056cc5383fbc240ccd0cb584bf436"
1179
- }
1180
- }
1181
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
renv/.gitignore DELETED
@@ -1,7 +0,0 @@
1
- library/
2
- local/
3
- cellar/
4
- lock/
5
- python/
6
- sandbox/
7
- staging/
 
 
 
 
 
 
 
 
renv/activate.R DELETED
@@ -1,1032 +0,0 @@
1
-
2
- local({
3
-
4
- # the requested version of renv
5
- version <- "0.17.3"
6
-
7
- # the project directory
8
- project <- getwd()
9
-
10
- # figure out whether the autoloader is enabled
11
- enabled <- local({
12
-
13
- # first, check config option
14
- override <- getOption("renv.config.autoloader.enabled")
15
- if (!is.null(override))
16
- return(override)
17
-
18
- # next, check environment variables
19
- # TODO: prefer using the configuration one in the future
20
- envvars <- c(
21
- "RENV_CONFIG_AUTOLOADER_ENABLED",
22
- "RENV_AUTOLOADER_ENABLED",
23
- "RENV_ACTIVATE_PROJECT"
24
- )
25
-
26
- for (envvar in envvars) {
27
- envval <- Sys.getenv(envvar, unset = NA)
28
- if (!is.na(envval))
29
- return(tolower(envval) %in% c("true", "t", "1"))
30
- }
31
-
32
- # enable by default
33
- TRUE
34
-
35
- })
36
-
37
- if (!enabled)
38
- return(FALSE)
39
-
40
- # avoid recursion
41
- if (identical(getOption("renv.autoloader.running"), TRUE)) {
42
- warning("ignoring recursive attempt to run renv autoloader")
43
- return(invisible(TRUE))
44
- }
45
-
46
- # signal that we're loading renv during R startup
47
- options(renv.autoloader.running = TRUE)
48
- on.exit(options(renv.autoloader.running = NULL), add = TRUE)
49
-
50
- # signal that we've consented to use renv
51
- options(renv.consent = TRUE)
52
-
53
- # load the 'utils' package eagerly -- this ensures that renv shims, which
54
- # mask 'utils' packages, will come first on the search path
55
- library(utils, lib.loc = .Library)
56
-
57
- # unload renv if it's already been loaded
58
- if ("renv" %in% loadedNamespaces())
59
- unloadNamespace("renv")
60
-
61
- # load bootstrap tools
62
- `%||%` <- function(x, y) {
63
- if (is.environment(x) || length(x)) x else y
64
- }
65
-
66
- `%??%` <- function(x, y) {
67
- if (is.null(x)) y else x
68
- }
69
-
70
- bootstrap <- function(version, library) {
71
-
72
- # attempt to download renv
73
- tarball <- tryCatch(renv_bootstrap_download(version), error = identity)
74
- if (inherits(tarball, "error"))
75
- stop("failed to download renv ", version)
76
-
77
- # now attempt to install
78
- status <- tryCatch(renv_bootstrap_install(version, tarball, library), error = identity)
79
- if (inherits(status, "error"))
80
- stop("failed to install renv ", version)
81
-
82
- }
83
-
84
- renv_bootstrap_tests_running <- function() {
85
- getOption("renv.tests.running", default = FALSE)
86
- }
87
-
88
- renv_bootstrap_repos <- function() {
89
-
90
- # get CRAN repository
91
- cran <- getOption("renv.repos.cran", "https://cloud.r-project.org")
92
-
93
- # check for repos override
94
- repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA)
95
- if (!is.na(repos)) {
96
-
97
- # check for RSPM; if set, use a fallback repository for renv
98
- rspm <- Sys.getenv("RSPM", unset = NA)
99
- if (identical(rspm, repos))
100
- repos <- c(RSPM = rspm, CRAN = cran)
101
-
102
- return(repos)
103
-
104
- }
105
-
106
- # check for lockfile repositories
107
- repos <- tryCatch(renv_bootstrap_repos_lockfile(), error = identity)
108
- if (!inherits(repos, "error") && length(repos))
109
- return(repos)
110
-
111
- # if we're testing, re-use the test repositories
112
- if (renv_bootstrap_tests_running()) {
113
- repos <- getOption("renv.tests.repos")
114
- if (!is.null(repos))
115
- return(repos)
116
- }
117
-
118
- # retrieve current repos
119
- repos <- getOption("repos")
120
-
121
- # ensure @CRAN@ entries are resolved
122
- repos[repos == "@CRAN@"] <- cran
123
-
124
- # add in renv.bootstrap.repos if set
125
- default <- c(FALLBACK = "https://cloud.r-project.org")
126
- extra <- getOption("renv.bootstrap.repos", default = default)
127
- repos <- c(repos, extra)
128
-
129
- # remove duplicates that might've snuck in
130
- dupes <- duplicated(repos) | duplicated(names(repos))
131
- repos[!dupes]
132
-
133
- }
134
-
135
- renv_bootstrap_repos_lockfile <- function() {
136
-
137
- lockpath <- Sys.getenv("RENV_PATHS_LOCKFILE", unset = "renv.lock")
138
- if (!file.exists(lockpath))
139
- return(NULL)
140
-
141
- lockfile <- tryCatch(renv_json_read(lockpath), error = identity)
142
- if (inherits(lockfile, "error")) {
143
- warning(lockfile)
144
- return(NULL)
145
- }
146
-
147
- repos <- lockfile$R$Repositories
148
- if (length(repos) == 0)
149
- return(NULL)
150
-
151
- keys <- vapply(repos, `[[`, "Name", FUN.VALUE = character(1))
152
- vals <- vapply(repos, `[[`, "URL", FUN.VALUE = character(1))
153
- names(vals) <- keys
154
-
155
- return(vals)
156
-
157
- }
158
-
159
- renv_bootstrap_download <- function(version) {
160
-
161
- # if the renv version number has 4 components, assume it must
162
- # be retrieved via github
163
- nv <- numeric_version(version)
164
- components <- unclass(nv)[[1]]
165
-
166
- # if this appears to be a development version of 'renv', we'll
167
- # try to restore from github
168
- dev <- length(components) == 4L
169
-
170
- # begin collecting different methods for finding renv
171
- methods <- c(
172
- renv_bootstrap_download_tarball,
173
- if (dev)
174
- renv_bootstrap_download_github
175
- else c(
176
- renv_bootstrap_download_cran_latest,
177
- renv_bootstrap_download_cran_archive
178
- )
179
- )
180
-
181
- for (method in methods) {
182
- path <- tryCatch(method(version), error = identity)
183
- if (is.character(path) && file.exists(path))
184
- return(path)
185
- }
186
-
187
- stop("failed to download renv ", version)
188
-
189
- }
190
-
191
- renv_bootstrap_download_impl <- function(url, destfile) {
192
-
193
- mode <- "wb"
194
-
195
- # https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17715
196
- fixup <-
197
- Sys.info()[["sysname"]] == "Windows" &&
198
- substring(url, 1L, 5L) == "file:"
199
-
200
- if (fixup)
201
- mode <- "w+b"
202
-
203
- args <- list(
204
- url = url,
205
- destfile = destfile,
206
- mode = mode,
207
- quiet = TRUE
208
- )
209
-
210
- if ("headers" %in% names(formals(utils::download.file)))
211
- args$headers <- renv_bootstrap_download_custom_headers(url)
212
-
213
- do.call(utils::download.file, args)
214
-
215
- }
216
-
217
- renv_bootstrap_download_custom_headers <- function(url) {
218
-
219
- headers <- getOption("renv.download.headers")
220
- if (is.null(headers))
221
- return(character())
222
-
223
- if (!is.function(headers))
224
- stopf("'renv.download.headers' is not a function")
225
-
226
- headers <- headers(url)
227
- if (length(headers) == 0L)
228
- return(character())
229
-
230
- if (is.list(headers))
231
- headers <- unlist(headers, recursive = FALSE, use.names = TRUE)
232
-
233
- ok <-
234
- is.character(headers) &&
235
- is.character(names(headers)) &&
236
- all(nzchar(names(headers)))
237
-
238
- if (!ok)
239
- stop("invocation of 'renv.download.headers' did not return a named character vector")
240
-
241
- headers
242
-
243
- }
244
-
245
- renv_bootstrap_download_cran_latest <- function(version) {
246
-
247
- spec <- renv_bootstrap_download_cran_latest_find(version)
248
- type <- spec$type
249
- repos <- spec$repos
250
-
251
- message("* Downloading renv ", version, " ... ", appendLF = FALSE)
252
-
253
- baseurl <- utils::contrib.url(repos = repos, type = type)
254
- ext <- if (identical(type, "source"))
255
- ".tar.gz"
256
- else if (Sys.info()[["sysname"]] == "Windows")
257
- ".zip"
258
- else
259
- ".tgz"
260
- name <- sprintf("renv_%s%s", version, ext)
261
- url <- paste(baseurl, name, sep = "/")
262
-
263
- destfile <- file.path(tempdir(), name)
264
- status <- tryCatch(
265
- renv_bootstrap_download_impl(url, destfile),
266
- condition = identity
267
- )
268
-
269
- if (inherits(status, "condition")) {
270
- message("FAILED")
271
- return(FALSE)
272
- }
273
-
274
- # report success and return
275
- message("OK (downloaded ", type, ")")
276
- destfile
277
-
278
- }
279
-
280
- renv_bootstrap_download_cran_latest_find <- function(version) {
281
-
282
- # check whether binaries are supported on this system
283
- binary <-
284
- getOption("renv.bootstrap.binary", default = TRUE) &&
285
- !identical(.Platform$pkgType, "source") &&
286
- !identical(getOption("pkgType"), "source") &&
287
- Sys.info()[["sysname"]] %in% c("Darwin", "Windows")
288
-
289
- types <- c(if (binary) "binary", "source")
290
-
291
- # iterate over types + repositories
292
- for (type in types) {
293
- for (repos in renv_bootstrap_repos()) {
294
-
295
- # retrieve package database
296
- db <- tryCatch(
297
- as.data.frame(
298
- utils::available.packages(type = type, repos = repos),
299
- stringsAsFactors = FALSE
300
- ),
301
- error = identity
302
- )
303
-
304
- if (inherits(db, "error"))
305
- next
306
-
307
- # check for compatible entry
308
- entry <- db[db$Package %in% "renv" & db$Version %in% version, ]
309
- if (nrow(entry) == 0)
310
- next
311
-
312
- # found it; return spec to caller
313
- spec <- list(entry = entry, type = type, repos = repos)
314
- return(spec)
315
-
316
- }
317
- }
318
-
319
- # if we got here, we failed to find renv
320
- fmt <- "renv %s is not available from your declared package repositories"
321
- stop(sprintf(fmt, version))
322
-
323
- }
324
-
325
- renv_bootstrap_download_cran_archive <- function(version) {
326
-
327
- name <- sprintf("renv_%s.tar.gz", version)
328
- repos <- renv_bootstrap_repos()
329
- urls <- file.path(repos, "src/contrib/Archive/renv", name)
330
- destfile <- file.path(tempdir(), name)
331
-
332
- message("* Downloading renv ", version, " ... ", appendLF = FALSE)
333
-
334
- for (url in urls) {
335
-
336
- status <- tryCatch(
337
- renv_bootstrap_download_impl(url, destfile),
338
- condition = identity
339
- )
340
-
341
- if (identical(status, 0L)) {
342
- message("OK")
343
- return(destfile)
344
- }
345
-
346
- }
347
-
348
- message("FAILED")
349
- return(FALSE)
350
-
351
- }
352
-
353
- renv_bootstrap_download_tarball <- function(version) {
354
-
355
- # if the user has provided the path to a tarball via
356
- # an environment variable, then use it
357
- tarball <- Sys.getenv("RENV_BOOTSTRAP_TARBALL", unset = NA)
358
- if (is.na(tarball))
359
- return()
360
-
361
- # allow directories
362
- if (dir.exists(tarball)) {
363
- name <- sprintf("renv_%s.tar.gz", version)
364
- tarball <- file.path(tarball, name)
365
- }
366
-
367
- # bail if it doesn't exist
368
- if (!file.exists(tarball)) {
369
-
370
- # let the user know we weren't able to honour their request
371
- fmt <- "* RENV_BOOTSTRAP_TARBALL is set (%s) but does not exist."
372
- msg <- sprintf(fmt, tarball)
373
- warning(msg)
374
-
375
- # bail
376
- return()
377
-
378
- }
379
-
380
- fmt <- "* Bootstrapping with tarball at path '%s'."
381
- msg <- sprintf(fmt, tarball)
382
- message(msg)
383
-
384
- tarball
385
-
386
- }
387
-
388
- renv_bootstrap_download_github <- function(version) {
389
-
390
- enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE")
391
- if (!identical(enabled, "TRUE"))
392
- return(FALSE)
393
-
394
- # prepare download options
395
- pat <- Sys.getenv("GITHUB_PAT")
396
- if (nzchar(Sys.which("curl")) && nzchar(pat)) {
397
- fmt <- "--location --fail --header \"Authorization: token %s\""
398
- extra <- sprintf(fmt, pat)
399
- saved <- options("download.file.method", "download.file.extra")
400
- options(download.file.method = "curl", download.file.extra = extra)
401
- on.exit(do.call(base::options, saved), add = TRUE)
402
- } else if (nzchar(Sys.which("wget")) && nzchar(pat)) {
403
- fmt <- "--header=\"Authorization: token %s\""
404
- extra <- sprintf(fmt, pat)
405
- saved <- options("download.file.method", "download.file.extra")
406
- options(download.file.method = "wget", download.file.extra = extra)
407
- on.exit(do.call(base::options, saved), add = TRUE)
408
- }
409
-
410
- message("* Downloading renv ", version, " from GitHub ... ", appendLF = FALSE)
411
-
412
- url <- file.path("https://api.github.com/repos/rstudio/renv/tarball", version)
413
- name <- sprintf("renv_%s.tar.gz", version)
414
- destfile <- file.path(tempdir(), name)
415
-
416
- status <- tryCatch(
417
- renv_bootstrap_download_impl(url, destfile),
418
- condition = identity
419
- )
420
-
421
- if (!identical(status, 0L)) {
422
- message("FAILED")
423
- return(FALSE)
424
- }
425
-
426
- message("OK")
427
- return(destfile)
428
-
429
- }
430
-
431
- renv_bootstrap_install <- function(version, tarball, library) {
432
-
433
- # attempt to install it into project library
434
- message("* Installing renv ", version, " ... ", appendLF = FALSE)
435
- dir.create(library, showWarnings = FALSE, recursive = TRUE)
436
-
437
- # invoke using system2 so we can capture and report output
438
- bin <- R.home("bin")
439
- exe <- if (Sys.info()[["sysname"]] == "Windows") "R.exe" else "R"
440
- r <- file.path(bin, exe)
441
-
442
- args <- c(
443
- "--vanilla", "CMD", "INSTALL", "--no-multiarch",
444
- "-l", shQuote(path.expand(library)),
445
- shQuote(path.expand(tarball))
446
- )
447
-
448
- output <- system2(r, args, stdout = TRUE, stderr = TRUE)
449
- message("Done!")
450
-
451
- # check for successful install
452
- status <- attr(output, "status")
453
- if (is.numeric(status) && !identical(status, 0L)) {
454
- header <- "Error installing renv:"
455
- lines <- paste(rep.int("=", nchar(header)), collapse = "")
456
- text <- c(header, lines, output)
457
- writeLines(text, con = stderr())
458
- }
459
-
460
- status
461
-
462
- }
463
-
464
- renv_bootstrap_platform_prefix <- function() {
465
-
466
- # construct version prefix
467
- version <- paste(R.version$major, R.version$minor, sep = ".")
468
- prefix <- paste("R", numeric_version(version)[1, 1:2], sep = "-")
469
-
470
- # include SVN revision for development versions of R
471
- # (to avoid sharing platform-specific artefacts with released versions of R)
472
- devel <-
473
- identical(R.version[["status"]], "Under development (unstable)") ||
474
- identical(R.version[["nickname"]], "Unsuffered Consequences")
475
-
476
- if (devel)
477
- prefix <- paste(prefix, R.version[["svn rev"]], sep = "-r")
478
-
479
- # build list of path components
480
- components <- c(prefix, R.version$platform)
481
-
482
- # include prefix if provided by user
483
- prefix <- renv_bootstrap_platform_prefix_impl()
484
- if (!is.na(prefix) && nzchar(prefix))
485
- components <- c(prefix, components)
486
-
487
- # build prefix
488
- paste(components, collapse = "/")
489
-
490
- }
491
-
492
- renv_bootstrap_platform_prefix_impl <- function() {
493
-
494
- # if an explicit prefix has been supplied, use it
495
- prefix <- Sys.getenv("RENV_PATHS_PREFIX", unset = NA)
496
- if (!is.na(prefix))
497
- return(prefix)
498
-
499
- # if the user has requested an automatic prefix, generate it
500
- auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA)
501
- if (auto %in% c("TRUE", "True", "true", "1"))
502
- return(renv_bootstrap_platform_prefix_auto())
503
-
504
- # empty string on failure
505
- ""
506
-
507
- }
508
-
509
- renv_bootstrap_platform_prefix_auto <- function() {
510
-
511
- prefix <- tryCatch(renv_bootstrap_platform_os(), error = identity)
512
- if (inherits(prefix, "error") || prefix %in% "unknown") {
513
-
514
- msg <- paste(
515
- "failed to infer current operating system",
516
- "please file a bug report at https://github.com/rstudio/renv/issues",
517
- sep = "; "
518
- )
519
-
520
- warning(msg)
521
-
522
- }
523
-
524
- prefix
525
-
526
- }
527
-
528
- renv_bootstrap_platform_os <- function() {
529
-
530
- sysinfo <- Sys.info()
531
- sysname <- sysinfo[["sysname"]]
532
-
533
- # handle Windows + macOS up front
534
- if (sysname == "Windows")
535
- return("windows")
536
- else if (sysname == "Darwin")
537
- return("macos")
538
-
539
- # check for os-release files
540
- for (file in c("/etc/os-release", "/usr/lib/os-release"))
541
- if (file.exists(file))
542
- return(renv_bootstrap_platform_os_via_os_release(file, sysinfo))
543
-
544
- # check for redhat-release files
545
- if (file.exists("/etc/redhat-release"))
546
- return(renv_bootstrap_platform_os_via_redhat_release())
547
-
548
- "unknown"
549
-
550
- }
551
-
552
- renv_bootstrap_platform_os_via_os_release <- function(file, sysinfo) {
553
-
554
- # read /etc/os-release
555
- release <- utils::read.table(
556
- file = file,
557
- sep = "=",
558
- quote = c("\"", "'"),
559
- col.names = c("Key", "Value"),
560
- comment.char = "#",
561
- stringsAsFactors = FALSE
562
- )
563
-
564
- vars <- as.list(release$Value)
565
- names(vars) <- release$Key
566
-
567
- # get os name
568
- os <- tolower(sysinfo[["sysname"]])
569
-
570
- # read id
571
- id <- "unknown"
572
- for (field in c("ID", "ID_LIKE")) {
573
- if (field %in% names(vars) && nzchar(vars[[field]])) {
574
- id <- vars[[field]]
575
- break
576
- }
577
- }
578
-
579
- # read version
580
- version <- "unknown"
581
- for (field in c("UBUNTU_CODENAME", "VERSION_CODENAME", "VERSION_ID", "BUILD_ID")) {
582
- if (field %in% names(vars) && nzchar(vars[[field]])) {
583
- version <- vars[[field]]
584
- break
585
- }
586
- }
587
-
588
- # join together
589
- paste(c(os, id, version), collapse = "-")
590
-
591
- }
592
-
593
- renv_bootstrap_platform_os_via_redhat_release <- function() {
594
-
595
- # read /etc/redhat-release
596
- contents <- readLines("/etc/redhat-release", warn = FALSE)
597
-
598
- # infer id
599
- id <- if (grepl("centos", contents, ignore.case = TRUE))
600
- "centos"
601
- else if (grepl("redhat", contents, ignore.case = TRUE))
602
- "redhat"
603
- else
604
- "unknown"
605
-
606
- # try to find a version component (very hacky)
607
- version <- "unknown"
608
-
609
- parts <- strsplit(contents, "[[:space:]]")[[1L]]
610
- for (part in parts) {
611
-
612
- nv <- tryCatch(numeric_version(part), error = identity)
613
- if (inherits(nv, "error"))
614
- next
615
-
616
- version <- nv[1, 1]
617
- break
618
-
619
- }
620
-
621
- paste(c("linux", id, version), collapse = "-")
622
-
623
- }
624
-
625
- renv_bootstrap_library_root_name <- function(project) {
626
-
627
- # use project name as-is if requested
628
- asis <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT_ASIS", unset = "FALSE")
629
- if (asis)
630
- return(basename(project))
631
-
632
- # otherwise, disambiguate based on project's path
633
- id <- substring(renv_bootstrap_hash_text(project), 1L, 8L)
634
- paste(basename(project), id, sep = "-")
635
-
636
- }
637
-
638
- renv_bootstrap_library_root <- function(project) {
639
-
640
- prefix <- renv_bootstrap_profile_prefix()
641
-
642
- path <- Sys.getenv("RENV_PATHS_LIBRARY", unset = NA)
643
- if (!is.na(path))
644
- return(paste(c(path, prefix), collapse = "/"))
645
-
646
- path <- renv_bootstrap_library_root_impl(project)
647
- if (!is.null(path)) {
648
- name <- renv_bootstrap_library_root_name(project)
649
- return(paste(c(path, prefix, name), collapse = "/"))
650
- }
651
-
652
- renv_bootstrap_paths_renv("library", project = project)
653
-
654
- }
655
-
656
- renv_bootstrap_library_root_impl <- function(project) {
657
-
658
- root <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT", unset = NA)
659
- if (!is.na(root))
660
- return(root)
661
-
662
- type <- renv_bootstrap_project_type(project)
663
- if (identical(type, "package")) {
664
- userdir <- renv_bootstrap_user_dir()
665
- return(file.path(userdir, "library"))
666
- }
667
-
668
- }
669
-
670
- renv_bootstrap_validate_version <- function(version) {
671
-
672
- loadedversion <- utils::packageDescription("renv", fields = "Version")
673
- if (version == loadedversion)
674
- return(TRUE)
675
-
676
- # assume four-component versions are from GitHub;
677
- # three-component versions are from CRAN
678
- components <- strsplit(loadedversion, "[.-]")[[1]]
679
- remote <- if (length(components) == 4L)
680
- paste("rstudio/renv", loadedversion, sep = "@")
681
- else
682
- paste("renv", loadedversion, sep = "@")
683
-
684
- fmt <- paste(
685
- "renv %1$s was loaded from project library, but this project is configured to use renv %2$s.",
686
- "Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile.",
687
- "Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library.",
688
- sep = "\n"
689
- )
690
-
691
- msg <- sprintf(fmt, loadedversion, version, remote)
692
- warning(msg, call. = FALSE)
693
-
694
- FALSE
695
-
696
- }
697
-
698
- renv_bootstrap_hash_text <- function(text) {
699
-
700
- hashfile <- tempfile("renv-hash-")
701
- on.exit(unlink(hashfile), add = TRUE)
702
-
703
- writeLines(text, con = hashfile)
704
- tools::md5sum(hashfile)
705
-
706
- }
707
-
708
- renv_bootstrap_load <- function(project, libpath, version) {
709
-
710
- # try to load renv from the project library
711
- if (!requireNamespace("renv", lib.loc = libpath, quietly = TRUE))
712
- return(FALSE)
713
-
714
- # warn if the version of renv loaded does not match
715
- renv_bootstrap_validate_version(version)
716
-
717
- # execute renv load hooks, if any
718
- hooks <- getHook("renv::autoload")
719
- for (hook in hooks)
720
- if (is.function(hook))
721
- tryCatch(hook(), error = warning)
722
-
723
- # load the project
724
- renv::load(project)
725
-
726
- TRUE
727
-
728
- }
729
-
730
- renv_bootstrap_profile_load <- function(project) {
731
-
732
- # if RENV_PROFILE is already set, just use that
733
- profile <- Sys.getenv("RENV_PROFILE", unset = NA)
734
- if (!is.na(profile) && nzchar(profile))
735
- return(profile)
736
-
737
- # check for a profile file (nothing to do if it doesn't exist)
738
- path <- renv_bootstrap_paths_renv("profile", profile = FALSE, project = project)
739
- if (!file.exists(path))
740
- return(NULL)
741
-
742
- # read the profile, and set it if it exists
743
- contents <- readLines(path, warn = FALSE)
744
- if (length(contents) == 0L)
745
- return(NULL)
746
-
747
- # set RENV_PROFILE
748
- profile <- contents[[1L]]
749
- if (!profile %in% c("", "default"))
750
- Sys.setenv(RENV_PROFILE = profile)
751
-
752
- profile
753
-
754
- }
755
-
756
- renv_bootstrap_profile_prefix <- function() {
757
- profile <- renv_bootstrap_profile_get()
758
- if (!is.null(profile))
759
- return(file.path("profiles", profile, "renv"))
760
- }
761
-
762
- renv_bootstrap_profile_get <- function() {
763
- profile <- Sys.getenv("RENV_PROFILE", unset = "")
764
- renv_bootstrap_profile_normalize(profile)
765
- }
766
-
767
- renv_bootstrap_profile_set <- function(profile) {
768
- profile <- renv_bootstrap_profile_normalize(profile)
769
- if (is.null(profile))
770
- Sys.unsetenv("RENV_PROFILE")
771
- else
772
- Sys.setenv(RENV_PROFILE = profile)
773
- }
774
-
775
- renv_bootstrap_profile_normalize <- function(profile) {
776
-
777
- if (is.null(profile) || profile %in% c("", "default"))
778
- return(NULL)
779
-
780
- profile
781
-
782
- }
783
-
784
- renv_bootstrap_path_absolute <- function(path) {
785
-
786
- substr(path, 1L, 1L) %in% c("~", "/", "\\") || (
787
- substr(path, 1L, 1L) %in% c(letters, LETTERS) &&
788
- substr(path, 2L, 3L) %in% c(":/", ":\\")
789
- )
790
-
791
- }
792
-
793
- renv_bootstrap_paths_renv <- function(..., profile = TRUE, project = NULL) {
794
- renv <- Sys.getenv("RENV_PATHS_RENV", unset = "renv")
795
- root <- if (renv_bootstrap_path_absolute(renv)) NULL else project
796
- prefix <- if (profile) renv_bootstrap_profile_prefix()
797
- components <- c(root, renv, prefix, ...)
798
- paste(components, collapse = "/")
799
- }
800
-
801
- renv_bootstrap_project_type <- function(path) {
802
-
803
- descpath <- file.path(path, "DESCRIPTION")
804
- if (!file.exists(descpath))
805
- return("unknown")
806
-
807
- desc <- tryCatch(
808
- read.dcf(descpath, all = TRUE),
809
- error = identity
810
- )
811
-
812
- if (inherits(desc, "error"))
813
- return("unknown")
814
-
815
- type <- desc$Type
816
- if (!is.null(type))
817
- return(tolower(type))
818
-
819
- package <- desc$Package
820
- if (!is.null(package))
821
- return("package")
822
-
823
- "unknown"
824
-
825
- }
826
-
827
- renv_bootstrap_user_dir <- function() {
828
- dir <- renv_bootstrap_user_dir_impl()
829
- path.expand(chartr("\\", "/", dir))
830
- }
831
-
832
- renv_bootstrap_user_dir_impl <- function() {
833
-
834
- # use local override if set
835
- override <- getOption("renv.userdir.override")
836
- if (!is.null(override))
837
- return(override)
838
-
839
- # use R_user_dir if available
840
- tools <- asNamespace("tools")
841
- if (is.function(tools$R_user_dir))
842
- return(tools$R_user_dir("renv", "cache"))
843
-
844
- # try using our own backfill for older versions of R
845
- envvars <- c("R_USER_CACHE_DIR", "XDG_CACHE_HOME")
846
- for (envvar in envvars) {
847
- root <- Sys.getenv(envvar, unset = NA)
848
- if (!is.na(root))
849
- return(file.path(root, "R/renv"))
850
- }
851
-
852
- # use platform-specific default fallbacks
853
- if (Sys.info()[["sysname"]] == "Windows")
854
- file.path(Sys.getenv("LOCALAPPDATA"), "R/cache/R/renv")
855
- else if (Sys.info()[["sysname"]] == "Darwin")
856
- "~/Library/Caches/org.R-project.R/R/renv"
857
- else
858
- "~/.cache/R/renv"
859
-
860
- }
861
-
862
-
863
- renv_json_read <- function(file = NULL, text = NULL) {
864
-
865
- jlerr <- NULL
866
-
867
- # if jsonlite is loaded, use that instead
868
- if ("jsonlite" %in% loadedNamespaces()) {
869
-
870
- json <- catch(renv_json_read_jsonlite(file, text))
871
- if (!inherits(json, "error"))
872
- return(json)
873
-
874
- jlerr <- json
875
-
876
- }
877
-
878
- # otherwise, fall back to the default JSON reader
879
- json <- catch(renv_json_read_default(file, text))
880
- if (!inherits(json, "error"))
881
- return(json)
882
-
883
- # report an error
884
- if (!is.null(jlerr))
885
- stop(jlerr)
886
- else
887
- stop(json)
888
-
889
- }
890
-
891
- renv_json_read_jsonlite <- function(file = NULL, text = NULL) {
892
- text <- paste(text %||% read(file), collapse = "\n")
893
- jsonlite::fromJSON(txt = text, simplifyVector = FALSE)
894
- }
895
-
896
- renv_json_read_default <- function(file = NULL, text = NULL) {
897
-
898
- # find strings in the JSON
899
- text <- paste(text %||% read(file), collapse = "\n")
900
- pattern <- '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
901
- locs <- gregexpr(pattern, text, perl = TRUE)[[1]]
902
-
903
- # if any are found, replace them with placeholders
904
- replaced <- text
905
- strings <- character()
906
- replacements <- character()
907
-
908
- if (!identical(c(locs), -1L)) {
909
-
910
- # get the string values
911
- starts <- locs
912
- ends <- locs + attr(locs, "match.length") - 1L
913
- strings <- substring(text, starts, ends)
914
-
915
- # only keep those requiring escaping
916
- strings <- grep("[[\\]{}:]", strings, perl = TRUE, value = TRUE)
917
-
918
- # compute replacements
919
- replacements <- sprintf('"\032%i\032"', seq_along(strings))
920
-
921
- # replace the strings
922
- mapply(function(string, replacement) {
923
- replaced <<- sub(string, replacement, replaced, fixed = TRUE)
924
- }, strings, replacements)
925
-
926
- }
927
-
928
- # transform the JSON into something the R parser understands
929
- transformed <- replaced
930
- transformed <- gsub("{}", "`names<-`(list(), character())", transformed, fixed = TRUE)
931
- transformed <- gsub("[[{]", "list(", transformed, perl = TRUE)
932
- transformed <- gsub("[]}]", ")", transformed, perl = TRUE)
933
- transformed <- gsub(":", "=", transformed, fixed = TRUE)
934
- text <- paste(transformed, collapse = "\n")
935
-
936
- # parse it
937
- json <- parse(text = text, keep.source = FALSE, srcfile = NULL)[[1L]]
938
-
939
- # construct map between source strings, replaced strings
940
- map <- as.character(parse(text = strings))
941
- names(map) <- as.character(parse(text = replacements))
942
-
943
- # convert to list
944
- map <- as.list(map)
945
-
946
- # remap strings in object
947
- remapped <- renv_json_remap(json, map)
948
-
949
- # evaluate
950
- eval(remapped, envir = baseenv())
951
-
952
- }
953
-
954
- renv_json_remap <- function(json, map) {
955
-
956
- # fix names
957
- if (!is.null(names(json))) {
958
- lhs <- match(names(json), names(map), nomatch = 0L)
959
- rhs <- match(names(map), names(json), nomatch = 0L)
960
- names(json)[rhs] <- map[lhs]
961
- }
962
-
963
- # fix values
964
- if (is.character(json))
965
- return(map[[json]] %||% json)
966
-
967
- # handle true, false, null
968
- if (is.name(json)) {
969
- text <- as.character(json)
970
- if (text == "true")
971
- return(TRUE)
972
- else if (text == "false")
973
- return(FALSE)
974
- else if (text == "null")
975
- return(NULL)
976
- }
977
-
978
- # recurse
979
- if (is.recursive(json)) {
980
- for (i in seq_along(json)) {
981
- json[i] <- list(renv_json_remap(json[[i]], map))
982
- }
983
- }
984
-
985
- json
986
-
987
- }
988
-
989
- # load the renv profile, if any
990
- renv_bootstrap_profile_load(project)
991
-
992
- # construct path to library root
993
- root <- renv_bootstrap_library_root(project)
994
-
995
- # construct library prefix for platform
996
- prefix <- renv_bootstrap_platform_prefix()
997
-
998
- # construct full libpath
999
- libpath <- file.path(root, prefix)
1000
-
1001
- # attempt to load
1002
- if (renv_bootstrap_load(project, libpath, version))
1003
- return(TRUE)
1004
-
1005
- # load failed; inform user we're about to bootstrap
1006
- prefix <- paste("# Bootstrapping renv", version)
1007
- postfix <- paste(rep.int("-", 77L - nchar(prefix)), collapse = "")
1008
- header <- paste(prefix, postfix)
1009
- message(header)
1010
-
1011
- # perform bootstrap
1012
- bootstrap(version, libpath)
1013
-
1014
- # exit early if we're just testing bootstrap
1015
- if (!is.na(Sys.getenv("RENV_BOOTSTRAP_INSTALL_ONLY", unset = NA)))
1016
- return(TRUE)
1017
-
1018
- # try again to load
1019
- if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) {
1020
- message("* Successfully installed and loaded renv ", version, ".")
1021
- return(renv::load())
1022
- }
1023
-
1024
- # failed to download or load renv; warn the user
1025
- msg <- c(
1026
- "Failed to find an renv installation: the project will not be loaded.",
1027
- "Use `renv::activate()` to re-initialize the project."
1028
- )
1029
-
1030
- warning(paste(msg, collapse = "\n"), call. = FALSE)
1031
-
1032
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
renv/settings.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "bioconductor.version": null,
3
- "external.libraries": [],
4
- "ignored.packages": [],
5
- "package.dependency.fields": [
6
- "Imports",
7
- "Depends",
8
- "LinkingTo"
9
- ],
10
- "r.version": null,
11
- "snapshot.type": "implicit",
12
- "use.cache": true,
13
- "vcs.ignore.cellar": true,
14
- "vcs.ignore.library": true,
15
- "vcs.ignore.local": true,
16
- "vcs.manage.ignores": true
17
- }