[MediaWiki-commits] [Gerrit] analytics...WDCM[master]: Installation script mkdirs r-library

2017-11-13 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/391086 )

Change subject: Installation script mkdirs r-library
..


Installation script mkdirs r-library

Change-Id: I23aec808dc0d1eee4beb9085c7099a218f4035b1
---
M _installProduction_analytics-wmde.R
1 file changed, 24 insertions(+), 2 deletions(-)

Approvals:
  GoranSMilovanovic: Verified; Looks good to me, approved
  Addshore: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/_installProduction_analytics-wmde.R 
b/_installProduction_analytics-wmde.R
index 1f54867..d973370 100644
--- a/_installProduction_analytics-wmde.R
+++ b/_installProduction_analytics-wmde.R
@@ -8,8 +8,30 @@
   http_proxy = "http://webproxy.eqiad.wmnet:8080;,
   https_proxy = "http://webproxy.eqiad.wmnet:8080;)
 
+
+# - fPath: where the scripts is run from?
+fPath <- as.character(commandArgs(trailingOnly = FALSE)[4])
+fPath <- gsub("--file=", "", fPath, fixed = T)
+fPath <- unlist(strsplit(fPath, split = "/", fixed = T))
+fPath <- paste(
+  paste(fPath[1:length(fPath) - 1], collapse = "/"),
+  "/",
+  sep = "")
+
+
+# - find out whether the fPath/r-library directory exists
+# - YES: delete it and mkdir, NO: mkdir only
+if (dir.exists(paths = paste(fPath, "r-library", sep = ""))) {
+  unlink(x = paste(fPath, "r-library", sep = ""), 
+ recursive = T)
+  dir.create(path = paste(fPath, "r-library", sep = ""))
+} else {
+  dir.create(path = paste(fPath, "r-library", sep = ""))
+}
+
 # - install WDCM related packages:
 install.packages(c("dplyr", "httr", "stringr", "XML", "readr", 
"data.table", "tidyr", "maptpx", "Rtsne"),
- lib = "/srv/analytics-wmde/r-library",
- repos = c(CRAN = "https://www.stats.bris.ac.uk/R/;))
\ No newline at end of file
+ lib = paste(fPath, "r-library", sep = ""),
+ repos = c(CRAN = "https://www.stats.bris.ac.uk/R/;))
+

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I23aec808dc0d1eee4beb9085c7099a218f4035b1
Gerrit-PatchSet: 3
Gerrit-Project: analytics/wmde/WDCM
Gerrit-Branch: master
Gerrit-Owner: GoranSMilovanovic 
Gerrit-Reviewer: Addshore 
Gerrit-Reviewer: GoranSMilovanovic 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] analytics...WDCM[master]: Installation script mkdirs r-library

2017-11-13 Thread GoranSMilovanovic (Code Review)
GoranSMilovanovic has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/391086 )

Change subject: Installation script mkdirs r-library
..

Installation script mkdirs r-library

Change-Id: I23aec808dc0d1eee4beb9085c7099a218f4035b1
---
M _installProduction_analytics-wmde.R
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/wmde/WDCM 
refs/changes/86/391086/1

diff --git a/_installProduction_analytics-wmde.R 
b/_installProduction_analytics-wmde.R
index aab4cb0..d973370 100644
--- a/_installProduction_analytics-wmde.R
+++ b/_installProduction_analytics-wmde.R
@@ -8,6 +8,8 @@
   http_proxy = "http://webproxy.eqiad.wmnet:8080;,
   https_proxy = "http://webproxy.eqiad.wmnet:8080;)
 
+
+# - fPath: where the scripts is run from?
 fPath <- as.character(commandArgs(trailingOnly = FALSE)[4])
 fPath <- gsub("--file=", "", fPath, fixed = T)
 fPath <- unlist(strsplit(fPath, split = "/", fixed = T))
@@ -16,6 +18,17 @@
   "/",
   sep = "")
 
+
+# - find out whether the fPath/r-library directory exists
+# - YES: delete it and mkdir, NO: mkdir only
+if (dir.exists(paths = paste(fPath, "r-library", sep = ""))) {
+  unlink(x = paste(fPath, "r-library", sep = ""), 
+ recursive = T)
+  dir.create(path = paste(fPath, "r-library", sep = ""))
+} else {
+  dir.create(path = paste(fPath, "r-library", sep = ""))
+}
+
 # - install WDCM related packages:
 install.packages(c("dplyr", "httr", "stringr", "XML", "readr", 
"data.table", "tidyr", "maptpx", "Rtsne"),

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I23aec808dc0d1eee4beb9085c7099a218f4035b1
Gerrit-PatchSet: 1
Gerrit-Project: analytics/wmde/WDCM
Gerrit-Branch: master
Gerrit-Owner: GoranSMilovanovic 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits