~ubuntu-branches/ubuntu/wily/ess/wily

« back to all changes in this revision

Viewing changes to etc/ESSR/LOADREMOTE

  • Committer: Package Import Robot
  • Author(s): Dirk Eddelbuettel
  • Date: 2013-12-07 13:26:27 UTC
  • mto: This revision was merged to the branch mainline in revision 38.
  • Revision ID: package-import@ubuntu.com-20131207132627-mz1170cktcl0arck
Tags: upstream-13.09-1
ImportĀ upstreamĀ versionĀ 13.09-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## -*- mode: R -*-
 
2
## loading code which is first sent to R on remote sessions
 
3
local({
 
4
    curver <- '%s'
 
5
    ## MM: ok for Windows?
 
6
    ## VS: Should be fine (who is using win remote anyways?)
 
7
    .c.dir <- '~/.config/ESSR'
 
8
    verfile <- file.path(.c.dir, 'VERSION')
 
9
    envfile <- file.path(.c.dir, 'ESSR.rda')
 
10
    ver <- if(file.exists(verfile)) scan(verfile, what = "string") else "0.0"
 
11
    tryCatch({
 
12
        if(ver < curver) {
 
13
            url <- paste('http://vitalie.spinu.info/ESSR/ESSR_', curver, '.rda', sep = '')
 
14
            if(!file.exists(.c.dir))
 
15
                dir.create(.c.dir, recursive = TRUE)
 
16
            utils::download.file(url, envfile)
 
17
            cat(curver, file = verfile)
 
18
        }
 
19
        load(envfile)
 
20
        attach(ESSR)
 
21
        print(TRUE)
 
22
    } , error = function(e) print(FALSE))
 
23
})