Merge branch '11876-r-sdk' documentation, refs #11876
authorPeter Amstutz <pamstutz@veritasgenetics.com>
Fri, 9 Feb 2018 19:20:32 +0000 (14:20 -0500)
committerPeter Amstutz <pamstutz@veritasgenetics.com>
Fri, 9 Feb 2018 19:20:32 +0000 (14:20 -0500)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz@veritasgenetics.com>

31 files changed:
.gitignore
build/run-tests.sh
doc/Rakefile
doc/_config.yml
doc/sdk/R/R.html.textile.liquid [new file with mode: 0644]
doc/sdk/index.html.textile.liquid
sdk/R/.Rbuildignore
sdk/R/DESCRIPTION
sdk/R/NAMESPACE
sdk/R/R/Arvados.R
sdk/R/R/ArvadosFile.R
sdk/R/R/Collection.R
sdk/R/R/CollectionTree.R
sdk/R/R/HttpParser.R
sdk/R/R/Subcollection.R
sdk/R/README [deleted file]
sdk/R/README.Rmd [new file with mode: 0644]
sdk/R/man/Arvados.Rd
sdk/R/man/ArvadosFile.Rd
sdk/R/man/Collection.Rd
sdk/R/man/CollectionTree.Rd [deleted file]
sdk/R/man/HttpParser.Rd [deleted file]
sdk/R/man/Subcollection.Rd
sdk/R/man/print.Arvados.Rd [new file with mode: 0644]
sdk/R/man/print.ArvadosFile.Rd [new file with mode: 0644]
sdk/R/man/print.Collection.Rd [new file with mode: 0644]
sdk/R/man/print.Subcollection.Rd [new file with mode: 0644]
tools/arvbox/bin/arvbox
tools/arvbox/lib/arvbox/docker/Dockerfile.base
tools/arvbox/lib/arvbox/docker/common.sh
tools/arvbox/lib/arvbox/docker/service/doc/run-service

