Bearloga has submitted this change and it was merged.

Change subject: [WIP] allow the dashboards to install Git-hosted R packages
......................................................................


[WIP] allow the dashboards to install Git-hosted R packages

This allows the dashboard shell script to install R packages from
Git using functionality in the devtools package. It should
be entirely workable but please for the love of god do not deploy
it until the package it's asking for actually exists ;p

Bug: T112700
Change-Id: I86c769bcf7a20f5e1a7de6b83b2ee04fd6c2b4b2
---
M setup.sh
1 file changed, 15 insertions(+), 1 deletion(-)

Approvals:
  Bearloga: Verified; Looks good to me, approved



diff --git a/setup.sh b/setup.sh
index 0bc482d..32ba63e 100755
--- a/setup.sh
+++ b/setup.sh
@@ -37,6 +37,17 @@
   fi
 }
 
+# This requires the devtools package so for all that's good and beautiful
+# in the world do not put a call to it in a line before install_r_package 
devtools.
+git_install_r_package() {
+  local TARGET="/usr/local/lib/R/site-library/$1"
+  if [ ! -d "$TARGET" ]; then
+    /usr/bin/R -e "devtools::install_git('$1')"
+    test -d $TARGET
+    RESTART_SHINY=1
+  fi
+}
+
 install_dist_template() {
   local PROCESSED="/tmp/install_dist_templates.$$"
   envsubst < $1 > $PROCESSED
@@ -91,7 +102,8 @@
 
   echo "Installing packages..."
   apt-get -y install gfortran libcurl4-openssl-dev git-core gdebi \
-      r-base r-base-dev r-cran-reshape2 r-cran-rcolorbrewer
+      r-base r-base-dev r-cran-reshape2 r-cran-rcolorbrewer \
+      libxml2-dev
 
   echo "Installing R packages..."
   install_r_package curl
@@ -110,6 +122,8 @@
   install_r_package ggthemes
   install_r_package plyr
   install_r_package lubridate
+  install_r_package devtools # Needed for installation from Git
+  git_install_r_package 
https://gerrit.wikimedia.org/r/wikimedia/discovery/polloi
 
   echo "Installing shiny-server..."
   if [ ! -d /opt/shiny-server ]; then

-- 
To view, visit https://gerrit.wikimedia.org/r/239409
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I86c769bcf7a20f5e1a7de6b83b2ee04fd6c2b4b2
Gerrit-PatchSet: 4
Gerrit-Project: wikimedia/discovery/dashboard
Gerrit-Branch: master
Gerrit-Owner: OliverKeyes <[email protected]>
Gerrit-Reviewer: Bearloga <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: OliverKeyes <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to