diff --git a/DESCRIPTION b/DESCRIPTION index 5f5b0f62..edeacd4f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: rsyncrosim Type: Package Title: The R Interface to 'SyncroSim' -Version: 1.4.13 +Version: 2.0.0 Authors@R: c( person("Colin", "Daniel", email = "colin.daniel@apexrms.com", role = "aut"), diff --git a/NEWS.md b/NEWS.md index 8f2686a1..421bb36f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# rsyncrosim 1.4.13 +# rsyncrosim 2.0.0 ## Breaking changes diff --git a/R/addPackage.R b/R/addPackage.R index b26cead1..f627557f 100644 --- a/R/addPackage.R +++ b/R/addPackage.R @@ -69,7 +69,7 @@ setMethod("addPackage", signature(ssimLibrary = "SsimLibrary"), function(ssimLib tt <- command(list(add = NULL, package = NULL, lib = .filepath(ssimLibrary), pkg = cVal), .session(ssimLibrary)) - if (tt == "saved"){ + if (tt[1] == "saved"){ message(paste0("Package <", cVal, "> added")) retList[[cVal]] <- TRUE } else { diff --git a/R/installPackage.R b/R/installPackage.R index 7390d33f..6089fd2e 100644 --- a/R/installPackage.R +++ b/R/installPackage.R @@ -50,6 +50,7 @@ setMethod("installPackage", signature(session = "missingOrNULL"), function(name, #' @rdname installPackage setMethod("installPackage", signature(session = "Session"), function(name, session) { success <- FALSE + progName <- "SyncroSim.PackageManager.exe" if (is.null(name)) { stop("A package name or file path is required") @@ -58,20 +59,29 @@ setMethod("installPackage", signature(session = "Session"), function(name, sessi if (grepl(".ssimpkg", name)) { if (!file.exists(name)) { tt <- paste0("Cannot find file: ", name) - } else{ - tt <- command(args = list(finstall = name), session, program = "SyncroSim.PackageManager.exe") + } else { + tt <- command(args = list(finstall = name), session, program = progName) if (tt == "saved"){ success <- TRUE tt <- paste0("Package installed from file <", name, ">") } } + } else if (dir.exists(name)){ + if (!file.exists(file.path(name, "package.xml"))){ + tt <- paste0("Package folder is not valid") + } + tt <- command(args = list(xinstall = name), session, program = progName) + if (tt[1] == "saved"){ + success <- TRUE + tt <- paste0("Package installed from folder <", name, ">") + } } else { pkgs <- packages(session) if (is.element(name, pkgs$name)) { tt <- (paste0("Package <", name, "> is already installed")) } else { - tt <- command(args = list(install = name), session, program = "SyncroSim.PackageManager.exe") - if (tt == "saved"){ + tt <- command(args = list(install = name), session, program = progName) + if (tt[1] == "saved"){ tt <- paste0("Package <", name, "> installed") success <- TRUE } diff --git a/R/packages.R b/R/packages.R index ebd3fc4c..13c72215 100644 --- a/R/packages.R +++ b/R/packages.R @@ -76,12 +76,13 @@ setMethod("packages", signature(ssimObject = "Session"), function(ssimObject, in tt <- command(c(arg), ssimObject, program = "SyncroSim.PackageManager.exe") if (tt[1] == "saved") { - out <- data.frame(name = NA, displayName = NA, version = NA) - out <- subset(out, !is.na(name)) + # out <- data.frame(name = NA, displayName = NA, version = NA) + out <- subset(out, !is.na(Name)) } else if (grepl("The remote name could not be resolved", tt[1])) { out <- "Could not connect to the package server." } else { - out <- .dataframeFromSSim(tt, colNames = c("name", "description", "version"), csv = FALSE) + # out <- .dataframeFromSSim(tt, colNames = c("name", "description", "version"), csv = FALSE) + out <- .dataframeFromSSim(tt, csv = FALSE) } return(out) } else { @@ -95,20 +96,22 @@ setMethod("packages", signature(ssimObject = "Session"), function(ssimObject, in # Make sure package is installed pkgList <- command(c("installed"), ssimObject, program = "SyncroSim.PackageManager.exe") - pkgDf <- .dataframeFromSSim(pkgList, - colNames = c("name", "description", "version"), - csv = FALSE) - if (listTemplates %in% pkgDf$name == FALSE) { + # pkgDf <- .dataframeFromSSim(pkgList, + # colNames = c("name", "description", "version"), + # csv = FALSE) + pkgDf <- .dataframeFromSSim(pkgList, csv = FALSE) + if (listTemplates %in% pkgDf$Name == FALSE) { stop("SyncroSim package not installed") } # Retrieve list of templates args <- list(list = NULL, templates = NULL, noheaders = NULL, package = listTemplates) - tt <- command(args, program = "SyncroSim.Console.exe") - out <- .dataframeFromSSim(tt, - colNames =c("name", "displayName", "installed"), - csv = F) + tt <- command(args, ssimObject, program = "SyncroSim.Console.exe") + # out <- .dataframeFromSSim(tt, + # colNames =c("name", "displayName", "installed"), + # csv = F) + out <- .dataframeFromSSim(tt, csv = F) return(out) } else { stop("listTemplates must be a character name of a SyncroSim Package") @@ -120,10 +123,8 @@ setMethod("packages", signature(ssimObject = "Session"), function(ssimObject, in setMethod("packages", signature(ssimObject = "SsimLibrary"), function(ssimObject) { # Retrieve list of packages in library - #TODO: change to --packages when update to next version of SyncroSim v3 - args <- list(list = NULL, pkgvers = NULL, lib = filepath(ssimObject), csv = NULL) - tt <- command(args, program = "SyncroSim.Console.exe", - progName=filepath(.session(ssimObject))) + args <- list(list = NULL, packages = NULL, lib = filepath(ssimObject), csv = NULL) + tt <- command(args, .session(ssimObject), program = "SyncroSim.Console.exe") out <- .dataframeFromSSim(tt, csv = T) return(out) diff --git a/R/uninstallPackage.R b/R/uninstallPackage.R index 68669821..e772e77d 100644 --- a/R/uninstallPackage.R +++ b/R/uninstallPackage.R @@ -55,7 +55,7 @@ setMethod("uninstallPackage", signature(session = "Session"), function(name, ses if (answer == "y") { tt <- command(args = list(uninstall = name), session, program = "SyncroSim.PackageManager.exe") - if (tt == "saved"){ + if (tt[1] == "saved"){ tt <- paste0("Package <", name,"> removed") success <- TRUE } diff --git a/man/info.Rd b/man/info.Rd index 6e639a05..3cd81061 100644 --- a/man/info.Rd +++ b/man/info.Rd @@ -18,9 +18,8 @@ object. } \description{ Retrieves some basic metadata about a SsimLibrary: Name, Owner, Last Modified, -Size, Read Only, Package Names, Package Description, Current Package Versions, -Minimum Package Versions, External input files, External output files, -Temporary files, Backup files. +Size, Read Only, Data files, Publish files, Temporary files, Backup files, +and Use conda. } \examples{ \dontrun{