diff --git a/.Rprofile b/.Rprofile index 979e9a2e..cfadd99a 100644 --- a/.Rprofile +++ b/.Rprofile @@ -9,6 +9,35 @@ # .libPaths() already includes site library for default R version. .libPaths(c(.libPaths(), .Library.site)) + +# The remotes package is installed to install httpgd from GitHub +# The gdiff package is installed to support visual difference testing + +# Configure r-universe for binary package installations dynamically +linux_binary_repo <- function(universe){ + runiverse <- sprintf('r-universe.dev/bin/linux/%s-%s/%s/', + system2('lsb_release', '-sc', stdout = TRUE), + R.version$arch, + substr(getRversion(), 1, 3)) + sprintf('https://%s.%s', universe, runiverse) +} + +# Set repos for CRAN and nx10 (httpgd) to use r-universe linux binaries +options(repos = c( + cran = linux_binary_repo("cran"), + nx10 = linux_binary_repo("nx10") +)) + +# VSCode httpgd graphics device integration (optional) +if (interactive() && Sys.getenv("TERM_PROGRAM") == "vscode") { + if (requireNamespace("httpgd", quietly=TRUE)) { + options(vsc.plot = FALSE) + options(device = function(...) { + httpgd::hgd(silent = TRUE) + .vsc.browser(httpgd::hgd_url(history = FALSE), viewer = "Beside") + }) + } +} # For PNG graphics uncomment following lines # options(vsc.use_httpgd = FALSE, # vsc.dev.args = list(width = 800, height = 600)) diff --git a/Dockerfile b/Dockerfile index 5b88fee2..c05ce6d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,15 @@ RUN sed -i.bak "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list \ software-properties-common \ subversion \ libmagick++-dev \ + libpoppler-cpp-dev \ + libfontconfig1-dev \ + libfreetype6-dev \ + libpng-dev \ + libjpeg-dev \ + libtiff-dev \ + libharfbuzz-dev \ + libfribidi-dev \ + libcairo2-dev \ && add-apt-repository --enable-source --yes "ppa:marutter/rrutter4.0" \ && wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc \ && apt-get update \ @@ -19,13 +28,15 @@ RUN sed -i.bak "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list \ # Install R packages, with dynamic r-universe URL RUN Rscript -e "runiverse <- sprintf('r-universe.dev/bin/linux/%s-%s/%s/', \ system2('lsb_release', '-sc', stdout = TRUE), \ - R.version\$arch, \ + R.version$arch, \ substr(getRversion(), 1, 3)); \ - print('Installing packages...'); \ - install.packages(c('languageserver', 'httpgd'), \ + print('Installing packages from r-universe...'); \ + install.packages(c('languageserver', 'gdiff', 'remotes'), \ repos = c(runiverse = paste0('https://cran.', runiverse), \ nx10 = paste0('https://nx10.', runiverse))); \ - print('Packages installed.')" + print('Installing httpgd from GitHub...'); \ + remotes::install_github('nx10/httpgd'); \ + print('All packages installed.')" # Define env var used in GitHub Actions that build and deploy container ARG CONTAINER_VERSION