【发布时间】:2015-08-10 09:13:08
【问题描述】:
在编写/调试应用时,我需要快速测试页面。只是使用
install()
opencpu$browser("mypage.html")
还不够,因为页面似乎没有更新。
【问题讨论】:
在编写/调试应用时,我需要快速测试页面。只是使用
install()
opencpu$browser("mypage.html")
还不够,因为页面似乎没有更新。
【问题讨论】:
安装后确实需要重启服务器,否则页面可能不会更新。
我编写了以下函数,过去几个月我一直在愉快地使用它:
testApp <- function(page="",port="",pkg=gsub("^.*\\/","",getwd())){
require("opencpu")
require("devtools")
document();
# install the package
install();
# restart the server (or it will display cached things)
opencpu$stop();
if(port==""){
opencpu$start();
}else{
opencpu$start(port);
}
# visualize
opencpu$browse(paste0("/library/",pkg,"/www/",page));
}
然后你可以这样做:
testApp()
测试index.html或
testApp("mypage.html")
测试特定页面。
【讨论】: