jcheng5 commited on
Commit
865c2b9
·
1 Parent(s): 4715029

Try huggingface deployment

Browse files
Files changed (7) hide show
  1. .Rprofile +1 -0
  2. .dockerignore +1 -0
  3. Dockerfile +14 -0
  4. renv.lock +989 -0
  5. renv/.gitignore +7 -0
  6. renv/activate.R +1032 -0
  7. renv/settings.json +17 -0
.Rprofile ADDED
@@ -0,0 +1 @@
 
 
1
+ source("renv/activate.R")
.dockerignore ADDED
@@ -0,0 +1 @@
 
 
1
+ renv
Dockerfile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM rocker/shiny-verse:latest
2
+
3
+ WORKDIR /code
4
+
5
+ RUN R --quiet -e "install.packages('renv'); renv::init()"
6
+
7
+ COPY ./renv.lock /code/renv.lock
8
+
9
+ RUN R --quiet -e "renv::restore()"
10
+ RUN ls
11
+
12
+ COPY . .
13
+
14
+ CMD ["R", "--quiet", "-e", "shiny::runApp(host='0.0.0.0', port=7860)"]
renv.lock ADDED
@@ -0,0 +1,989 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "commonmark": {
191
+ "Package": "commonmark",
192
+ "Version": "1.9.0",
193
+ "Source": "Repository",
194
+ "Repository": "CRAN",
195
+ "Hash": "d691c61bff84bd63c383874d2d0c3307"
196
+ },
197
+ "cpp11": {
198
+ "Package": "cpp11",
199
+ "Version": "0.4.3",
200
+ "Source": "Repository",
201
+ "Repository": "CRAN",
202
+ "Hash": "ed588261931ee3be2c700d22e94a29ab"
203
+ },
204
+ "crayon": {
205
+ "Package": "crayon",
206
+ "Version": "1.5.2",
207
+ "Source": "Repository",
208
+ "Repository": "CRAN",
209
+ "Requirements": [
210
+ "grDevices",
211
+ "methods",
212
+ "utils"
213
+ ],
214
+ "Hash": "e8a1e41acf02548751f45c718d55aa6a"
215
+ },
216
+ "curl": {
217
+ "Package": "curl",
218
+ "Version": "5.0.0",
219
+ "Source": "Repository",
220
+ "Repository": "CRAN",
221
+ "RemoteType": "standard",
222
+ "RemotePkgRef": "curl",
223
+ "RemoteRef": "curl",
224
+ "RemoteRepos": "https://cloud.r-project.org",
225
+ "RemotePkgPlatform": "source",
226
+ "RemoteSha": "5.0.0",
227
+ "Requirements": [
228
+ "R"
229
+ ],
230
+ "Hash": "e4f97056611e8e6b8b852d13b7400cf1"
231
+ },
232
+ "digest": {
233
+ "Package": "digest",
234
+ "Version": "0.6.31",
235
+ "Source": "Repository",
236
+ "Repository": "CRAN",
237
+ "Requirements": [
238
+ "R",
239
+ "utils"
240
+ ],
241
+ "Hash": "8b708f296afd9ae69f450f9640be8990"
242
+ },
243
+ "dplyr": {
244
+ "Package": "dplyr",
245
+ "Version": "1.1.1",
246
+ "Source": "Repository",
247
+ "Repository": "CRAN",
248
+ "Requirements": [
249
+ "R",
250
+ "R6",
251
+ "cli",
252
+ "generics",
253
+ "glue",
254
+ "lifecycle",
255
+ "magrittr",
256
+ "methods",
257
+ "pillar",
258
+ "rlang",
259
+ "tibble",
260
+ "tidyselect",
261
+ "utils",
262
+ "vctrs"
263
+ ],
264
+ "Hash": "eb5742d256a0d9306d85ea68756d8187"
265
+ },
266
+ "ellipsis": {
267
+ "Package": "ellipsis",
268
+ "Version": "0.3.2",
269
+ "Source": "Repository",
270
+ "Repository": "CRAN",
271
+ "Requirements": [
272
+ "R",
273
+ "rlang"
274
+ ],
275
+ "Hash": "bb0eec2fe32e88d9e2836c2f73ea2077"
276
+ },
277
+ "fansi": {
278
+ "Package": "fansi",
279
+ "Version": "1.0.4",
280
+ "Source": "Repository",
281
+ "Repository": "CRAN",
282
+ "Requirements": [
283
+ "R",
284
+ "grDevices",
285
+ "utils"
286
+ ],
287
+ "Hash": "1d9e7ad3c8312a192dea7d3db0274fde"
288
+ },
289
+ "farver": {
290
+ "Package": "farver",
291
+ "Version": "2.1.1",
292
+ "Source": "Repository",
293
+ "Repository": "CRAN",
294
+ "Hash": "8106d78941f34855c440ddb946b8f7a5"
295
+ },
296
+ "fastmap": {
297
+ "Package": "fastmap",
298
+ "Version": "1.1.1",
299
+ "Source": "Repository",
300
+ "Repository": "CRAN",
301
+ "Hash": "f7736a18de97dea803bde0a2daaafb27"
302
+ },
303
+ "fontawesome": {
304
+ "Package": "fontawesome",
305
+ "Version": "0.5.0",
306
+ "Source": "Repository",
307
+ "Repository": "CRAN",
308
+ "Requirements": [
309
+ "R",
310
+ "htmltools",
311
+ "rlang"
312
+ ],
313
+ "Hash": "e80750aec5717dedc019ad7ee40e4a7c"
314
+ },
315
+ "fs": {
316
+ "Package": "fs",
317
+ "Version": "1.6.1",
318
+ "Source": "Repository",
319
+ "Repository": "CRAN",
320
+ "Requirements": [
321
+ "R",
322
+ "methods"
323
+ ],
324
+ "Hash": "f4dcd23b67e33d851d2079f703e8b985"
325
+ },
326
+ "generics": {
327
+ "Package": "generics",
328
+ "Version": "0.1.3",
329
+ "Source": "Repository",
330
+ "Repository": "CRAN",
331
+ "Requirements": [
332
+ "R",
333
+ "methods"
334
+ ],
335
+ "Hash": "15e9634c0fcd294799e9b2e929ed1b86"
336
+ },
337
+ "ggplot2": {
338
+ "Package": "ggplot2",
339
+ "Version": "3.4.2",
340
+ "Source": "Repository",
341
+ "Repository": "CRAN",
342
+ "Requirements": [
343
+ "MASS",
344
+ "R",
345
+ "cli",
346
+ "glue",
347
+ "grDevices",
348
+ "grid",
349
+ "gtable",
350
+ "isoband",
351
+ "lifecycle",
352
+ "mgcv",
353
+ "rlang",
354
+ "scales",
355
+ "stats",
356
+ "tibble",
357
+ "vctrs",
358
+ "withr"
359
+ ],
360
+ "Hash": "3a147ee02e85a8941aad9909f1b43b7b"
361
+ },
362
+ "glue": {
363
+ "Package": "glue",
364
+ "Version": "1.6.2",
365
+ "Source": "Repository",
366
+ "Repository": "CRAN",
367
+ "Requirements": [
368
+ "R",
369
+ "methods"
370
+ ],
371
+ "Hash": "4f2596dfb05dac67b9dc558e5c6fba2e"
372
+ },
373
+ "gtable": {
374
+ "Package": "gtable",
375
+ "Version": "0.3.3",
376
+ "Source": "Repository",
377
+ "Repository": "CRAN",
378
+ "Requirements": [
379
+ "R",
380
+ "cli",
381
+ "glue",
382
+ "grid",
383
+ "lifecycle",
384
+ "rlang"
385
+ ],
386
+ "Hash": "b44addadb528a0d227794121c00572a0"
387
+ },
388
+ "hms": {
389
+ "Package": "hms",
390
+ "Version": "1.1.3",
391
+ "Source": "Repository",
392
+ "Repository": "CRAN",
393
+ "Requirements": [
394
+ "lifecycle",
395
+ "methods",
396
+ "pkgconfig",
397
+ "rlang",
398
+ "vctrs"
399
+ ],
400
+ "Hash": "b59377caa7ed00fa41808342002138f9"
401
+ },
402
+ "htmltools": {
403
+ "Package": "htmltools",
404
+ "Version": "0.5.5",
405
+ "Source": "Repository",
406
+ "Repository": "CRAN",
407
+ "Requirements": [
408
+ "R",
409
+ "base64enc",
410
+ "digest",
411
+ "ellipsis",
412
+ "fastmap",
413
+ "grDevices",
414
+ "rlang",
415
+ "utils"
416
+ ],
417
+ "Hash": "ba0240784ad50a62165058a27459304a"
418
+ },
419
+ "httpuv": {
420
+ "Package": "httpuv",
421
+ "Version": "1.6.9",
422
+ "Source": "Repository",
423
+ "Repository": "CRAN",
424
+ "Requirements": [
425
+ "R",
426
+ "R6",
427
+ "Rcpp",
428
+ "later",
429
+ "promises",
430
+ "utils"
431
+ ],
432
+ "Hash": "1046aa31a57eae8b357267a56a0b6d8b"
433
+ },
434
+ "isoband": {
435
+ "Package": "isoband",
436
+ "Version": "0.2.7",
437
+ "Source": "Repository",
438
+ "Repository": "CRAN",
439
+ "Requirements": [
440
+ "grid",
441
+ "utils"
442
+ ],
443
+ "Hash": "0080607b4a1a7b28979aecef976d8bc2"
444
+ },
445
+ "jquerylib": {
446
+ "Package": "jquerylib",
447
+ "Version": "0.1.4",
448
+ "Source": "Repository",
449
+ "Repository": "CRAN",
450
+ "Requirements": [
451
+ "htmltools"
452
+ ],
453
+ "Hash": "5aab57a3bd297eee1c1d862735972182"
454
+ },
455
+ "jsonlite": {
456
+ "Package": "jsonlite",
457
+ "Version": "1.8.4",
458
+ "Source": "Repository",
459
+ "Repository": "CRAN",
460
+ "Requirements": [
461
+ "methods"
462
+ ],
463
+ "Hash": "a4269a09a9b865579b2635c77e572374"
464
+ },
465
+ "labeling": {
466
+ "Package": "labeling",
467
+ "Version": "0.4.2",
468
+ "Source": "Repository",
469
+ "Repository": "CRAN",
470
+ "Requirements": [
471
+ "graphics",
472
+ "stats"
473
+ ],
474
+ "Hash": "3d5108641f47470611a32d0bdf357a72"
475
+ },
476
+ "later": {
477
+ "Package": "later",
478
+ "Version": "1.3.0",
479
+ "Source": "Repository",
480
+ "Repository": "CRAN",
481
+ "Requirements": [
482
+ "Rcpp",
483
+ "rlang"
484
+ ],
485
+ "Hash": "7e7b457d7766bc47f2a5f21cc2984f8e"
486
+ },
487
+ "lattice": {
488
+ "Package": "lattice",
489
+ "Version": "0.20-45",
490
+ "Source": "Repository",
491
+ "Repository": "CRAN",
492
+ "Requirements": [
493
+ "R",
494
+ "grDevices",
495
+ "graphics",
496
+ "grid",
497
+ "stats",
498
+ "utils"
499
+ ],
500
+ "Hash": "b64cdbb2b340437c4ee047a1f4c4377b"
501
+ },
502
+ "lifecycle": {
503
+ "Package": "lifecycle",
504
+ "Version": "1.0.3",
505
+ "Source": "Repository",
506
+ "Repository": "CRAN",
507
+ "Requirements": [
508
+ "R",
509
+ "cli",
510
+ "glue",
511
+ "rlang"
512
+ ],
513
+ "Hash": "001cecbeac1cff9301bdc3775ee46a86"
514
+ },
515
+ "magrittr": {
516
+ "Package": "magrittr",
517
+ "Version": "2.0.3",
518
+ "Source": "Repository",
519
+ "Repository": "CRAN",
520
+ "Requirements": [
521
+ "R"
522
+ ],
523
+ "Hash": "7ce2733a9826b3aeb1775d56fd305472"
524
+ },
525
+ "memoise": {
526
+ "Package": "memoise",
527
+ "Version": "2.0.1",
528
+ "Source": "Repository",
529
+ "Repository": "CRAN",
530
+ "Requirements": [
531
+ "cachem",
532
+ "rlang"
533
+ ],
534
+ "Hash": "e2817ccf4a065c5d9d7f2cfbe7c1d78c"
535
+ },
536
+ "mgcv": {
537
+ "Package": "mgcv",
538
+ "Version": "1.8-42",
539
+ "Source": "Repository",
540
+ "Repository": "CRAN",
541
+ "Requirements": [
542
+ "Matrix",
543
+ "R",
544
+ "graphics",
545
+ "methods",
546
+ "nlme",
547
+ "splines",
548
+ "stats",
549
+ "utils"
550
+ ],
551
+ "Hash": "3460beba7ccc8946249ba35327ba902a"
552
+ },
553
+ "mime": {
554
+ "Package": "mime",
555
+ "Version": "0.12",
556
+ "Source": "Repository",
557
+ "Repository": "CRAN",
558
+ "Requirements": [
559
+ "tools"
560
+ ],
561
+ "Hash": "18e9c28c1d3ca1560ce30658b22ce104"
562
+ },
563
+ "munsell": {
564
+ "Package": "munsell",
565
+ "Version": "0.5.0",
566
+ "Source": "Repository",
567
+ "Repository": "CRAN",
568
+ "Requirements": [
569
+ "colorspace",
570
+ "methods"
571
+ ],
572
+ "Hash": "6dfe8bf774944bd5595785e3229d8771"
573
+ },
574
+ "nlme": {
575
+ "Package": "nlme",
576
+ "Version": "3.1-162",
577
+ "Source": "Repository",
578
+ "Repository": "CRAN",
579
+ "Requirements": [
580
+ "R",
581
+ "graphics",
582
+ "lattice",
583
+ "stats",
584
+ "utils"
585
+ ],
586
+ "Hash": "0984ce8da8da9ead8643c5cbbb60f83e"
587
+ },
588
+ "openssl": {
589
+ "Package": "openssl",
590
+ "Version": "2.0.6",
591
+ "Source": "Repository",
592
+ "Repository": "CRAN",
593
+ "Requirements": [
594
+ "askpass"
595
+ ],
596
+ "Hash": "0f7cd2962e3044bb940cca4f4b5cecbe"
597
+ },
598
+ "packrat": {
599
+ "Package": "packrat",
600
+ "Version": "0.9.1",
601
+ "Source": "Repository",
602
+ "Repository": "CRAN",
603
+ "Requirements": [
604
+ "R",
605
+ "tools",
606
+ "utils"
607
+ ],
608
+ "Hash": "481428983c19a7c443f7ea1beff0a2de"
609
+ },
610
+ "palmerpenguins": {
611
+ "Package": "palmerpenguins",
612
+ "Version": "0.1.1",
613
+ "Source": "Repository",
614
+ "Repository": "CRAN",
615
+ "RemoteType": "standard",
616
+ "RemotePkgRef": "palmerpenguins",
617
+ "RemoteRef": "palmerpenguins",
618
+ "RemoteRepos": "https://cloud.r-project.org",
619
+ "RemotePkgPlatform": "source",
620
+ "RemoteSha": "0.1.1",
621
+ "Requirements": [
622
+ "R"
623
+ ],
624
+ "Hash": "6c6861efbc13c1d543749e9c7be4a592"
625
+ },
626
+ "pillar": {
627
+ "Package": "pillar",
628
+ "Version": "1.9.0",
629
+ "Source": "Repository",
630
+ "Repository": "CRAN",
631
+ "Requirements": [
632
+ "cli",
633
+ "fansi",
634
+ "glue",
635
+ "lifecycle",
636
+ "rlang",
637
+ "utf8",
638
+ "utils",
639
+ "vctrs"
640
+ ],
641
+ "Hash": "15da5a8412f317beeee6175fbc76f4bb"
642
+ },
643
+ "pkgconfig": {
644
+ "Package": "pkgconfig",
645
+ "Version": "2.0.3",
646
+ "Source": "Repository",
647
+ "Repository": "CRAN",
648
+ "Requirements": [
649
+ "utils"
650
+ ],
651
+ "Hash": "01f28d4278f15c76cddbea05899c5d6f"
652
+ },
653
+ "prettyunits": {
654
+ "Package": "prettyunits",
655
+ "Version": "1.1.1",
656
+ "Source": "Repository",
657
+ "Repository": "CRAN",
658
+ "Hash": "95ef9167b75dde9d2ccc3c7528393e7e"
659
+ },
660
+ "progress": {
661
+ "Package": "progress",
662
+ "Version": "1.2.2",
663
+ "Source": "Repository",
664
+ "Repository": "CRAN",
665
+ "Requirements": [
666
+ "R6",
667
+ "crayon",
668
+ "hms",
669
+ "prettyunits"
670
+ ],
671
+ "Hash": "14dc9f7a3c91ebb14ec5bb9208a07061"
672
+ },
673
+ "promises": {
674
+ "Package": "promises",
675
+ "Version": "1.2.0.1",
676
+ "Source": "Repository",
677
+ "Repository": "CRAN",
678
+ "Requirements": [
679
+ "R6",
680
+ "Rcpp",
681
+ "later",
682
+ "magrittr",
683
+ "rlang",
684
+ "stats"
685
+ ],
686
+ "Hash": "4ab2c43adb4d4699cf3690acd378d75d"
687
+ },
688
+ "rappdirs": {
689
+ "Package": "rappdirs",
690
+ "Version": "0.3.3",
691
+ "Source": "Repository",
692
+ "Repository": "CRAN",
693
+ "Requirements": [
694
+ "R"
695
+ ],
696
+ "Hash": "5e3c5dc0b071b21fa128676560dbe94d"
697
+ },
698
+ "readr": {
699
+ "Package": "readr",
700
+ "Version": "2.1.4",
701
+ "Source": "Repository",
702
+ "Repository": "CRAN",
703
+ "Requirements": [
704
+ "R",
705
+ "R6",
706
+ "cli",
707
+ "clipr",
708
+ "cpp11",
709
+ "crayon",
710
+ "hms",
711
+ "lifecycle",
712
+ "methods",
713
+ "rlang",
714
+ "tibble",
715
+ "tzdb",
716
+ "utils",
717
+ "vroom"
718
+ ],
719
+ "Hash": "b5047343b3825f37ad9d3b5d89aa1078"
720
+ },
721
+ "renv": {
722
+ "Package": "renv",
723
+ "Version": "0.17.3",
724
+ "Source": "Repository",
725
+ "Repository": "CRAN",
726
+ "Requirements": [
727
+ "utils"
728
+ ],
729
+ "Hash": "4543b8cd233ae25c6aba8548be9e747e"
730
+ },
731
+ "rlang": {
732
+ "Package": "rlang",
733
+ "Version": "1.1.0",
734
+ "Source": "Repository",
735
+ "Repository": "CRAN",
736
+ "Requirements": [
737
+ "R",
738
+ "utils"
739
+ ],
740
+ "Hash": "dc079ccd156cde8647360f473c1fa718"
741
+ },
742
+ "rsconnect": {
743
+ "Package": "rsconnect",
744
+ "Version": "0.8.29",
745
+ "Source": "Repository",
746
+ "Repository": "CRAN",
747
+ "Requirements": [
748
+ "R",
749
+ "curl",
750
+ "digest",
751
+ "jsonlite",
752
+ "openssl",
753
+ "packrat",
754
+ "rstudioapi",
755
+ "tools",
756
+ "yaml"
757
+ ],
758
+ "Hash": "fe178fc15af80952f546aafedf655b36"
759
+ },
760
+ "rstudioapi": {
761
+ "Package": "rstudioapi",
762
+ "Version": "0.14",
763
+ "Source": "Repository",
764
+ "Repository": "CRAN",
765
+ "Hash": "690bd2acc42a9166ce34845884459320"
766
+ },
767
+ "sass": {
768
+ "Package": "sass",
769
+ "Version": "0.4.5",
770
+ "Source": "Repository",
771
+ "Repository": "CRAN",
772
+ "Requirements": [
773
+ "R6",
774
+ "fs",
775
+ "htmltools",
776
+ "rappdirs",
777
+ "rlang"
778
+ ],
779
+ "Hash": "2bb4371a4c80115518261866eab6ab11"
780
+ },
781
+ "scales": {
782
+ "Package": "scales",
783
+ "Version": "1.2.1",
784
+ "Source": "Repository",
785
+ "Repository": "CRAN",
786
+ "Requirements": [
787
+ "R",
788
+ "R6",
789
+ "RColorBrewer",
790
+ "farver",
791
+ "labeling",
792
+ "lifecycle",
793
+ "munsell",
794
+ "rlang",
795
+ "viridisLite"
796
+ ],
797
+ "Hash": "906cb23d2f1c5680b8ce439b44c6fa63"
798
+ },
799
+ "shiny": {
800
+ "Package": "shiny",
801
+ "Version": "1.7.4",
802
+ "Source": "Repository",
803
+ "Repository": "CRAN",
804
+ "Requirements": [
805
+ "R",
806
+ "R6",
807
+ "bslib",
808
+ "cachem",
809
+ "commonmark",
810
+ "crayon",
811
+ "ellipsis",
812
+ "fastmap",
813
+ "fontawesome",
814
+ "glue",
815
+ "grDevices",
816
+ "htmltools",
817
+ "httpuv",
818
+ "jsonlite",
819
+ "later",
820
+ "lifecycle",
821
+ "methods",
822
+ "mime",
823
+ "promises",
824
+ "rlang",
825
+ "sourcetools",
826
+ "tools",
827
+ "utils",
828
+ "withr",
829
+ "xtable"
830
+ ],
831
+ "Hash": "c2eae3d8c670fa9dfa35a12066f4a1d5"
832
+ },
833
+ "sourcetools": {
834
+ "Package": "sourcetools",
835
+ "Version": "0.1.7-1",
836
+ "Source": "Repository",
837
+ "Repository": "CRAN",
838
+ "Requirements": [
839
+ "R"
840
+ ],
841
+ "Hash": "5f5a7629f956619d519205ec475fe647"
842
+ },
843
+ "sys": {
844
+ "Package": "sys",
845
+ "Version": "3.4.1",
846
+ "Source": "Repository",
847
+ "Repository": "CRAN",
848
+ "Hash": "34c16f1ef796057bfa06d3f4ff818a5d"
849
+ },
850
+ "tibble": {
851
+ "Package": "tibble",
852
+ "Version": "3.2.1",
853
+ "Source": "Repository",
854
+ "Repository": "CRAN",
855
+ "Requirements": [
856
+ "R",
857
+ "fansi",
858
+ "lifecycle",
859
+ "magrittr",
860
+ "methods",
861
+ "pillar",
862
+ "pkgconfig",
863
+ "rlang",
864
+ "utils",
865
+ "vctrs"
866
+ ],
867
+ "Hash": "a84e2cc86d07289b3b6f5069df7a004c"
868
+ },
869
+ "tidyselect": {
870
+ "Package": "tidyselect",
871
+ "Version": "1.2.0",
872
+ "Source": "Repository",
873
+ "Repository": "CRAN",
874
+ "Requirements": [
875
+ "R",
876
+ "cli",
877
+ "glue",
878
+ "lifecycle",
879
+ "rlang",
880
+ "vctrs",
881
+ "withr"
882
+ ],
883
+ "Hash": "79540e5fcd9e0435af547d885f184fd5"
884
+ },
885
+ "tzdb": {
886
+ "Package": "tzdb",
887
+ "Version": "0.3.0",
888
+ "Source": "Repository",
889
+ "Repository": "CRAN",
890
+ "Requirements": [
891
+ "R",
892
+ "cpp11"
893
+ ],
894
+ "Hash": "b2e1cbce7c903eaf23ec05c58e59fb5e"
895
+ },
896
+ "utf8": {
897
+ "Package": "utf8",
898
+ "Version": "1.2.3",
899
+ "Source": "Repository",
900
+ "Repository": "CRAN",
901
+ "Requirements": [
902
+ "R"
903
+ ],
904
+ "Hash": "1fe17157424bb09c48a8b3b550c753bc"
905
+ },
906
+ "vctrs": {
907
+ "Package": "vctrs",
908
+ "Version": "0.6.1",
909
+ "Source": "Repository",
910
+ "Repository": "CRAN",
911
+ "Requirements": [
912
+ "R",
913
+ "cli",
914
+ "glue",
915
+ "lifecycle",
916
+ "rlang"
917
+ ],
918
+ "Hash": "06eceb3a5d716fd0654cc23ca3d71a99"
919
+ },
920
+ "viridisLite": {
921
+ "Package": "viridisLite",
922
+ "Version": "0.4.1",
923
+ "Source": "Repository",
924
+ "Repository": "CRAN",
925
+ "Requirements": [
926
+ "R"
927
+ ],
928
+ "Hash": "62f4b5da3e08d8e5bcba6cac15603f70"
929
+ },
930
+ "vroom": {
931
+ "Package": "vroom",
932
+ "Version": "1.6.1",
933
+ "Source": "Repository",
934
+ "Repository": "CRAN",
935
+ "Requirements": [
936
+ "R",
937
+ "bit64",
938
+ "cli",
939
+ "cpp11",
940
+ "crayon",
941
+ "glue",
942
+ "hms",
943
+ "lifecycle",
944
+ "methods",
945
+ "progress",
946
+ "rlang",
947
+ "stats",
948
+ "tibble",
949
+ "tidyselect",
950
+ "tzdb",
951
+ "vctrs",
952
+ "withr"
953
+ ],
954
+ "Hash": "7015a74373b83ffaef64023f4a0f5033"
955
+ },
956
+ "withr": {
957
+ "Package": "withr",
958
+ "Version": "2.5.0",
959
+ "Source": "Repository",
960
+ "Repository": "CRAN",
961
+ "Requirements": [
962
+ "R",
963
+ "grDevices",
964
+ "graphics",
965
+ "stats"
966
+ ],
967
+ "Hash": "c0e49a9760983e81e55cdd9be92e7182"
968
+ },
969
+ "xtable": {
970
+ "Package": "xtable",
971
+ "Version": "1.8-4",
972
+ "Source": "Repository",
973
+ "Repository": "CRAN",
974
+ "Requirements": [
975
+ "R",
976
+ "stats",
977
+ "utils"
978
+ ],
979
+ "Hash": "b8acdf8af494d9ec19ccb2481a9b11c2"
980
+ },
981
+ "yaml": {
982
+ "Package": "yaml",
983
+ "Version": "2.3.7",
984
+ "Source": "Repository",
985
+ "Repository": "CRAN",
986
+ "Hash": "0d0056cc5383fbc240ccd0cb584bf436"
987
+ }
988
+ }
989
+ }
renv/.gitignore ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ library/
2
+ local/
3
+ cellar/
4
+ lock/
5
+ python/
6
+ sandbox/
7
+ staging/
renv/activate.R ADDED
@@ -0,0 +1,1032 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ }