[rkward-cvs] SF.net SVN: rkward:[3738] trunk/rkward/rkward/rbackend/rpackages/rkwarddev
m-eik at users.sourceforge.net
m-eik at users.sourceforge.net
Fri Sep 9 23:07:06 UTC 2011
Revision: 3738
http://rkward.svn.sourceforge.net/rkward/?rev=3738&view=rev
Author: m-eik
Date: 2011-09-09 23:07:06 +0000 (Fri, 09 Sep 2011)
Log Message:
-----------
rkwarddev: added plugin tests to skeleton and examples to docs
Modified Paths:
--------------
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/NAMESPACE
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.browser.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.cbox.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.col.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dropdown.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.frame.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.input.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.radio.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.row.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.saveobj.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.stretch.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.tabbook.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.text.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.vars.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.browser.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.cbox.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.col.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.dropdown.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.frame.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.input.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.radio.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.row.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.saveobj.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.stretch.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.tabbook.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.text.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.vars.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd
Added Paths:
-----------
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.testsuite.doc.R
trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.testsuite.doc.Rd
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog 2011-09-09 23:07:06 UTC (rev 3738)
@@ -2,7 +2,8 @@
## 0.01-1 (2011-09-05)
- added rk.JS.scan(), rk.JS.doc(), rk.JS.array(), rk.rkh.scan() and rk.rkh.doc()
- - added rk.XML.browser(), rk.XML.input(), rk.XML.saveobj(), rk.XML.stretch() and rk.XML.text()
+ - added rk.XML.browser(), rk.XML.input(), rk.XML.saveobj(), rk.XML.stretch() and rk.XML.text()
+ - added rk.testsuite.doc()
- shortened package name from "rkwardplugdev" to "rkwarddev"
- merged code into RKWard's svn tree
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/DESCRIPTION 2011-09-09 23:07:06 UTC (rev 3738)
@@ -16,7 +16,7 @@
Author at R: c(person(given="Meik", family="Michalke",
email="meik.michalke at hhu.de"))
Version: 0.01-1
-Date: 2011-09-06
+Date: 2011-09-09
Collate:
'rk-internal.R'
'rk.JS.array.R'
@@ -25,6 +25,7 @@
'rk.plugin.skeleton.R'
'rk.rkh.doc.R'
'rk.rkh.scan.R'
+ 'rk.testsuite.doc.R'
'rkwarddev-desc-internal.R'
'rkwarddev-package.R'
'rk.XML.about.R'
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/NAMESPACE
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/NAMESPACE 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/NAMESPACE 2011-09-09 23:07:06 UTC (rev 3738)
@@ -4,6 +4,7 @@
export(rk.plugin.skeleton)
export(rk.rkh.doc)
export(rk.rkh.scan)
+export(rk.testsuite.doc)
export(rk.XML.about)
export(rk.XML.browser)
export(rk.XML.cbox)
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.browser.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.browser.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.browser.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -6,7 +6,11 @@
#' If \code{"auto"} and a label was provided, an ID will be generated automatically from the label.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @examples
+#' test.browser <- rk.XML.browser("Browse here:")
+#' cat(pasteXMLNode(test.browser, shine=1))
+
rk.XML.browser <- function(label, dir=TRUE, id.name="auto"){
attr.list <- list(label=label)
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.cbox.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.cbox.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.cbox.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -7,6 +7,12 @@
#' If \code{"auto"}, an ID will be generated automatically from the label.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @examples
+#' test.checkboxes <- rk.XML.row(rk.XML.col(
+#' list(
+#' rk.XML.cbox(label="foo", val="foo1", chk=TRUE),
+#' rk.XML.cbox(label="bar", val="bar2"))))
+#' cat(pasteXMLNode(test.checkboxes, shine=1))
rk.XML.cbox <- function(label, val, chk=FALSE, id.name="auto"){
if(identical(id.name, "auto")){
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.col.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.col.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.col.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -5,6 +5,12 @@
#' If \code{NULL}, no ID will be given.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @examples
+#' test.checkboxes <- rk.XML.row(rk.XML.col(
+#' list(
+#' rk.XML.cbox(label="foo", val="foo1", chk=TRUE),
+#' rk.XML.cbox(label="bar", val="bar2"))))
+#' cat(pasteXMLNode(test.checkboxes, shine=1))
rk.XML.col <- function(children=list(), id.name=NULL){
if(!is.null(id.name)){
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dropdown.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dropdown.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.dropdown.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -8,6 +8,11 @@
#' If \code{"auto"} and a label was provided, an ID will be generated automatically from the label.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @examples
+#' test.dropdown <- rk.XML.dropdown("mydrop",
+#' opts=list("First Option"=c(val="val1"),
+#' "Second Option"=c(val="val2", chk=TRUE)))
+#' cat(pasteXMLNode(test.dropdown, shine=1))
rk.XML.dropdown <- function(label, opts=list(label=c(val=NULL, chk=FALSE)), id.name="auto"){
num.opt <- length(opts)
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.frame.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.frame.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.frame.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -7,6 +7,11 @@
#' If \code{NULL}, no ID will be given.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @examples
+#' test.dropdown <- rk.XML.dropdown("mydrop",
+#' opts=list("First Option"=c(val="val1"),
+#' "Second Option"=c(val="val2", chk=TRUE)))
+#' cat(pasteXMLNode(rk.XML.frame(test.dropdown, label="Some options"), shine=1))
rk.XML.frame <- function(children=list(), label=NULL, id.name="auto"){
if(!is.null(label)){
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.input.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.input.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.input.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -5,6 +5,9 @@
#' If \code{"auto"}, an ID will be generated automatically from the label.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @examples
+#' test.input <- rk.XML.input("Type some text")
+#' cat(pasteXMLNode(test.input, shine=1))
#<input id="inpCelexRunWd" label="Number of running words" />
rk.XML.input <- function(label, id.name="auto"){
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -10,7 +10,20 @@
#' @param pluginmap Character string, relative path to the pluginmap file, which will then be included in the head of this document.
#' @return An object of class \code{XiMpLe.doc}.
#' @export
-# pluginmap must be the relative path to the pluginmap file, which will then be included
+#' @examples
+#' test.checkboxes <- rk.XML.row(rk.XML.col(
+#' list(
+#' rk.XML.cbox(label="foo", val="foo1", chk=TRUE),
+#' rk.XML.cbox(label="bar", val="bar2"))))
+#' test.dropdown <- rk.XML.dropdown("mydrop",
+#' opts=list("First Option"=c(val="val1"),
+#' "Second Option"=c(val="val2", chk=TRUE)))
+#' # combine the above into a tabbook
+#' test.tabbook <- rk.XML.tabbook("My Tabbook", tab.labels=c("First Tab",
+#' "Second Tab"), children=list(test.checkboxes, test.dropdown))
+#' # make a plugin with that tabbook
+#' test.plugin <- rk.XML.plugin("My test", label="Check this out", children=test.tabbook)
+#' cat(pasteXMLNode(test.plugin, shine=1))
rk.XML.plugin <- function(name, label, children=list(), help=TRUE, logic=TRUE, provides=c("dialog"), pluginmap=NULL){
name.orig <- name
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.radio.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.radio.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.radio.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -8,6 +8,11 @@
#' If \code{"auto"} and a label was provided, an ID will be generated automatically from the label.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @examples
+#' test.radio <- rk.XML.radio("Chose one",
+#' opts=list("First Option"=c(val="val1"),
+#' "Second Option"=c(val="val2", chk=TRUE)))
+#' cat(pasteXMLNode(test.radio, shine=1))
rk.XML.radio <- function(label, opts=list(label=c(val=NULL, chk=FALSE)), id.name="auto"){
num.opt <- length(opts)
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.row.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.row.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.row.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -5,6 +5,12 @@
#' If \code{NULL}, no ID will be given.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @examples
+#' test.checkboxes <- rk.XML.row(rk.XML.col(
+#' list(
+#' rk.XML.cbox(label="foo", val="foo1", chk=TRUE),
+#' rk.XML.cbox(label="bar", val="bar2"))))
+#' cat(pasteXMLNode(test.checkboxes, shine=1))
rk.XML.row <- function(children=list(), id.name=NULL){
if(!is.null(id.name)){
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.saveobj.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.saveobj.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.saveobj.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -9,6 +9,9 @@
#' If \code{"auto"} and a label was provided, an ID will be generated automatically from the label.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @examples
+#' test.saveobj <- rk.XML.saveobj("Save the results")
+#' cat(pasteXMLNode(test.saveobj, shine=1))
rk.XML.saveobj <- function(label, chk=FALSE, checkable=TRUE, initial="auto", id.name="auto"){
attr.list <- list(label=label)
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.stretch.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.stretch.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.stretch.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -1,9 +1,37 @@
#' Create XML empty node "stretch" for RKWard plugins
#'
+#' The simplest way to use \code{rk.XML.stretch} is to call it without arguments.
+#' If you provide \code{before} and/or \code{after}, a "<stretch />" will be put between
+#' the XML elements defined there.
+#'
+#' @param before A list of objects of class \code{XiMpLe.node}.
+#' @param after A list of objects of class \code{XiMpLe.node}.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @examples
+#' cat(pasteXMLNode(rk.XML.stretch(), shine=1))
#<stretch />
-rk.XML.stretch <- function(){
- return(new("XiMpLe.node", name="stretch"))
+rk.XML.stretch <- function(before=NULL, after=NULL){
+ strch <- new("XiMpLe.node", name="stretch")
+
+ # if called without furter objects, just return the node
+ if(is.null(c(before, after))){
+ return(strch)
+ } else {}
+
+ if(!is.null(before)){
+ strch.lst <- child.list(before)
+ strch.lst[[length(strch.lst)+1]] <- strch
+ } else {
+ strch.lst <- list(strch)
+ }
+
+ if(!is.null(after)){
+ for(this.element in child.list(after)){
+ strch.lst[[length(strch.lst)+1]] <- this.element
+ }
+ } else {}
+
+ return(strch.lst)
}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.tabbook.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.tabbook.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.tabbook.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -10,6 +10,18 @@
#' If \code{NULL}, no IDs will be given.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @examples
+#' test.checkboxes <- rk.XML.row(rk.XML.col(
+#' list(
+#' rk.XML.cbox(label="foo", val="foo1", chk=TRUE),
+#' rk.XML.cbox(label="bar", val="bar2"))))
+#' test.dropdown <- rk.XML.dropdown("mydrop",
+#' opts=list("First Option"=c(val="val1"),
+#' "Second Option"=c(val="val2", chk=TRUE)))
+#' # combine the above into a tabbook
+#' test.tabbook <- rk.XML.tabbook("My Tabbook", tab.labels=c("First Tab",
+#' "Second Tab"), children=list(test.checkboxes, test.dropdown))
+#' cat(pasteXMLNode(test.tabbook, shine=1))
rk.XML.tabbook <- function(label, tab.labels, children=list(), id.name="auto"){
num.tabs <- length(tab.labels)
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.text.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.text.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.text.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -3,8 +3,10 @@
#' @param id.name Character string, a unique ID for this plugin element.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @examples
+#' test.text <- rk.XML.text("Added this text.")
+#' cat(pasteXMLNode(test.text, shine=1))
-#<text id="TTtext">The TreeTagger folder is the one containing the bin, cmd and lib folders</text>
rk.XML.text <- function(text, id.name=NULL){
if(!is.null(id.name)){
attr.list <- list(id=id.name)
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.vars.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.vars.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.vars.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -12,6 +12,9 @@
#' If \code{"auto"}, IDs will be generated automatically from \code{label} and \code{slot.text}.
#' @return An object of class \code{XiMpLe.node}.
#' @export
+#' @examples
+#' test.vars <- rk.XML.vars("Select some vars", "Vars go here")
+#' cat(pasteXMLNode(test.vars, shine=1))
rk.XML.vars <- function(label, slot.text=NULL, classes=NULL, horiz=TRUE, id.name="auto"){
if(identical(id.name, "auto")){
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -8,6 +8,8 @@
#' created plugin XML file as the dialog.
#' @param dial.require A character vector with names of R packages that the dialog requires.
#' @param overwrite Logical, whether existing files should be replaced. Defaults to \code{FALSE}.
+#' @param tests Logical, whether directories and files for plugin tests should be created.
+#' Defaults to \code{TRUE}.
#' @export
#' @examples
#' \dontrun{
@@ -60,7 +62,7 @@
#' about=about.info, dialog=test.tabbook, overwrite=TRUE)
#' }
-rk.plugin.skeleton <- function(name, path, about, dialog=list(), dial.require=c(), overwrite=FALSE){
+rk.plugin.skeleton <- function(name, path, about, dialog=list(), dial.require=c(), overwrite=FALSE, tests=TRUE){
# to besure, remove all non-character symbols from name
name.orig <- name
name <- gsub("[[:space:]]*[^[:alnum:]]*", "", name)
@@ -76,6 +78,9 @@
plugin.xml <- file.path(plugin.dir, paste(name, ".xml", sep=""))
plugin.js <- file.path(plugin.dir, paste(name, ".js", sep=""))
plugin.rkh <- file.path(plugin.dir, paste(name, ".rkh", sep=""))
+ tests.main.dir <- file.path(rkward.dir, "tests")
+ tests.dir <- file.path(rkward.dir, "tests", name)
+ testsuite.file <- file.path(tests.main.dir, "testsuite.R")
checkCreateFiles <- function(file.name, ow=overwrite){
if(all(file.exists(file.name), as.logical(ow)) | !file.exists(file.name)){
@@ -98,6 +103,10 @@
stopifnot(dir.create(plugin.dir, recursive=TRUE))
message(paste("Created directory ", plugin.dir, ".", sep=""))
} else {}
+ if(isTRUE(tests) & !file_test("-d", tests.dir)){
+ stopifnot(dir.create(tests.dir, recursive=TRUE))
+ message(paste("Created directory ", tests.dir, ".", sep=""))
+ } else {}
## create plugin.xml
if(isTRUE(checkCreateFiles(plugin.xml))){
@@ -135,6 +144,12 @@
cat(pasteXMLTree(XML.pluginmap), file=plugin.pluginmap)
} else {}
+ ## create testsuite.R
+ if(isTRUE(tests) & isTRUE(checkCreateFiles(testsuite.file))){
+ testsuite.doc <- rk.testsuite.doc(name=name)
+ cat(testsuite.doc, file=testsuite.file)
+ } else {}
+
# create DESCRIPTION file
if(isTRUE(checkCreateFiles(description.file))){
all.authors <- paste(
Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.testsuite.doc.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.testsuite.doc.R (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.testsuite.doc.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -0,0 +1,57 @@
+#' Create testsuite outline to test an RKWard plugin
+#'
+#' @param name A character string, name of the plugin/dialog.
+#' @return A character string.
+#' @export
+
+rk.testsuite.doc <- function(name=NULL){
+ suite.text <- paste("## definition of the test suite
+ suite <- new(\"RKTestSuite\",
+ id=\"", name ,"\",
+ ## needed packages
+ libraries = c(\"", name ,"\"),
+ ## initCalls are run *before* any tests. Use this to set up the environment
+ initCalls = list(
+ function(){
+ ## e.g. load needed packages
+ # require(\"package\")
+
+ ## or prepare needed data objects
+ # data(\"sampledata\")
+
+ ## or create needed objects
+ # object <- NULL
+ # assign(\"object.name\", object, envir=globalenv())
+
+ },
+ function(){
+ ## if some tests depend on results of earlier tests,
+ ## you can store those in a list in .GlobalEnv
+ # earlier.results <<- list()
+ }
+ ),
+ ## the tests
+ tests = list(
+ ## define the actual tests here
+ # new(\"RKTest\", id=\"\", call=function(){
+ # rk.call.plugin(\"rkward::...\", ..., submit.mode=\"submit\")
+ ## to store these results:
+ # earlier.results$this.result1 <<- this.result
+ # }),
+ # new(\"RKTest\", id=\"\", call=function(){
+ # rk.call.plugin(\"rkward::...\", ..., submit.mode=\"submit\")
+ ## to store these results:
+ # earlier.results$this.result2 <<- this.result
+ # })
+ ),
+ ## postCalls are like initCalls, but run after all tests to clean up.
+ postCalls = list(
+ function(){
+ ## e.g. remove created objects
+ # rm(list=c(\"earlier.results\"), envir=globalenv())
+ }
+ )
+ )", sep="")
+
+ return(suite.text)
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rkwarddev-package.R 2011-09-09 23:07:06 UTC (rev 3738)
@@ -4,7 +4,7 @@
#' Package: \tab rkwarddev\cr
#' Type: \tab Package\cr
#' Version: \tab 0.01-1\cr
-#' Date: \tab 2011-09-06\cr
+#' Date: \tab 2011-09-09\cr
#' Depends: \tab R (>= 2.9.0), XiMpLe\cr
#' Enhances: \tab rkward\cr
#' Encoding: \tab UTF-8\cr
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.browser.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.browser.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.browser.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -22,4 +22,8 @@
\description{
Create XML node "browser" for RKWard plugins
}
+\examples{
+test.browser <- rk.XML.browser("Browse here:")
+cat(pasteXMLNode(test.browser, shine=1))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.cbox.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.cbox.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.cbox.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -24,4 +24,11 @@
\description{
Create XML node "checkbox" for RKWard plugins
}
+\examples{
+test.checkboxes <- rk.XML.row(rk.XML.col(
+list(
+rk.XML.cbox(label="foo", val="foo1", chk=TRUE),
+rk.XML.cbox(label="bar", val="bar2"))))
+cat(pasteXMLNode(test.checkboxes, shine=1))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.col.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.col.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.col.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -17,4 +17,11 @@
\description{
Create XML node "column" for RKWard plugins
}
+\examples{
+test.checkboxes <- rk.XML.row(rk.XML.col(
+list(
+rk.XML.cbox(label="foo", val="foo1", chk=TRUE),
+rk.XML.cbox(label="bar", val="bar2"))))
+cat(pasteXMLNode(test.checkboxes, shine=1))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.dropdown.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.dropdown.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.dropdown.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -26,4 +26,10 @@
\description{
Create XML node "dropdown" for RKWard plugins
}
+\examples{
+test.dropdown <- rk.XML.dropdown("mydrop",
+opts=list("First Option"=c(val="val1"),
+"Second Option"=c(val="val2", chk=TRUE)))
+cat(pasteXMLNode(test.dropdown, shine=1))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.frame.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.frame.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.frame.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -23,4 +23,10 @@
\description{
Create XML node "column" for RKWard plugins
}
+\examples{
+test.dropdown <- rk.XML.dropdown("mydrop",
+opts=list("First Option"=c(val="val1"),
+"Second Option"=c(val="val2", chk=TRUE)))
+cat(pasteXMLNode(rk.XML.frame(test.dropdown, label="Some options"), shine=1))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.input.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.input.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.input.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -18,4 +18,8 @@
\description{
Create XML node "input" for RKWard plugins
}
+\examples{
+test.input <- rk.XML.input("Type some text")
+cat(pasteXMLNode(test.input, shine=1))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -38,4 +38,19 @@
\description{
Create XML document for RKWard plugins
}
+\examples{
+test.checkboxes <- rk.XML.row(rk.XML.col(
+list(
+rk.XML.cbox(label="foo", val="foo1", chk=TRUE),
+rk.XML.cbox(label="bar", val="bar2"))))
+test.dropdown <- rk.XML.dropdown("mydrop",
+opts=list("First Option"=c(val="val1"),
+"Second Option"=c(val="val2", chk=TRUE)))
+# combine the above into a tabbook
+test.tabbook <- rk.XML.tabbook("My Tabbook", tab.labels=c("First Tab",
+"Second Tab"), children=list(test.checkboxes, test.dropdown))
+# make a plugin with that tabbook
+test.plugin <- rk.XML.plugin("My test", label="Check this out", children=test.tabbook)
+cat(pasteXMLNode(test.plugin, shine=1))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.radio.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.radio.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.radio.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -26,4 +26,10 @@
\description{
Create XML node "radio" for RKWard plugins
}
+\examples{
+test.radio <- rk.XML.radio("Chose one",
+opts=list("First Option"=c(val="val1"),
+"Second Option"=c(val="val2", chk=TRUE)))
+cat(pasteXMLNode(test.radio, shine=1))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.row.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.row.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.row.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -17,4 +17,11 @@
\description{
Create XML node "row" for RKWard plugins
}
+\examples{
+test.checkboxes <- rk.XML.row(rk.XML.col(
+list(
+rk.XML.cbox(label="foo", val="foo1", chk=TRUE),
+rk.XML.cbox(label="bar", val="bar2"))))
+cat(pasteXMLNode(test.checkboxes, shine=1))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.saveobj.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.saveobj.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.saveobj.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -32,4 +32,8 @@
\description{
Create XML node "saveobject" for RKWard plugins
}
+\examples{
+test.saveobj <- rk.XML.saveobj("Save the results")
+cat(pasteXMLNode(test.saveobj, shine=1))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.stretch.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.stretch.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.stretch.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -1,10 +1,26 @@
\name{rk.XML.stretch}
\alias{rk.XML.stretch}
\title{Create XML empty node "stretch" for RKWard plugins}
+\usage{
+ rk.XML.stretch(before = NULL, after = NULL)
+}
+\arguments{
+ \item{before}{A list of objects of class
+ \code{XiMpLe.node}.}
+
+ \item{after}{A list of objects of class
+ \code{XiMpLe.node}.}
+}
\value{
An object of class \code{XiMpLe.node}.
}
\description{
- Create XML empty node "stretch" for RKWard plugins
+ The simplest way to use \code{rk.XML.stretch} is to call
+ it without arguments. If you provide \code{before} and/or
+ \code{after}, a "<stretch />" will be put between the XML
+ elements defined there.
}
+\examples{
+cat(pasteXMLNode(rk.XML.stretch(), shine=1))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.tabbook.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.tabbook.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.tabbook.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -29,4 +29,17 @@
\description{
Create XML node "tabbook" for RKWard plugins
}
+\examples{
+test.checkboxes <- rk.XML.row(rk.XML.col(
+list(
+rk.XML.cbox(label="foo", val="foo1", chk=TRUE),
+rk.XML.cbox(label="bar", val="bar2"))))
+test.dropdown <- rk.XML.dropdown("mydrop",
+opts=list("First Option"=c(val="val1"),
+"Second Option"=c(val="val2", chk=TRUE)))
+# combine the above into a tabbook
+test.tabbook <- rk.XML.tabbook("My Tabbook", tab.labels=c("First Tab",
+"Second Tab"), children=list(test.checkboxes, test.dropdown))
+cat(pasteXMLNode(test.tabbook, shine=1))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.text.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.text.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.text.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -14,4 +14,8 @@
\description{
Create XML node "text" for RKWard plugins
}
+\examples{
+test.text <- rk.XML.text("Added this text.")
+cat(pasteXMLNode(test.text, shine=1))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.vars.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.vars.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.vars.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -30,4 +30,8 @@
This function will create a <frame> node including a
<varselector> and a <varslot> node.
}
+\examples{
+test.vars <- rk.XML.vars("Select some vars", "Vars go here")
+cat(pasteXMLNode(test.vars, shine=1))
+}
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -3,7 +3,7 @@
\title{Create skeleton for RKWard plugins}
\usage{
rk.plugin.skeleton(name, path, about, dialog = list(),
- dial.require = c(), overwrite = FALSE)
+ dial.require = c(), overwrite = FALSE, tests = TRUE)
}
\arguments{
\item{name}{Character sting, name of the plugin package.}
@@ -25,6 +25,9 @@
\item{overwrite}{Logical, whether existing files should
be replaced. Defaults to \code{FALSE}.}
+
+ \item{tests}{Logical, whether directories and files for
+ plugin tests should be created. Defaults to \code{TRUE}.}
}
\description{
Create skeleton for RKWard plugins
Added: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.testsuite.doc.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.testsuite.doc.Rd (rev 0)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.testsuite.doc.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -0,0 +1,17 @@
+\name{rk.testsuite.doc}
+\alias{rk.testsuite.doc}
+\title{Create testsuite outline to test an RKWard plugin}
+\usage{
+ rk.testsuite.doc(name = NULL)
+}
+\arguments{
+ \item{name}{A character string, name of the
+ plugin/dialog.}
+}
+\value{
+ A character string.
+}
+\description{
+ Create testsuite outline to test an RKWard plugin
+}
+
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd 2011-09-09 18:35:26 UTC (rev 3737)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rkwarddev-package.Rd 2011-09-09 23:07:06 UTC (rev 3738)
@@ -10,7 +10,7 @@
\details{
\tabular{ll}{ Package: \tab rkwarddev\cr Type: \tab
Package\cr Version: \tab 0.01-1\cr Date: \tab
- 2011-09-06\cr Depends: \tab R (>= 2.9.0), XiMpLe\cr
+ 2011-09-09\cr Depends: \tab R (>= 2.9.0), XiMpLe\cr
Enhances: \tab rkward\cr Encoding: \tab UTF-8\cr License:
\tab GPL (>= 3)\cr LazyLoad: \tab yes\cr URL: \tab
http://rkward.sourceforge.net\cr }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list