From fb355ea9f385df33c83fb84388eead89867d2724 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 30 Apr 2020 14:46:17 +0800 Subject: [PATCH 1/2] small tidying of sh scripts for R --- R/create-docs.sh | 2 +- R/create-rd.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/create-docs.sh b/R/create-docs.sh index 310dbc5fb50a3..ce0fb48b9ff27 100755 --- a/R/create-docs.sh +++ b/R/create-docs.sh @@ -49,7 +49,7 @@ pushd "$FWDIR" > /dev/null mkdir -p pkg/html pushd pkg/html -"$R_SCRIPT_PATH/Rscript" -e 'libDir <- "../../lib"; library(SparkR, lib.loc=libDir); library(knitr); knit_rd("SparkR", links = tools::findHTMLlinks(paste(libDir, "SparkR", sep="/")))' +"$R_SCRIPT_PATH/Rscript" -e 'libDir <- "../../lib"; library(SparkR, lib.loc=libDir); knitr::knit_rd("SparkR", links = tools::findHTMLlinks(file.path(libDir, "SparkR")))' popd diff --git a/R/create-rd.sh b/R/create-rd.sh index aaad3b1aafa0a..72a932c175c95 100755 --- a/R/create-rd.sh +++ b/R/create-rd.sh @@ -34,4 +34,4 @@ pushd "$FWDIR" > /dev/null . "$FWDIR/find-r.sh" # Generate Rd files if devtools is installed -"$R_SCRIPT_PATH/Rscript" -e ' if("devtools" %in% rownames(installed.packages())) { library(devtools); setwd("'$FWDIR'"); devtools::document(pkg="./pkg", roclets=c("rd")) }' +"$R_SCRIPT_PATH/Rscript" -e ' if(requireNamespace("devtools", quietly=TRUE)) { setwd("'$FWDIR'"); devtools::document(pkg="./pkg", roclets="rd") }' From c396869913c4c128a55f3547820649411c69535d Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 30 Apr 2020 17:17:50 +0800 Subject: [PATCH 2/2] update lintr to use CRAN --- dev/lint-r.R | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dev/lint-r.R b/dev/lint-r.R index 7e165319e316a..8a302a541d7a3 100644 --- a/dev/lint-r.R +++ b/dev/lint-r.R @@ -20,14 +20,13 @@ SPARK_ROOT_DIR <- as.character(argv[1]) LOCAL_LIB_LOC <- file.path(SPARK_ROOT_DIR, "R", "lib") # Checks if SparkR is installed in a local directory. -if (! library(SparkR, lib.loc = LOCAL_LIB_LOC, logical.return = TRUE)) { +if (!requireNamespace("SparkR", lib.loc = LOCAL_LIB_LOC)) { stop("You should install SparkR in a local directory with `R/install-dev.sh`.") } -# Installs lintr from Github in a local directory. -# NOTE: The CRAN's version is too old to adapt to our rules. -if ("lintr" %in% row.names(installed.packages()) == FALSE) { - devtools::install_github("jimhester/lintr@v2.0.0") +# Installs lintr if needed +if (!requireNamespace("lintr")) { + install.packages('lintr') } library(lintr)