Skip to content

Commit 459a98f

Browse files
committed
Updated Rprofile and Dockerfile to install httpgd using the remotes package and install gdiff
1 parent 8d17912 commit 459a98f

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

.Rprofile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,35 @@
99
# .libPaths() already includes site library for default R version.
1010
.libPaths(c(.libPaths(), .Library.site))
1111

12+
13+
# The remotes package is installed to install httpgd from GitHub
14+
# The gdiff package is installed to support visual difference testing
15+
16+
# Configure r-universe for binary package installations dynamically
17+
linux_binary_repo <- function(universe){
18+
runiverse <- sprintf('r-universe.dev/bin/linux/%s-%s/%s/',
19+
system2('lsb_release', '-sc', stdout = TRUE),
20+
R.version$arch,
21+
substr(getRversion(), 1, 3))
22+
sprintf('https://%s.%s', universe, runiverse)
23+
}
24+
25+
# Set repos for CRAN and nx10 (httpgd) to use r-universe linux binaries
26+
options(repos = c(
27+
cran = linux_binary_repo("cran"),
28+
nx10 = linux_binary_repo("nx10")
29+
))
30+
31+
# VSCode httpgd graphics device integration (optional)
32+
if (interactive() && Sys.getenv("TERM_PROGRAM") == "vscode") {
33+
if (requireNamespace("httpgd", quietly=TRUE)) {
34+
options(vsc.plot = FALSE)
35+
options(device = function(...) {
36+
httpgd::hgd(silent = TRUE)
37+
.vsc.browser(httpgd::hgd_url(history = FALSE), viewer = "Beside")
38+
})
39+
}
40+
}
1241
# For PNG graphics uncomment following lines
1342
# options(vsc.use_httpgd = FALSE,
1443
# vsc.dev.args = list(width = 800, height = 600))

Dockerfile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ RUN sed -i.bak "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list \
88
software-properties-common \
99
subversion \
1010
libmagick++-dev \
11+
libpoppler-cpp-dev \
12+
libfontconfig1-dev \
13+
libfreetype6-dev \
14+
libpng-dev \
15+
libjpeg-dev \
16+
libtiff-dev \
17+
libharfbuzz-dev \
18+
libfribidi-dev \
19+
libcairo2-dev \
1120
&& add-apt-repository --enable-source --yes "ppa:marutter/rrutter4.0" \
1221
&& wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc \
1322
&& apt-get update \
@@ -19,13 +28,15 @@ RUN sed -i.bak "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list \
1928
# Install R packages, with dynamic r-universe URL
2029
RUN Rscript -e "runiverse <- sprintf('r-universe.dev/bin/linux/%s-%s/%s/', \
2130
system2('lsb_release', '-sc', stdout = TRUE), \
22-
R.version\$arch, \
31+
R.version$arch, \
2332
substr(getRversion(), 1, 3)); \
24-
print('Installing packages...'); \
25-
install.packages(c('languageserver', 'httpgd'), \
33+
print('Installing packages from r-universe...'); \
34+
install.packages(c('languageserver', 'gdiff', 'remotes'), \
2635
repos = c(runiverse = paste0('https://cran.', runiverse), \
2736
nx10 = paste0('https://nx10.', runiverse))); \
28-
print('Packages installed.')"
37+
print('Installing httpgd from GitHub...'); \
38+
remotes::install_github('nx10/httpgd'); \
39+
print('All packages installed.')"
2940

3041
# Define env var used in GitHub Actions that build and deploy container
3142
ARG CONTAINER_VERSION

0 commit comments

Comments
 (0)