CredibilityLab / groundhog

Reproducible R Scripts Via Date Controlled Installing & Loading of CRAN & Git Packages
https://groundhogr.com/
GNU General Public License v3.0
78 stars 4 forks source link

Repeated downloads of cran.toc.rds across multiple folders #31

Closed urisohn closed 4 years ago

urisohn commented 4 years ago

Seems like when groundhogR is installed, the file cran.toc.rds is saved to the same folder where it is installed. So say you install it with R3.6.3, cran.toc.rds is saved to ~/R/win-library/3.6 and if you then install it with R3.4.1 the database is saved again. But then it is also saved in the Groundhog flder ~/groundhogR/

I think we should try to only put it in the latter.

Is the (only) solution to not include cran.toc.rds within the package?

But come to think of it, are those files even being used at all? (the ones in the /R/win-library/* folders

Bisaloo commented 4 years ago

Is the (only) solution to not include cran.toc.rds within the package?

If you think this is an issue, then yes, the only solution is to not include these files. Packages are not allowed to copy/create files outside of their install folder.

But come to think of it, are those files even being used at all?

Yes, they are used by default unless:

I think it's good to have these files bundled with the package because they provide a useful fallback in case https://groundhogr.com/ is temporarily unreachable / blocked by a firewall / whatever.

urisohn commented 4 years ago

OK, so in load.cran.toc() these line 36-41

TOC

if (file.exists(toc.path)) {
  cran.toc <- readRDS(toc.path)
} else {
  cran.toc <- readRDS(system.file("cran.toc.rds", package = "groundhogR"))
}

the first attempt is within the groundhogR general folder. If not fond there, it looks for it in the system.file() which will be,say, C:\Users\UWS\Documents\R\win-library\4.0\groundhogR\cran.times.rds

If i am getting this right, it's OK with me.

Bisaloo commented 4 years ago

yes, exactly