[codeface] [PATCH 7/9] Normalise file name for packages.R

  • From: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
  • To: <codeface@xxxxxxxxxxxxx>
  • Date: Thu, 16 Jun 2016 22:46:32 +0200

The file ending used for R sources in codeface is .r,
instead of .R for packages.R.

Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
---
 integration-scripts/install_codeface_R.sh |  3 +-
 packages.R                                | 59 -------------------------------
 packages.r                                | 59 +++++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+), 61 deletions(-)
 delete mode 100644 packages.R
 create mode 100644 packages.r

diff --git a/integration-scripts/install_codeface_R.sh 
b/integration-scripts/install_codeface_R.sh
index 05f7c9a..53a9612 100755
--- a/integration-scripts/install_codeface_R.sh
+++ b/integration-scripts/install_codeface_R.sh
@@ -13,5 +13,4 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get -qqy install 
r-base r-base-dev r-cra
        r-cran-rjson r-cran-lsa r-cran-testthat r-cran-arules r-cran-data.table 
\
        r-cran-ineq libx11-dev libssh2-1-dev r-bioc-biocinstaller
 
-sudo Rscript packages.R
-
+sudo Rscript packages.r
diff --git a/packages.R b/packages.R
deleted file mode 100644
index 787e02b..0000000
--- a/packages.R
+++ /dev/null
@@ -1,59 +0,0 @@
-filter.installed.packages <- function(packageList)  {
-    if("-f" %in% commandArgs(trailingOnly = TRUE)) {
-        return(packageList)
-    } else {
-        return(packageList[which(packageList %in% installed.packages()[,1] == 
FALSE)])
-    }
-}
-
-## Remove package from all libraries (i.e., .libPaths())
-remove.installed.packages <- function(pack) {
-    for (path in .libPaths()) {
-        # try to remove package (hard stop() otherwise, if not existing)
-        tryCatch({
-            remove.packages(pack, path)
-            print(paste("removed previously installed package", pack))
-        }, error = function(e) {
-            # silently ignore errors (the reason would be that a package
-            # is not installed)
-        })
-    }
-}
-
-## (re-)install a package from github
-reinstall.package.from.github <- function(package, url) {
-
-    ## if package is installed, remove it completely from all libraries
-    p <- filter.installed.packages(c(package))
-    if(length(p) == 0) {
-        remove.installed.packages(package)
-    }
-
-    ## Re-install packages
-    devtools::install_github(url)
-}
-
-p <- filter.installed.packages(c("BiRewire", "graph", "Rgraphviz"))
-if(length(p) > 0) {
-    source("http://bioconductor.org/biocLite.R";)
-    biocLite(p)
-}
-
-p <- filter.installed.packages(c("statnet", "ggplot2", "tm", "optparse",
-                                 "igraph", "zoo", "xts", "lubridate", "xtable",
-                                 "reshape", "wordnet", "stringr", "yaml", 
"plyr",
-                                 "scales", "gridExtra", "scales", "RMySQL",
-                                 "RCurl", "mgcv", "shiny", "dtw", "httpuv", 
"devtools",
-                                 "corrgram", "logging", "png", "rjson", "lsa", 
"RJSONIO"))
-if(length(p) > 0) {
-    install.packages(p ,dependencies=T)
-}
-
-
-## Install following packages from different sources
-## and update existing installations, if needed
-reinstall.package.from.github("tm.plugin.mail", 
"wolfgangmauerer/tm-plugin-mail/pkg")
-reinstall.package.from.github("snatm", "wolfgangmauerer/snatm/pkg")
-reinstall.package.from.github("shinyGridster", "wch/shiny-gridster")
-reinstall.package.from.github("shinybootstrap2", "rstudio/shinybootstrap2")
-reinstall.package.from.github("Rgraphviz", "mitchell-joblin/Rgraphviz")
diff --git a/packages.r b/packages.r
new file mode 100644
index 0000000..787e02b
--- /dev/null
+++ b/packages.r
@@ -0,0 +1,59 @@
+filter.installed.packages <- function(packageList)  {
+    if("-f" %in% commandArgs(trailingOnly = TRUE)) {
+        return(packageList)
+    } else {
+        return(packageList[which(packageList %in% installed.packages()[,1] == 
FALSE)])
+    }
+}
+
+## Remove package from all libraries (i.e., .libPaths())
+remove.installed.packages <- function(pack) {
+    for (path in .libPaths()) {
+        # try to remove package (hard stop() otherwise, if not existing)
+        tryCatch({
+            remove.packages(pack, path)
+            print(paste("removed previously installed package", pack))
+        }, error = function(e) {
+            # silently ignore errors (the reason would be that a package
+            # is not installed)
+        })
+    }
+}
+
+## (re-)install a package from github
+reinstall.package.from.github <- function(package, url) {
+
+    ## if package is installed, remove it completely from all libraries
+    p <- filter.installed.packages(c(package))
+    if(length(p) == 0) {
+        remove.installed.packages(package)
+    }
+
+    ## Re-install packages
+    devtools::install_github(url)
+}
+
+p <- filter.installed.packages(c("BiRewire", "graph", "Rgraphviz"))
+if(length(p) > 0) {
+    source("http://bioconductor.org/biocLite.R";)
+    biocLite(p)
+}
+
+p <- filter.installed.packages(c("statnet", "ggplot2", "tm", "optparse",
+                                 "igraph", "zoo", "xts", "lubridate", "xtable",
+                                 "reshape", "wordnet", "stringr", "yaml", 
"plyr",
+                                 "scales", "gridExtra", "scales", "RMySQL",
+                                 "RCurl", "mgcv", "shiny", "dtw", "httpuv", 
"devtools",
+                                 "corrgram", "logging", "png", "rjson", "lsa", 
"RJSONIO"))
+if(length(p) > 0) {
+    install.packages(p ,dependencies=T)
+}
+
+
+## Install following packages from different sources
+## and update existing installations, if needed
+reinstall.package.from.github("tm.plugin.mail", 
"wolfgangmauerer/tm-plugin-mail/pkg")
+reinstall.package.from.github("snatm", "wolfgangmauerer/snatm/pkg")
+reinstall.package.from.github("shinyGridster", "wch/shiny-gridster")
+reinstall.package.from.github("shinybootstrap2", "rstudio/shinybootstrap2")
+reinstall.package.from.github("Rgraphviz", "mitchell-joblin/Rgraphviz")
-- 
2.8.3


Other related posts:

  • » [codeface] [PATCH 7/9] Normalise file name for packages.R - Wolfgang Mauerer