Skip to content

Commit

Permalink
move sshfs from the R script to Rakefile; in the R script I only need…
Browse files Browse the repository at this point in the history
… to check the mode of figure/ -- if it is 2755, it means I have mounted the r-forge drive
  • Loading branch information
yihui committed Mar 27, 2013
1 parent 9c5d124 commit 0e14b6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ end # task :preview
# Usage: rake knit
desc "Knit all Rmd files for the server"
task :knit do
# if figure/ is empty, mount the r-forge dir
system '[ "$(ls -A figure)" ] || sshfs [email protected]:/srv/gforge/chroot/home/groups/isu/htdocs/vistat figure'
system "find ./_source -type f -iname *.Rmd | xargs -n1 -P4 ./_bin/knit"
end # task :knit

Expand Down
6 changes: 1 addition & 5 deletions _bin/knit
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ invisible(local({
# http://dl.dropbox.com/u/15335397/vistat/ but the problem is that animations
# do not work well under Google Chrome for some reason (SciAnimator keeps on
# fetching images from Dropbox)
opts_knit$set(base.url = if (Sys.getenv('USER') != 'yihui') '/figure/' else {
# mount my R-Forge dir to the local figure dir
if (as.character(file.info('figure/')[, 'mode']) != '2755') {
stopifnot(system('sshfs [email protected]:/srv/gforge/chroot/home/groups/isu/htdocs/vistat figure') == 0L)
}
opts_knit$set(base.url = if (as.character(file.info('figure/')[, 'mode']) != '2755') '/figure/' else {
'http://isu.r-forge.r-project.org/vistat/'
})
knit(f, paste('_posts/', base, '.md', sep = ''), envir = globalenv())
Expand Down

0 comments on commit 0e14b6c

Please sign in to comment.