[rkward-cvs] SF.net SVN: rkward:[3737] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Fri Sep 9 18:35:26 UTC 2011
Revision: 3737
http://rkward.svn.sourceforge.net/rkward/?rev=3737&view=rev
Author: tfry
Date: 2011-09-09 18:35:26 +0000 (Fri, 09 Sep 2011)
Log Message:
-----------
Cope with locked bindings and namespace issues in rkwardtests packages, too.
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R
trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rkwardtests-internal.R
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2011-09-09 10:01:00 UTC (rev 3736)
+++ trunk/rkward/ChangeLog 2011-09-09 18:35:26 UTC (rev 3737)
@@ -15,7 +15,7 @@
- Pareto-plot plugin gains more tabulation options TODO: also use in piechart, barplot
- rk.results() now prints rownames, where appropriate TODO: test
- "frame" elements in plugins can now be made checkable
-- Disabling or hiding a plugin component makes it non-required, implicitly TODO: remove explicit connections to component.required in the plugins.
+- Disabling or hiding a plugin component makes it non-required, implicitly
- Boxplot gains option to dogde grouped boxes TODO: add test; add colors?
- Simplify internal handling of system() and system2() output TODO: test on Windows!
- Simplify code produced by several plugins
Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R 2011-09-09 10:01:00 UTC (rev 3736)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/rk.print-functions.R 2011-09-09 18:35:26 UTC (rev 3737)
@@ -121,10 +121,13 @@
}
cat ("</ul>\n")
}
- if (level==1) cat (date ())
+ if (level==1) cat (.rk.date ())
cat ("<br />\n")
}
+# Dummy to allow the rkwardtest package to override rk.header() behavior, easily
+".rk.date" <- function () date ()
+
"rk.results" <- function (x, titles=NULL, print.rownames) {
sink (rk.get.output.html.file(), append=TRUE)
on.exit (sink ())
Modified: trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rkwardtests-internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rkwardtests-internal.R 2011-09-09 10:01:00 UTC (rev 3736)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwardtests/R/rkwardtests-internal.R 2011-09-09 18:35:26 UTC (rev 3737)
@@ -167,7 +167,15 @@
if (exists (backup.name, envir=.rktest.tmp.storage, inherits=FALSE)) {
message ("It looks like ", name, " has already been replaced. Not replacing it again.")
} else {
+# # Apparently R 2.14.x starts forcing namespaces for all packages, which makes things a bit more difficult
+ if (identical (envir, as.environment ("package:rkward"))) {
+ try (rktest.replace (name, replacement, asNamespace ("rkward"), backup.name))
+ }
+
assign (backup.name, get (name, envir), envir=.rktest.tmp.storage)
+
+ environment (replacement) <- envir
+ try (unlockBinding (name, envir))
assign (name, replacement, envir)
}
}
@@ -175,6 +183,9 @@
rktest.restore <- function (name, envir=as.environment ("package:rkward"), backup.name=name) {
if (exists (backup.name, envir=.rktest.tmp.storage, inherits=FALSE)) {
assign (name, get (backup.name, envir=.rktest.tmp.storage), envir=envir)
+ if (identical (envir, as.environment ("package:rkward"))) {
+ try (assign (name, get (backup.name, envir=.rktest.tmp.storage), envir=asNamespace ("rkward")))
+ }
} else {
message ("No backup available for ", name, ". Already restored?")
}
@@ -195,9 +206,7 @@
options (rk.graphics.type="PNG", rk.graphics.width=480, rk.graphics.height=480)
# HACK: Override date, so we don't get a difference for each call of rk.header ()
- # TODO: implement a clean solution inside rk.header()
- # Note: date is in baseenv() and we cannot easily replace it there, so placing an override in globalenv(), instead
- assign ("date", function () return ("DATE"), envir=globalenv())
+ rktest.replace (".rk.date", function () return ("DATE"))
# numerical precision is often a problem. To work around this in many places, reduce default printed precision to 5 digits
options (digits=5)
@@ -223,7 +232,7 @@
rktest.restore (".rk.make.hr")
rktest.restore ("rk.get.tempfile.name")
rktest.restore ("rk.set.output.html.file")
- rm (date, envir=globalenv())
+ rktest.restore (".rk.date")
assign("initialized", FALSE, envir=.rktest.tmp.storage)
}
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