index d41eaeea5fa6ee53fef1dedf2e7c37440c844cfb..cc4f17e9ab2611357eab383624fc18158447609b 100644 (file)
@@ -12,6 +12,7 @@ docker/*/generated
 docker/config.yml
 doc/.site
 doc/sdk/python/arvados
+doc/sdk/R/arvados
 sdk/perl/MYMETA.*
 sdk/perl/Makefile
 sdk/perl/blib
index 4ebaf07c13e5ae37a8cb70124a4870fda726b1ef..ec3c4637703abdd4749d6efd00980f854c6ee02f 100755 (executable)
@@ -249,6 +249,8 @@ sanity_checks() {
     R -q -e "library('testthat')" || fatal "No testthat. Try: apt-get install r-cran-testthat"
     # needed for roxygen2, needed for devtools, needed for R sdk
     pkg-config --exists libxml-2.0 || fatal "No libxml2. Try: apt-get install libxml2-dev"
+    # needed for pkgdown, builds R SDK doc pages
+    which pandoc || fatal "No pandoc. Try: apt-get install pandoc"
 }
 
 rotate_logfile() {
@@ -786,6 +788,9 @@ if (!requireNamespace("devtools")) {
 if (!requireNamespace("roxygen2")) {
   install.packages("roxygen2")
 }
+if (!requireNamespace("pkgdown")) {
+  devtools::install_github("hadley/pkgdown")
+}
 devtools::install_dev_deps()
 EOF
 }
index f68a96471d51060a4adc88451916a561c2f8b075..eaa5410100992dfc8bc4482e2b6974d54b0ff8a0 100644 (file)
@@ -6,7 +6,7 @@
 require "rubygems"
 require "colorize"
 
-task :generate => [ :realclean, 'sdk/python/arvados/index.html' ] do
+task :generate => [ :realclean, 'sdk/python/arvados/index.html', 'sdk/R/arvados/index.html' ] do
   vars = ['baseurl', 'arvados_api_host', 'arvados_workbench_host']
   vars.each do |v|
     if ENV[v]
@@ -25,6 +25,19 @@ file "sdk/python/arvados/index.html" do |t|
   end
 end
 
+file "sdk/R/arvados/index.html" do |t|
+  `which R`
+  if $? == 0
+    Dir.chdir("../sdk/R/") do
+      STDERR.puts `R --quiet --vanilla -e 'pkgdown::build_site()' 2>&1`
+    end
+    raise if $? != 0
+    cp_r("../sdk/R/docs", "sdk/R/arvados")
+  else
+    puts "Warning: R not found, R documentation will not be generated".colorize(:light_red)
+  end
+end
+
 task :linkchecker => [ :generate ] do
   Dir.chdir(".site") do
     `which linkchecker`
@@ -38,6 +51,8 @@ end
 
 task :clean do
   rm_rf "sdk/python/arvados"
+  rm_rf "sdk/R/arvados"
+  rm_rf "../sdk/R/docs"
 end
 
 require "zenweb/tasks"
index 08b581c0d71de7c3fe7ab831191735ee4e7c05b1..680f940f26b04f3c4fa9885ccd0fa291d59fc7a8 100644 (file)
@@ -103,6 +103,8 @@ navbar:
     - Go:
       - sdk/go/index.html.textile.liquid
       - sdk/go/example.html.textile.liquid
+    - R:
+      - sdk/R/R.html.textile.liquid
     - Perl:
       - sdk/perl/index.html.textile.liquid
       - sdk/perl/example.html.textile.liquid
diff --git a/doc/sdk/R/R.html.textile.liquid b/doc/sdk/R/R.html.textile.liquid
new file mode 100644 (file)
index 0000000..7b788a1
--- /dev/null
@@ -0,0 +1,15 @@
+---
+layout: default
+navsection: sdk
+navmenu: R
+title: "R Reference"
+
+no_nav_left: true
+...
+{% comment %}
+Copyright (C) The Arvados Authors. All rights reserved.
+
+SPDX-License-Identifier: CC-BY-SA-3.0
+{% endcomment %}
+
+notextile. <iframe src="arvados/" style="width:100%; height:100%; border:none" />
index e2b6eba8995434181279e39d321e93d9f3c83e2c..fbc5ca11b68ae09dfffefde5ddc3274835ceb940 100644 (file)
@@ -14,6 +14,7 @@ This section documents language bindings for the "Arvados API":{{site.baseurl}}/
 * "Python SDK":{{site.baseurl}}/sdk/python/sdk-python.html
 * "Command line SDK":{{site.baseurl}}/sdk/cli/install.html ("arv")
 * "Go SDK":{{site.baseurl}}/sdk/go/index.html
+* "R SDK":{{site.baseurl}}/sdk/go/index.html
 * "Perl SDK":{{site.baseurl}}/sdk/perl/index.html
 * "Ruby SDK":{{site.baseurl}}/sdk/ruby/index.html
 * "Java SDK":{{site.baseurl}}/sdk/java/index.html
index 91114bf2f2bba5e0c5252e75018da19b869776f1..b9136fea90429da147efb85699385bafa9597d24 100644 (file)
@@ -1,2 +1,4 @@
 ^.*\.Rproj$
 ^\.Rproj\.user$
+^docs$
+^pkgdown$
index 73738e17bc72f5c210da9b8e1c9699e633288c7c..19cf8fbabb537eb346102891438067c779cec46b 100644 (file)
@@ -2,7 +2,7 @@ Package: ArvadosR
 Type: Package
 Title: Arvados R SDK
 Version: 0.0.2
-Author: Fuad Muhic
+Authors@R: person("Fuad", "Muhic", role = c("aut", "cre"), email = "fmuhic@capeannenterprises.com")
 Maintainer: Ward Vandewege <wvandewege@veritasgenetics.com>
 Description: This is the Arvados R SDK
 URL: http://doc.arvados.org
index d4c143cdba9ce424908873433b3517496209a340..f2cae86f546a41b632a7e11c534b6affcc5cddd4 100644 (file)
@@ -1,10 +1,10 @@
 # Generated by roxygen2: do not edit by hand
 
+S3method(print,Arvados)
+S3method(print,ArvadosFile)
+S3method(print,Collection)
+S3method(print,Subcollection)
 export(Arvados)
 export(ArvadosFile)
 export(Collection)
 export(Subcollection)
-export(print.Arvados)
-export(print.ArvadosFile)
-export(print.Collection)
-export(print.Subcollection)
index ea4384b5b47ecb97d9b2aaa0348b79738ae2e180..8b0e92b2374762133cae5953d32b3531853c3088 100644 (file)
@@ -2,14 +2,61 @@ source("./R/RESTService.R")
 source("./R/HttpRequest.R")
 source("./R/HttpParser.R")
 
-#' Arvados SDK Object
+#' Arvados
+#' 
+#' Arvados class gives users ability to manipulate collections and projects.
+#' 
+#' @section Usage:
+#' \preformatted{arv = Arvados$new(authToken = NULL, hostName = NULL, numRetries = 0)}
 #'
-#' All Arvados logic is inside this class
+#' @section Arguments:
+#' \describe{
+#'   \item{authToken}{Authentification token. If not specified ARVADOS_API_TOKEN environment variable will be used.}
+#'   \item{hostName}{Host name. If not specified ARVADOS_API_HOST environment variable will be used.}
+#'   \item{numRetries}{Number which specifies how many times to retry failed service requests.}
+#' }
+#' 
+#' @section Methods:
+#' \describe{
+#'   \item{getToken()}{Returns authentification token currently in use.}
+#'   \item{getHostName()}{Returns host name currently in use.}
+#'   \item{getNumRetries()}{Returns number which specifies how many times to retry failed service requests.}
+#'   \item{setNumRetries(newNumOfRetries)}{Sets number which specifies how many times to retry failed service requests.}
+#'   \item{getCollection(uuid)}{Get collection with specified UUID.}
+#'   \item{listCollections(filters = NULL, limit = 100, offset = 0)}{Returns list of collections based on filters parameter.}
+#'   \item{listAllCollections(filters = NULL)}{Lists all collections, based on filters parameter, even if the number of items is greater than maximum API limit.}
+#'   \item{deleteCollection(uuid)}{Deletes collection with specified UUID.}
+#'   \item{updateCollection(uuid, newContent)}{Updates collection with specified UUID.}
+#'   \item{createCollection(content)}{Creates new collection.}
+#'   \item{getProject(uuid)}{Get project with specified UUID.}
+#'   \item{listProjects(filters = NULL, limit = 100, offset = 0)}{Returns list of projects based on filters parameter.}
+#'   \item{listAllProjects(filters = NULL)}{Lists all projects, based on filters parameter, even if the number of items is greater than maximum API limit.}
+#'   \item{deleteProject(uuid)}{Deletes project with specified UUID.}
+#'   \item{updateProject(uuid, newContent)}{Updates project with specified UUID.}
+#'   \item{createProject(content)}{Creates new project.}
+#' }
 #'
-#' @field token Token represents user authentification token.
-#' @field host Host represents server name we wish to connect to.
-#' @examples arv = Arvados$new("token", "host_name")
-#' @export Arvados
+#' @name Arvados
+#' @examples
+#' \dontrun{
+#' arv <- Arvados$new("your Arvados token", "example.arvadosapi.com")
+#'
+#' collection <- arv$getCollection("uuid")
+#'
+#' collectionList <- arv$listCollections(list(list("name", "like", "Test%")))
+#' collectionList <- arv$listAllCollections(list(list("name", "like", "Test%")))
+#'
+#' deletedCollection <- arv$deleteCollection("uuid")
+#'
+#' updatedCollection <- arv$updateCollection("uuid", list(name = "New name",
+#'                                                        description = "New description"))
+#'
+#' createdCollection <- arv$createCollection(list(name = "Example",
+#'                                                description = "This is a test collection"))
+#' }
+NULL
+
+#' @export
 Arvados <- R6::R6Class(
 
     "Arvados",
@@ -174,10 +221,16 @@ Arvados <- R6::R6Class(
     cloneable = FALSE
 )
 
-#' @export print.Arvados
-print.Arvados = function(arvados)
+#' print.Arvados
+#'
+#' Custom print function for Arvados class
+#'
+#' @param x Instance of Arvados class
+#' @param ... Optional arguments.
+#' @export 
+print.Arvados = function(x, ...)
 {
-    cat(paste0("Type:  ", "\"", "Arvados",             "\""), sep = "\n")
-    cat(paste0("Host:  ", "\"", arvados$getHostName(), "\""), sep = "\n")
-    cat(paste0("Token: ", "\"", arvados$getToken(),    "\""), sep = "\n")
+    cat(paste0("Type:  ", "\"", "Arvados",       "\""), sep = "\n")
+    cat(paste0("Host:  ", "\"", x$getHostName(), "\""), sep = "\n")
+    cat(paste0("Token: ", "\"", x$getToken(),    "\""), sep = "\n")
 }
index 3437933a7388df84f8b135826a26160293151856..e28ba9606cfebd95a89a436b7ac9953c98d63fb8 100644 (file)
@@ -1,10 +1,54 @@
 source("./R/util.R")
 
-#' ArvadosFile Object
+#' ArvadosFile
+#' 
+#' ArvadosFile class represents a file inside Arvados collection.
+#' 
+#' @section Usage:
+#' \preformatted{file = ArvadosFile$new(name)}
 #'
-#' Update description
+#' @section Arguments:
+#' \describe{
+#'   \item{name}{Name of the file.}
+#' }
+#' 
+#' @section Methods:
+#' \describe{
+#'   \item{getName()}{Returns name of the file.}
+#'   \item{getRelativePath()}{Returns file path relative to the root.}
+#'   \item{read(contentType = "raw", offset = 0, length = 0)}{Read file content.}
+#'   \item{write(content, contentType = "text/html")}{Write to file (override current content of the file).}
+#'   \item{connection(rw)}{Get connection opened in "read" or "write" mode.}
+#'   \item{flush()}{Write connections content to a file (override current content of the file).}
+#'   \item{remove(name)}{Removes ArvadosFile or Subcollection specified by name from the subcollection.}
+#'   \item{getSizeInBytes()}{Returns file size in bytes.}
+#'   \item{move(newLocation)}{Moves file to a new location inside collection.}
+#' }
 #'
-#' @export ArvadosFile
+#' @name ArvadosFile
+#' @examples
+#' \dontrun{
+#' myFile <- ArvadosFile$new("myFile")
+#'
+#' myFile$write("This is new file content")
+#' fileContent <- myFile$read()
+#' fileContent <- myFile$read("text")
+#' fileContent <- myFile$read("raw", offset = 8, length = 4) 
+#'
+#' #Write a table:
+#' arvConnection <- myFile$connection("w")
+#' write.table(mytable, arvConnection)
+#' arvadosFile$flush()
+#'
+#' #Read a table:
+#' arvConnection <- myFile$connection("r")
+#' mytable <- read.table(arvConnection)
+#'
+#' myFile$move("newFolder/myFile")
+#' }
+NULL
+
+#' @export
 ArvadosFile <- R6::R6Class(
 
     "ArvadosFile",
@@ -201,20 +245,26 @@ ArvadosFile <- R6::R6Class(
     cloneable = FALSE
 )
 
-#' @export print.ArvadosFile
-print.ArvadosFile = function(arvadosFile)
+#' print.ArvadosFile
+#'
+#' Custom print function for ArvadosFile class
+#'
+#' @param x Instance of ArvadosFile class
+#' @param ... Optional arguments.
+#' @export 
+print.ArvadosFile = function(x, ...)
 {
     collection   <- NULL
-    relativePath <- arvadosFile$getRelativePath()
+    relativePath <- x$getRelativePath()
 
-    if(!is.null(arvadosFile$getCollection()))
+    if(!is.null(x$getCollection()))
     {
-        collection <- arvadosFile$getCollection()$uuid
+        collection <- x$getCollection()$uuid
         relativePath <- paste0("/", relativePath)
     }
 
     cat(paste0("Type:          ", "\"", "ArvadosFile",         "\""), sep = "\n")
-    cat(paste0("Name:          ", "\"", arvadosFile$getName(), "\""), sep = "\n")
+    cat(paste0("Name:          ", "\"", x$getName(),           "\""), sep = "\n")
     cat(paste0("Relative path: ", "\"", relativePath,          "\""), sep = "\n")
     cat(paste0("Collection:    ", "\"", collection,            "\""), sep = "\n")
 }
index 47d88ac0bc9fd3980f75d6a2b662c36d19495cbe..ed5b4f4b968d0b9a9b1b570682af587942c29ea2 100644 (file)
@@ -3,12 +3,50 @@ source("./R/ArvadosFile.R")
 source("./R/RESTService.R")
 source("./R/util.R")
 
-#' Arvados Collection Object
+#' Collection
+#' 
+#' Collection class provides interface for working with Arvados collections.
+#' 
+#' @section Usage:
+#' \preformatted{collection = Collection$new(arv, uuid)}
 #'
-#' Update description
+#' @section Arguments:
+#' \describe{
+#'   \item{arv}{Arvados object.}
+#'   \item{uuid}{UUID of a collection.}
+#' }
+#' 
+#' @section Methods:
+#' \describe{
+#'   \item{add(content)}{Adds ArvadosFile or Subcollection specified by content to the collection.}
+#'   \item{create(fileNames, relativePath = "")}{Creates one or more ArvadosFiles and adds them to the collection at specified path.}
+#'   \item{remove(fileNames)}{Remove one or more files from the collection.}
+#'   \item{move(content, newLocation)}{Moves ArvadosFile or Subcollection to another location in the collection.}
+#'   \item{getFileListing()}{Returns collections file content as character vector.}
+#'   \item{get(relativePath)}{If relativePath is valid, returns ArvadosFile or Subcollection specified by relativePath, else returns NULL.}
+#' }
 #'
-#' @examples arv = Collection$new(api, uuid)
-#' @export Collection
+#' @name Collection
+#' @examples
+#' \dontrun{
+#' arv <- Arvados$new("your Arvados token", "example.arvadosapi.com")
+#' collection <- Collection$new(arv, "uuid")
+#'
+#' newFile <- ArvadosFile$new("myFile")
+#' collection$add(newFile, "myFolder")
+#'
+#' createdFiles <- collection$create(c("main.cpp", lib.dll), "cpp/src/")
+#'
+#' collection$remove("location/to/my/file.cpp")
+#'
+#' collection$move("folder/file.cpp", "file.cpp")
+#'
+#' arvadosFile <- collection$get("location/to/my/file.cpp")
+#' arvadosSubcollection <- collection$get("location/to/my/directory/")
+#' }
+NULL
+
+#' @export
 Collection <- R6::R6Class(
 
     "Collection",
@@ -176,9 +214,15 @@ Collection <- R6::R6Class(
     cloneable = FALSE
 )
 
-#' @export print.Collection
-print.Collection = function(collection)
+#' print.Collection
+#'
+#' Custom print function for Collection class
+#'
+#' @param x Instance of Collection class
+#' @param ... Optional arguments.
+#' @export 
+print.Collection = function(x, ...)
 {
     cat(paste0("Type: ", "\"", "Arvados Collection", "\""), sep = "\n")
-    cat(paste0("uuid: ", "\"", collection$uuid,      "\""), sep = "\n")
+    cat(paste0("uuid: ", "\"", x$uuid,               "\""), sep = "\n")
 }
index 4194be95dd46e343b02abb4708f781acf1beef8f..91e4ec86459dc8e4ad8891d59cbdb80d771a4013 100644 (file)
@@ -2,11 +2,6 @@ source("./R/Subcollection.R")
 source("./R/ArvadosFile.R")
 source("./R/util.R")
 
-#' Arvados Collection Object
-#'
-#' Update description
-#'
-#' @examples arv = Collection$new(api, uuid)
 CollectionTree <- R6::R6Class(
     "CollectionTree",
     public = list(
index 8fe28b7b018419c2b2bc3c28ab85c44b4167bb27..5df8287fdce7b85f2b83003ac7e55720afc39645 100644 (file)
@@ -1,5 +1,3 @@
-#' HttpParser
-#'
 HttpParser <- R6::R6Class(
 
     "HttrParser",
index d580695e61e2881025fd5c2f927395b49e045e34..863e3f768f778880d7396a159a66f04e57d48fe6 100644 (file)
@@ -1,10 +1,45 @@
 source("./R/util.R")
 
-#' Arvados SubCollection Object
+#' Subcollection
+#' 
+#' Subcollection class represents a folder inside Arvados collection.
+#' It is essentially a composite of ArvadosFiles and other Subcollections.
+#' 
+#' @section Usage:
+#' \preformatted{subcollection = Subcollection$new(name)}
 #'
-#' Update description
+#' @section Arguments:
+#' \describe{
+#'   \item{name}{Name of the subcollection.}
+#' }
+#' 
+#' @section Methods:
+#' \describe{
+#'   \item{getName()}{Returns name of the subcollection.}
+#'   \item{getRelativePath()}{Returns subcollection path relative to the root.}
+#'   \item{add(content)}{Adds ArvadosFile or Subcollection specified by content to the subcollection.}
+#'   \item{remove(name)}{Removes ArvadosFile or Subcollection specified by name from the subcollection.}
+#'   \item{get(relativePath)}{If relativePath is valid, returns ArvadosFile or Subcollection specified by relativePath, else returns NULL.}
+#'   \item{getFileListing()}{Returns subcollections file content as character vector.}
+#'   \item{getSizeInBytes()}{Returns subcollections content size in bytes.}
+#'   \item{move(newLocation)}{Moves subcollection to a new location inside collection.}
+#' }
 #'
-#' @export Subcollection
+#' @name Subcollection
+#' @examples
+#' \dontrun{
+#' myFolder <- Subcollection$new("myFolder")
+#' myFile   <- ArvadosFile$new("myFile")
+#'
+#' myFolder$add(myFile)
+#' myFolder$get("myFile")
+#' myFolder$remove("myFile")
+#'
+#' myFolder$move("newLocation/myFolder")
+#' }
+NULL
+
+#' @export
 Subcollection <- R6::R6Class(
 
     "Subcollection",
@@ -267,22 +302,28 @@ Subcollection <- R6::R6Class(
     cloneable = FALSE
 )
 
-#' @export print.Subcollection
-print.Subcollection = function(subCollection)
+#' print.Subcollection
+#'
+#' Custom print function for Subcollection class
+#'
+#' @param x Instance of Subcollection class
+#' @param ... Optional arguments.
+#' @export 
+print.Subcollection = function(x, ...)
 {
     collection   <- NULL
-    relativePath <- subCollection$getRelativePath()
+    relativePath <- x$getRelativePath()
 
-    if(!is.null(subCollection$getCollection()))
+    if(!is.null(x$getCollection()))
     {
-        collection <- subCollection$getCollection()$uuid
+        collection <- x$getCollection()$uuid
 
-        if(!subCollection$getName() == "")
+        if(!x$getName() == "")
             relativePath <- paste0("/", relativePath)
     }
 
     cat(paste0("Type:          ", "\"", "Arvados Subcollection", "\""), sep = "\n")
-    cat(paste0("Name:          ", "\"", subCollection$getName(), "\""), sep = "\n")
+    cat(paste0("Name:          ", "\"", x$getName(),             "\""), sep = "\n")
     cat(paste0("Relative path: ", "\"", relativePath,            "\""), sep = "\n")
     cat(paste0("Collection:    ", "\"", collection,              "\""), sep = "\n")
 }
diff --git a/sdk/R/README b/sdk/R/README
deleted file mode 100644 (file)
index 4c99c75..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-R SDK for Arvados
-
-This SDK focuses on providing support for accessing Arvados projects, collections, and the files within collections.
-
-The API is not final and feedback is solicited from users on ways in which it could be improved.
-
-INSTALLATION
-
-1. Install the dependencies
-
-    > install.packages(c('R6', 'httr', 'stringr', 'jsonlite', 'curl', 'XML'))
-
-If needed, you may have to install the supporting packages first. On Linux, these are:
-
-    libxml2-dev, libssl-dev, libcurl4-gnutls-dev or libcurl4-openssl-dev
-
-2. Install the ArvardosR package
-
-    > install.packages('/path/to/ArvadosR_0.0.2.tar.gz', repos = NULL, type="source", dependencies = TRUE)
-
-
-EXAMPLES OF USAGE
-
-
-#Load Library and Initialize API:
-
-library('ArvadosR')
-arv <- Arvados$new() # uses environment variables ARVADOS_API_TOKEN and ARVADOS_API_HOST
-arv <- Arvados$new("your Arvados token", "example.arvadosapi.com")
-
-
-#Optionally, add numRetries parameter to specify number of times to retry failed service requests.
-#Default is 0.
-
-arv <- Arvados$new("your Arvados token", "example.arvadosapi.com", numRetries = 3)
-
-#This parameter can be set at any time using setNumRetries 
-
-arv$setNumRetries(5)
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Get a collection:
-
-arv$getCollection("uuid")
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#List collections:
-collectionList <- arv$listCollections(list(list("name", "like", "Test%"))) # offset of 0 and default limit of 100
-collectionList <- arv$listCollections(list(list("name", "like", "Test%")), limit = 10, offset = 2)
-
-collectionList$items_available # count of total number of items (may be more than returned due to paging)
-collectionList$items # items which match the filter criteria
-
-#Next example will list all collections even when the number of items is greater than maximum API limit
-
-collectionList <- arv$listAllCollections(list(list("name", "like", "Test%")))
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Delete a collection:
-
-deletedCollection <- arv$deleteCollection("uuid")
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Update a collection's metadata:
-
-updatedCollection <- arv$updateCollection("uuid", list(name = "New name", description = "New description"))
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Create collection:
-
-createdCollection <- arv$createCollection(list(name = "Example", description = "This is a test collection"))
-
-
---------------------------------------------------------------------------------------------------------------------------------
-COLLECTION CONTENT MANIPULATION
---------------------------------------------------------------------------------------------------------------------------------
-
-#Create collection object:
-
-collection <- Collection$new(arv, "uuid")
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Get list of files
-
-collection$getFileListing()
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#This will return ArvadosFile or Subcollection from internal tree-like structure.
-
-arvadosFile <- collection$get("location/to/my/file.cpp")
-
-#or
-
-arvadosSubcollection <- collection$get("location/to/my/directory/")
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Read a table
-
-arvadosFile   <- collection$get("myinput.txt")
-arvConnection <- arvadosFile$connection("r")
-mytable       <- read.table(arvConnection)
-
-#Write a table
-
-arvadosFile   <- collection$create("myoutput.txt")
-arvConnection <- arvadosFile$connection("w")
-write.table(mytable, arvConnection)
-arvadosFile$flush()
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Read whole file or just a portion of it.
-
-fileContent <- arvadosFile$read()
-fileContent <- arvadosFile$read("text")
-fileContent <- arvadosFile$read("raw", offset = 1024, length = 512)
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Get ArvadosFile or Subcollection size
-
-size <- arvadosFile$getSizeInBytes()
-size <- arvadosSubcollection$getSizeInBytes()
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Create new file in a collection
-
-collection$create(fileNames, optionalRelativePath)
-
-#Example
-
-mainFile <- collection$create("main.cpp", "cpp/src/")
-fileList <- collection$create(c("main.cpp", lib.dll), "cpp/src/")
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Add existing ArvadosFile or Subcollection to a collection
-
-folder <- Subcollection$new("src")
-file   <- ArvadosFile$new("main.cpp")
-folder$add(file)
-
-collection$add(folder, "cpp")
-
-#This examples will add file "main.cpp" in "./cpp/src/" folder if folder exists.
-#If subcollection contains more files or folders they will be added recursively.
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Write to existing file (Override current content of the file)
-
-arvadosFile <- collection$get("location/to/my/file.cpp")
-
-arvadosFile$write("This is new file content")
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Delete file from a collection
-
-collection$remove("location/to/my/file.cpp")
-
-#You can remove both Subcollection and ArvadosFile
-#If subcollection contains more files or folders they will be removed recursively.
-
-#You can also remove multiple files
-
-collection$remove(c("path/to/my/file.cpp", "path/to/other/file.cpp"))
-
-#Delete file or folder from a Subcollection
-
-subcollection <- collection$get("mySubcollection/")
-subcollection$remove("fileInsideSubcollection.exe")
-subcollection$remove("folderInsideSubcollection/")
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Move file or folder inside collection
-
-#Directley from collection
-
-collection$move("folder/file.cpp", "file.cpp")
-
-#Or from file
-
-file <- collection$get("location/to/my/file.cpp")
-file$move("newDestination/file.cpp")
-
-#Or from subcollection
-
-subcollection <- collection$get("location/to/folder")
-subcollection$move("newDestination/folder")
-
-#Make sure to include new file name in destination
-#In second example file$move("newDestination/") will not work
-
---------------------------------------------------------------------------------------------------------------------------------
-WORKING WITH ARVADOS PROJECTS
---------------------------------------------------------------------------------------------------------------------------------
-
-#Get a project:
-
-arv$getProject("uuid")
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#List projects:
-
-projects <- arv$listProjects(list(list("owner_uuid", "=", "aaaaa-j7d0g-ccccccccccccccc"))) # list subprojects of a project
-arv$listProjects(list(list("name","like","Example%"))) # list projects which have names beginning with Example
-
-#Next example will list all projects even when the number of items is greater than maximum API limit
-
-collectionList <- arv$listAllProjects(list(list("name","like","Example%")))
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Delete a project:
-
-deletedProject <- arv$deleteProject("uuid")
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Update project:
-
-updatedProject <- arv$updateProject("uuid", list(name = "new_name", description = "new description"))
-
---------------------------------------------------------------------------------------------------------------------------------
-
-#Create project:
-
-createdProject <- arv$createProject(list(name = "project_name", description = "project description"))
-
-
---------------------------------------------------------------------------------------------------------------------------------
-BUILDING THE ARVADOS SDK TARBALL
---------------------------------------------------------------------------------------------------------------------------------
-
-
-cd arvados/sdk
-R CMD build R
-
-This will create a tarball of the Arvados package in the current directory.
diff --git a/sdk/R/README.Rmd b/sdk/R/README.Rmd
new file mode 100644 (file)
index 0000000..098bfe1
--- /dev/null
@@ -0,0 +1,298 @@
+## R SDK for Arvados
+
+This SDK focuses on providing support for accessing Arvados projects, collections, and the files within collections.
+The API is not final and feedback is solicited from users on ways in which it could be improved.
+
+### Installation
+
+```install.packages("ArvadosR", repos=c("http://r.arvados.org", getOption("repos")["CRAN"]), dependencies=TRUE)```
+
+Note: on Linux, you may have to install supporting packages.
+
+On Centos 7, this is:
+
+```yum install libxml2-devel openssl-devel curl-devel```
+
+On Debian, this is:
+
+```apt-get install build-essential libxml2-dev libssl-dev libcurl4-gnutls-dev```
+
+
+### Usage
+
+#### Initializing API
+
+```{r include=FALSE}
+knitr::opts_chunk$set(eval = FALSE)
+```
+
+* Load Library and Initialize API:
+
+    ```{r}
+    library('ArvadosR')
+    # use environment variables ARVADOS_API_TOKEN and ARVADOS_API_HOST
+    arv <- Arvados$new()
+
+    # provide them explicitly
+    arv <- Arvados$new("your Arvados token", "example.arvadosapi.com")
+    ```
+
+    Optionally, add numRetries parameter to specify number of times to retry failed service requests.
+    Default is 0.
+
+    ```{r}
+    arv <- Arvados$new("your Arvados token", "example.arvadosapi.com", numRetries = 3)
+    ```
+
+    This parameter can be set at any time using setNumRetries
+
+    ```{r}
+    arv$setNumRetries(5)
+    ```
+
+
+#### Working with collections
+
+* Get a collection:
+
+    ```{r}
+    collection <- arv$getCollection("uuid")
+    ```
+
+* List collections:
+
+    ```{r}
+    # offset of 0 and default limit of 100
+    collectionList <- arv$listCollections(list(list("name", "like", "Test%")))
+
+    collectionList <- arv$listCollections(list(list("name", "like", "Test%")), limit = 10, offset = 2)
+    ```
+
+    ```{r}
+    # count of total number of items (may be more than returned due to paging)
+    collectionList$items_available
+
+    # items which match the filter criteria
+    collectionList$items
+    ```
+
+* List all collections even if the number of items is greater than maximum API limit:
+
+    ```{r}
+    collectionList <- arv$listAllCollections(list(list("name", "like", "Test%")))
+    ```
+
+* Delete a collection:
+
+    ```{r}
+    deletedCollection <- arv$deleteCollection("uuid")
+    ```
+
+* Update a collection's metadata:
+
+    ```{r}
+    updatedCollection <- arv$updateCollection("uuid", list(name = "New name", description = "New description"))
+    ```
+
+* Create collection:
+
+    ```{r}
+    createdCollection <- arv$createCollection(list(name = "Example", description = "This is a test collection"))
+    ```
+
+
+#### Manipulating collection content
+
+* Create collection object:
+
+    ```{r}
+    collection <- Collection$new(arv, "uuid")
+    ```
+
+* Get list of files:
+
+    ```{r}
+    files <- collection$getFileListing()
+    ```
+
+* Get ArvadosFile or Subcollection from internal tree-like structure:
+
+    ```{r}
+    arvadosFile <- collection$get("location/to/my/file.cpp")
+    ```
+
+    or
+
+    ```{r}
+    arvadosSubcollection <- collection$get("location/to/my/directory/")
+    ```
+
+* Read a table:
+
+    ```{r}
+    arvadosFile   <- collection$get("myinput.txt")
+    arvConnection <- arvadosFile$connection("r")
+    mytable       <- read.table(arvConnection)
+    ```
+
+* Write a table:
+
+    ```{r}
+    arvadosFile   <- collection$create("myoutput.txt")
+    arvConnection <- arvadosFile$connection("w")
+    write.table(mytable, arvConnection)
+    arvadosFile$flush()
+    ```
+
+* Write to existing file (override current content of the file):
+
+    ```{r}
+    arvadosFile <- collection$get("location/to/my/file.cpp")
+    arvadosFile$write("This is new file content")
+    ```
+
+* Read whole file or just a portion of it:
+
+    ```{r}
+    fileContent <- arvadosFile$read()
+    fileContent <- arvadosFile$read("text")
+    fileContent <- arvadosFile$read("raw", offset = 1024, length = 512)
+    ```
+
+* Get ArvadosFile or Subcollection size:
+
+    ```{r}
+    size <- arvadosFile$getSizeInBytes()
+    ```
+
+    or
+
+    ```{r}
+    size <- arvadosSubcollection$getSizeInBytes()
+    ```
+
+* Create new file in a collection:
+
+    ```{r}
+    collection$create(fileNames, optionalRelativePath)
+    ```
+
+    Example:
+
+    ```{r}
+    mainFile <- collection$create("main.cpp", "cpp/src/")
+    fileList <- collection$create(c("main.cpp", lib.dll), "cpp/src/")
+    ```
+
+* Add existing ArvadosFile or Subcollection to a collection:
+
+    ```{r}
+    folder <- Subcollection$new("src")
+    file   <- ArvadosFile$new("main.cpp")
+    folder$add(file)
+    ```
+
+    ```{r}
+    collection$add(folder, "cpp")
+    ```
+
+    This examples will add file "main.cpp" in "./cpp/src/" folder if folder exists.
+    If subcollection contains more files or folders they will be added recursively.
+
+* Delete file from a collection:
+
+    ```{r}
+    collection$remove("location/to/my/file.cpp")
+    ```
+
+    You can remove both Subcollection and ArvadosFile.
+    If subcollection contains more files or folders they will be removed recursively.
+
+    You can also remove multiple files at once:
+
+    ```{r}
+    collection$remove(c("path/to/my/file.cpp", "path/to/other/file.cpp"))
+    ```
+
+* Delete file or folder from a Subcollection:
+
+    ```{r}
+    subcollection <- collection$get("mySubcollection/")
+    subcollection$remove("fileInsideSubcollection.exe")
+    subcollection$remove("folderInsideSubcollection/")
+    ```
+
+* Move file or folder inside collection:
+
+    Directley from collection
+
+    ```{r}
+    collection$move("folder/file.cpp", "file.cpp")
+    ```
+
+    Or from file
+
+    ```{r}
+    file <- collection$get("location/to/my/file.cpp")
+    file$move("newDestination/file.cpp")
+    ```
+
+    Or from subcollection
+
+    ```{r}
+    subcollection <- collection$get("location/to/folder")
+    subcollection$move("newDestination/folder")
+    ```
+
+    Make sure to include new file name in destination.
+    In second example file$move("newDestination/") will not work.
+
+#### Working with Aravdos projects
+
+* Get a project:
+
+    ```{r}
+    project <- arv$getProject("uuid")
+    ```
+
+* List projects:
+
+    ```{r}
+    # list subprojects of a project
+    projects <- arv$listProjects(list(list("owner_uuid", "=", "aaaaa-j7d0g-ccccccccccccccc")))
+
+    # list projects which have names beginning with Example
+    arv$listProjects(list(list("name","like","Example%")))
+    ```
+
+* List all projects even if the number of items is greater than maximum API limit:
+
+    ```{r}
+    collectionList <- arv$listAllProjects(list(list("name","like","Example%")))
+    ```
+
+* Delete a project:
+
+    ```{r}
+    deletedProject <- arv$deleteProject("uuid")
+    ```
+
+* Update project:
+
+    ```{r}
+    updatedProject <- arv$updateProject("uuid", list(name = "new_name", description = "new description"))
+    ```
+
+* Create project:
+
+    ```{r}
+    createdProject <- arv$createProject(list(name = "project_name", description = "project description"))
+    ```
+
+### Building the ArvadosR package
+
+  ```
+  cd arvados/sdk && R CMD build R
+  ```
+
+This will create a tarball of the ArvadosR package in the current directory.
index 6dfb0cedcc239c89898c734eb5e609de5dd18dd8..3c66437f04149ed833d6202d2cbe2f68d38bc5fc 100644 (file)
@@ -1,25 +1,62 @@
 % Generated by roxygen2: do not edit by hand
 % Please edit documentation in R/Arvados.R
-\docType{data}
 \name{Arvados}
 \alias{Arvados}
-\title{Arvados SDK Object}
-\format{An object of class \code{R6ClassGenerator} of length 24.}
-\usage{
-Arvados
-}
+\title{Arvados}
 \description{
-All Arvados logic is inside this class
+Arvados class gives users ability to manipulate collections and projects.
+}
+\section{Usage}{
+
+\preformatted{arv = Arvados$new(authToken = NULL, hostName = NULL, numRetries = 0)}
 }
-\section{Fields}{
+
+\section{Arguments}{
 
 \describe{
-\item{\code{token}}{Token represents user authentification token.}
+  \item{authToken}{Authentification token. If not specified ARVADOS_API_TOKEN environment variable will be used.}
+  \item{hostName}{Host name. If not specified ARVADOS_API_HOST environment variable will be used.}
+  \item{numRetries}{Number which specifies how many times to retry failed service requests.}
+}
+}
 
-\item{\code{host}}{Host represents server name we wish to connect to.}
-}}
+\section{Methods}{
+
+\describe{
+  \item{getToken()}{Returns authentification token currently in use.}
+  \item{getHostName()}{Returns host name currently in use.}
+  \item{getNumRetries()}{Returns number which specifies how many times to retry failed service requests.}
+  \item{setNumRetries(newNumOfRetries)}{Sets number which specifies how many times to retry failed service requests.}
+  \item{getCollection(uuid)}{Get collection with specified UUID.}
+  \item{listCollections(filters = NULL, limit = 100, offset = 0)}{Returns list of collections based on filters parameter.}
+  \item{listAllCollections(filters = NULL)}{Lists all collections, based on filters parameter, even if the number of items is greater than maximum API limit.}
+  \item{deleteCollection(uuid)}{Deletes collection with specified UUID.}
+  \item{updateCollection(uuid, newContent)}{Updates collection with specified UUID.}
+  \item{createCollection(content)}{Creates new collection.}
+  \item{getProject(uuid)}{Get project with specified UUID.}
+  \item{listProjects(filters = NULL, limit = 100, offset = 0)}{Returns list of projects based on filters parameter.}
+  \item{listAllProjects(filters = NULL)}{Lists all projects, based on filters parameter, even if the number of items is greater than maximum API limit.}
+  \item{deleteProject(uuid)}{Deletes project with specified UUID.}
+  \item{updateProject(uuid, newContent)}{Updates project with specified UUID.}
+  \item{createProject(content)}{Creates new project.}
+}
+}
 
 \examples{
-arv = Arvados$new("token", "host_name")
+\dontrun{
+arv <- Arvados$new("your Arvados token", "example.arvadosapi.com")
+
+collection <- arv$getCollection("uuid")
+
+collectionList <- arv$listCollections(list(list("name", "like", "Test\%")))
+collectionList <- arv$listAllCollections(list(list("name", "like", "Test\%")))
+
+deletedCollection <- arv$deleteCollection("uuid")
+
+updatedCollection <- arv$updateCollection("uuid", list(name = "New name",
+                                                       description = "New description"))
+
+createdCollection <- arv$createCollection(list(name = "Example",
+                                               description = "This is a test collection"))
+}
 }
-\keyword{datasets}
index f48a71f515c6cf9ee01c4d1805b39ce78bf757b7..b7840dc16ff4cbbd15dd7383b9fcde0c59416606 100644 (file)
@@ -1,14 +1,56 @@
 % Generated by roxygen2: do not edit by hand
 % Please edit documentation in R/ArvadosFile.R
-\docType{data}
 \name{ArvadosFile}
 \alias{ArvadosFile}
-\title{ArvadosFile Object}
-\format{An object of class \code{R6ClassGenerator} of length 24.}
-\usage{
-ArvadosFile
-}
+\title{ArvadosFile}
 \description{
-Update description
+ArvadosFile class represents a file inside Arvados collection.
+}
+\section{Usage}{
+
+\preformatted{file = ArvadosFile$new(name)}
+}
+
+\section{Arguments}{
+
+\describe{
+  \item{name}{Name of the file.}
+}
+}
+
+\section{Methods}{
+
+\describe{
+  \item{getName()}{Returns name of the file.}
+  \item{getRelativePath()}{Returns file path relative to the root.}
+  \item{read(contentType = "raw", offset = 0, length = 0)}{Read file content.}
+  \item{write(content, contentType = "text/html")}{Write to file (override current content of the file).}
+  \item{connection(rw)}{Get connection opened in "read" or "write" mode.}
+  \item{flush()}{Write connections content to a file (override current content of the file).}
+  \item{remove(name)}{Removes ArvadosFile or Subcollection specified by name from the subcollection.}
+  \item{getSizeInBytes()}{Returns file size in bytes.}
+  \item{move(newLocation)}{Moves file to a new location inside collection.}
+}
+}
+
+\examples{
+\dontrun{
+myFile <- ArvadosFile$new("myFile")
+
+myFile$write("This is new file content")
+fileContent <- myFile$read()
+fileContent <- myFile$read("text")
+fileContent <- myFile$read("raw", offset = 8, length = 4) 
+
+#Write a table:
+arvConnection <- myFile$connection("w")
+write.table(mytable, arvConnection)
+arvadosFile$flush()
+
+#Read a table:
+arvConnection <- myFile$connection("r")
+mytable <- read.table(arvConnection)
+
+myFile$move("newFolder/myFile")
+}
 }
-\keyword{datasets}
index 46c76cb40b49c7026e375cd4fa6ce0f69b56d3d3..8cf29a2ea56d19cc32307cdab3c0a488537ac295 100644 (file)
@@ -1,17 +1,51 @@
 % Generated by roxygen2: do not edit by hand
 % Please edit documentation in R/Collection.R
-\docType{data}
 \name{Collection}
 \alias{Collection}
-\title{Arvados Collection Object}
-\format{An object of class \code{R6ClassGenerator} of length 24.}
-\usage{
-Collection
-}
+\title{Collection}
 \description{
-Update description
+Collection class provides interface for working with Arvados collections.
+}
+\section{Usage}{
+
+\preformatted{collection = Collection$new(arv, uuid)}
+}
+
+\section{Arguments}{
+
+\describe{
+  \item{arv}{Arvados object.}
+  \item{uuid}{UUID of a collection.}
+}
 }
+
+\section{Methods}{
+
+\describe{
+  \item{add(content)}{Adds ArvadosFile or Subcollection specified by content to the collection.}
+  \item{create(fileNames, relativePath = "")}{Creates one or more ArvadosFiles and adds them to the collection at specified path.}
+  \item{remove(fileNames)}{Remove one or more files from the collection.}
+  \item{move(content, newLocation)}{Moves ArvadosFile or Subcollection to another location in the collection.}
+  \item{getFileListing()}{Returns collections file content as character vector.}
+  \item{get(relativePath)}{If relativePath is valid, returns ArvadosFile or Subcollection specified by relativePath, else returns NULL.}
+}
+}
+
 \examples{
-arv = Collection$new(api, uuid)
+\dontrun{
+arv <- Arvados$new("your Arvados token", "example.arvadosapi.com")
+collection <- Collection$new(arv, "uuid")
+
+newFile <- ArvadosFile$new("myFile")
+collection$add(newFile, "myFolder")
+
+createdFiles <- collection$create(c("main.cpp", lib.dll), "cpp/src/")
+
+collection$remove("location/to/my/file.cpp")
+
+collection$move("folder/file.cpp", "file.cpp")
+
+arvadosFile <- collection$get("location/to/my/file.cpp")
+arvadosSubcollection <- collection$get("location/to/my/directory/")
+}
 }
-\keyword{datasets}
diff --git a/sdk/R/man/CollectionTree.Rd b/sdk/R/man/CollectionTree.Rd
deleted file mode 100644 (file)
index adeed46..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/CollectionTree.R
-\docType{data}
-\name{CollectionTree}
-\alias{CollectionTree}
-\title{Arvados Collection Object}
-\format{An object of class \code{R6ClassGenerator} of length 24.}
-\usage{
-CollectionTree
-}
-\description{
-Update description
-}
-\examples{
-arv = Collection$new(api, uuid)
-}
-\keyword{datasets}
diff --git a/sdk/R/man/HttpParser.Rd b/sdk/R/man/HttpParser.Rd
deleted file mode 100644 (file)
index 68d314f..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/HttpParser.R
-\docType{data}
-\name{HttpParser}
-\alias{HttpParser}
-\title{HttpParser}
-\format{An object of class \code{R6ClassGenerator} of length 24.}
-\usage{
-HttpParser
-}
-\description{
-HttpParser
-}
-\keyword{datasets}
index e644e02168043df83c894a2b68f81fa1af2e9b24..df0970b30fd4ef843b595f8db52efbafd9b140a4 100644 (file)
@@ -1,14 +1,47 @@
 % Generated by roxygen2: do not edit by hand
 % Please edit documentation in R/Subcollection.R
-\docType{data}
 \name{Subcollection}
 \alias{Subcollection}
-\title{Arvados SubCollection Object}
-\format{An object of class \code{R6ClassGenerator} of length 24.}
-\usage{
-Subcollection
-}
+\title{Subcollection}
 \description{
-Update description
+Subcollection class represents a folder inside Arvados collection.
+It is essentially a composite of ArvadosFiles and other Subcollections.
+}
+\section{Usage}{
+
+\preformatted{subcollection = Subcollection$new(name)}
+}
+
+\section{Arguments}{
+
+\describe{
+  \item{name}{Name of the subcollection.}
+}
+}
+
+\section{Methods}{
+
+\describe{
+  \item{getName()}{Returns name of the subcollection.}
+  \item{getRelativePath()}{Returns subcollection path relative to the root.}
+  \item{add(content)}{Adds ArvadosFile or Subcollection specified by content to the subcollection.}
+  \item{remove(name)}{Removes ArvadosFile or Subcollection specified by name from the subcollection.}
+  \item{get(relativePath)}{If relativePath is valid, returns ArvadosFile or Subcollection specified by relativePath, else returns NULL.}
+  \item{getFileListing()}{Returns subcollections file content as character vector.}
+  \item{getSizeInBytes()}{Returns subcollections content size in bytes.}
+  \item{move(newLocation)}{Moves subcollection to a new location inside collection.}
+}
+}
+
+\examples{
+\dontrun{
+myFolder <- Subcollection$new("myFolder")
+myFile   <- ArvadosFile$new("myFile")
+
+myFolder$add(myFile)
+myFolder$get("myFile")
+myFolder$remove("myFile")
+
+myFolder$move("newLocation/myFolder")
+}
 }
-\keyword{datasets}
diff --git a/sdk/R/man/print.Arvados.Rd b/sdk/R/man/print.Arvados.Rd
new file mode 100644 (file)
index 0000000..0833d15
--- /dev/null
@@ -0,0 +1,16 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/Arvados.R
+\name{print.Arvados}
+\alias{print.Arvados}
+\title{print.Arvados}
+\usage{
+\method{print}{Arvados}(x, ...)
+}
+\arguments{
+\item{x}{Instance of Arvados class}
+
+\item{...}{Optional arguments.}
+}
+\description{
+Custom print function for Arvados class
+}
diff --git a/sdk/R/man/print.ArvadosFile.Rd b/sdk/R/man/print.ArvadosFile.Rd
new file mode 100644 (file)
index 0000000..566ec8b
--- /dev/null
@@ -0,0 +1,16 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/ArvadosFile.R
+\name{print.ArvadosFile}
+\alias{print.ArvadosFile}
+\title{print.ArvadosFile}
+\usage{
+\method{print}{ArvadosFile}(x, ...)
+}
+\arguments{
+\item{x}{Instance of ArvadosFile class}
+
+\item{...}{Optional arguments.}
+}
+\description{
+Custom print function for ArvadosFile class
+}
diff --git a/sdk/R/man/print.Collection.Rd b/sdk/R/man/print.Collection.Rd
new file mode 100644 (file)
index 0000000..8852383
--- /dev/null
@@ -0,0 +1,16 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/Collection.R
+\name{print.Collection}
+\alias{print.Collection}
+\title{print.Collection}
+\usage{
+\method{print}{Collection}(x, ...)
+}
+\arguments{
+\item{x}{Instance of Collection class}
+
+\item{...}{Optional arguments.}
+}
+\description{
+Custom print function for Collection class
+}
diff --git a/sdk/R/man/print.Subcollection.Rd b/sdk/R/man/print.Subcollection.Rd
new file mode 100644 (file)
index 0000000..621350f
--- /dev/null
@@ -0,0 +1,16 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/Subcollection.R
+\name{print.Subcollection}
+\alias{print.Subcollection}
+\title{print.Subcollection}
+\usage{
+\method{print}{Subcollection}(x, ...)
+}
+\arguments{
+\item{x}{Instance of Subcollection class}
+
+\item{...}{Optional arguments.}
+}
+\description{
+Custom print function for Subcollection class
+}
index 234d15aecd03d42537b5f93f02a4dcd8b3f0340b..3429a1b65d0b13c500e3f109d017eaa6afcc60de 100755 (executable)
@@ -57,6 +57,7 @@ GEMS="$ARVBOX_DATA/gems"
 PIPCACHE="$ARVBOX_DATA/pip"
 NPMCACHE="$ARVBOX_DATA/npm"
 GOSTUFF="$ARVBOX_DATA/gopath"
+RLIBS="$ARVBOX_DATA/Rlibs"
 
 getip() {
     docker inspect $ARVBOX_CONTAINER | grep \"IPAddress\" | head -n1 | tr -d ' ":,\n' | cut -c10-
@@ -188,7 +189,7 @@ run() {
         updateconf
         wait_for_arvbox
     else
-        mkdir -p "$PG_DATA" "$VAR_DATA" "$PASSENGER" "$GEMS" "$PIPCACHE" "$NPMCACHE" "$GOSTUFF"
+        mkdir -p "$PG_DATA" "$VAR_DATA" "$PASSENGER" "$GEMS" "$PIPCACHE" "$NPMCACHE" "$GOSTUFF" "$RLIBS"
 
 
         if ! test -d "$ARVADOS_ROOT" ; then
@@ -220,6 +221,7 @@ run() {
                        "--volume=$PIPCACHE:/var/lib/pip:rw" \
                        "--volume=$NPMCACHE:/var/lib/npm:rw" \
                        "--volume=$GOSTUFF:/var/lib/gopath:rw" \
+                       "--volume=$RLIBS:/var/lib/Rlibs:rw" \
                       "--env=SVDIR=/etc/test-service" \
                        arvados/arvbox-dev$TAG
 
@@ -262,6 +264,7 @@ run() {
                    "--volume=$PIPCACHE:/var/lib/pip:rw" \
                    "--volume=$NPMCACHE:/var/lib/npm:rw" \
                    "--volume=$GOSTUFF:/var/lib/gopath:rw" \
+                   "--volume=$RLIBS:/var/lib/Rlibs:rw" \
                    $PUBLIC \
                    arvados/arvbox-dev$TAG
             updateconf
index c95bc48fad105118e750f3bc6dfe6b901a18365c..0cc36ebd2b92cb5ac2c3f35ec02d757adf11d4a9 100644 (file)
@@ -19,7 +19,7 @@ RUN apt-get update && \
     apt-transport-https ca-certificates slurm-wlm \
     linkchecker python3-virtualenv python-virtualenv xvfb iceweasel \
     libgnutls28-dev python3-dev vim cadaver cython gnupg dirmngr \
-    libsecret-1-dev r-base r-cran-testthat libxml2-dev && \
+    libsecret-1-dev r-base r-cran-testthat libxml2-dev pandoc && \
     apt-get clean
 
 ENV RUBYVERSION_MINOR 2.3
index 2cb8473657e7705bc0759bd054da0e0d57222754..319889baef28152a1a933bdc25cab7aa85491e1a 100644 (file)
@@ -8,6 +8,7 @@ export GEM_HOME=/var/lib/gems
 export GEM_PATH=/var/lib/gems
 export npm_config_cache=/var/lib/npm
 export npm_config_cache_min=Infinity
+export R_LIBS=/var/lib/Rlibs
 
 if test -s /var/run/localip_override ; then
     localip=$(cat /var/run/localip_override)
index b8bf740605d3848a79dbd885f75b1bdcb5f50e54..97cc79d32fd2d110f6bd879441316cdcfec6adc1 100755 (executable)
@@ -11,6 +11,21 @@ set -ex -o pipefail
 cd /usr/src/arvados/doc
 run_bundler --without=development
 
+cd /usr/src/arvados/sdk/R
+R --quiet --vanilla <<EOF
+options(repos=structure(c(CRAN="http://cran.wustl.edu/")))
+if (!requireNamespace("devtools")) {
+  install.packages("devtools")
+}
+if (!requireNamespace("roxygen2")) {
+  install.packages("roxygen2")
+}
+if (!requireNamespace("pkgdown")) {
+  devtools::install_github("hadley/pkgdown")
+}
+devtools::install_dev_deps()
+EOF
+
 if test "$1" = "--only-deps" ; then
     exit
 fi
@@ -42,6 +57,7 @@ http {
 }
 EOF
 
+cd /usr/src/arvados/doc
 bundle exec rake generate baseurl=http://$localip:${services[doc]} arvados_api_host=$localip:${services[api]} arvados_workbench_host=http://$localip
 
 exec nginx -c /var/lib/arvados/doc-nginx.conf