Skip to content

Commit c188228

Browse files
committed
refactor
1 parent 7f0a9ef commit c188228

2 files changed

Lines changed: 17 additions & 28 deletions

File tree

Dockerfile

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,26 @@ RUN echo 'options(\n\
5151
# Update R packages
5252
RUN R -e "update.packages(ask = F)"
5353

54-
# Create docker user with empty password (will have uid and gid 1000)
55-
RUN useradd --create-home --shell /bin/bash docker \
56-
&& passwd docker -d \
57-
&& adduser docker sudo
54+
# Other R packages
55+
RUN R -e "install.packages('devtools')"
56+
RUN R -e "install.packages('roxygen2')"
57+
RUN R -e "install.packages('testthat')"
58+
59+
# sf system dependencies
60+
RUN add-apt-repository ppa:ubuntugis/ubuntugis-unstable --yes
61+
RUN apt-get -y update
62+
RUN apt-get install -y libudunits2-dev libproj-dev libgeos-dev libgdal-dev
63+
64+
# Install all plotly's dependencies
65+
RUN R -e "install.packages('plotly', dependencies = T)"
5866

5967
# system dependencies related to running orca
6068
RUN apt-get install -y \
6169
libgtk2.0-0 \
6270
libgconf-2-4 \
6371
xvfb \
6472
fuse \
65-
desktop-file-utils
73+
desktop-file-utils
6674

6775
# google chrome
6876
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
@@ -76,27 +84,13 @@ RUN chmod 777 /home/orca-1.1.1-x86_64.AppImage
7684
RUN printf '#!/bin/bash \nxvfb-run --auto-servernum --server-args "-screen 0 640x480x24" /home/orca-1.1.1-x86_64.AppImage "$@"' > /usr/bin/orca
7785
RUN chmod 777 /usr/bin/orca
7886

79-
# other R packages
80-
RUN R -e "install.packages(c('devtools', 'roxygen2', 'testthat'))"
81-
82-
# sf system dependencies
83-
RUN add-apt-repository ppa:ubuntugis/ubuntugis-unstable --yes
84-
RUN apt-get -y update
85-
RUN apt-get install -y libudunits2-dev libproj-dev libgeos-dev libgdal-dev
86-
87-
# install all plotly's dependencies
88-
RUN R -e "install.packages('plotly', dependencies = T)"
89-
9087
# install visual testing packages
9188
RUN R -e "devtools::install_github('cpsievert/vdiffr@diffObj')"
9289
RUN R -e "devtools::install_github('cpsievert/diffobj@css')"
9390

94-
# TODO: why does roxygen2 install fail above?
95-
RUN R -e "install.packages('roxygen2')"
96-
9791
# configure for visual testing
9892
ENV VDIFFR=true
9993
EXPOSE 3838
10094
COPY ./ /home/plotly
10195

102-
CMD R -e "vdiffr::manage_cases('home/plotly'); devtools::test('home/plotly')"
96+
CMD R -e "vdiffr::manage_cases('home/plotly')"

tests/testthat/helper-vdiffr.R

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# If VDIFFR is TRUE, enable visual testing
22
enable_vdiffr <- as.logical(Sys.getenv("VDIFFR", FALSE))
33

4+
message("Visual testing is ", if (!enable_vdiffr) "not ", "enabled.")
5+
46
# start up the image server and let vdiffr's svg writing method know about it
57
if (enable_vdiffr) {
68

@@ -37,14 +39,7 @@ if (enable_vdiffr) {
3739
# force the vdiffr shiny app to open in a real browser
3840
# (some svg files seem to not render properly in RStudio)
3941
options(shiny.launch.browser = interactive())
40-
41-
message("Visual testing is enabled.")
42-
} else {
43-
44-
message("Visual testing is not enabled.")
45-
46-
}
47-
42+
}
4843

4944
expect_doppelganger <- function(p, name, ...) {
5045

0 commit comments

Comments
 (0)