## Install script for pmg ## based on script for explorRbase ## just source this file into an R session. windows_config <- list( source = FALSE, gtk_url = "http://internap.dl.sourceforge.net/sourceforge/gladewin32/gtk-2.10.11-win32-1.exe" ) ## was gtk_url = "http://umn.dl.sourceforge.net/sourceforge/gladewin32/gtk-dev-2.8.20-win32-1.exe", unix_config <- darwin_config <- NULL gtk_web <- "http://www.gtk.org" install_system_dep <- function(package_name, dep_name, dep_url, dep_web) { #if (!require(package_name, character.only = T)) { if (is.null(dep_url)) print(paste("Please install", dep_name, "on your system.")) else { choice <- menu(paste(c("Install", "Do not install"), dep_name), T, paste("Need", dep_name, "?")) if (choice == 1) { installer <- file.path(tempdir(), basename(dep_url)) if (download.file(dep_url, installer, mode="wb") > 0) stop("Failed to download ", dep_name) shell(installer) } } print(paste("Learn more about", dep_name, "at", dep_web)) #} } install_pmg <- function() { if (.Platform$OS.type == "windows") config <- windows_config else if (length(grep("darwin", R.version$platform))) config <- darwin_config else config <- unix_config if (is.null(config)) stop("Sorry this platform is not yet supported by this installer script.") cat("Installing system libraries.\n") install_system_dep("RGtk2", "GTK+", config$gtk_url, gtk_web) cat("Installing pmg, along with any dependencies.\n") install.packages("pmg", dep = TRUE) } #debug(install_system_dep) install_pmg() print("Please restart R and then type 'library(pmg) to start pmg.")