4

My package is hosted in github, and user can install it through devtools::install_github.

Now I'm using pkgdown to generate documentation site, which created a 10M docs folder. Then I found devtools::install_github always download the whole master zip ball which become quite slow.

I tried to exclude the docs folder with these attempts:

  • .Rbuildignore, turned out it's only about bundled package, while install_github is installing source package so it doesn't work.
  • put package in pkg folder, put the generated docs folder out of pkg folder. However the whole master zip ball is always downloaded, even with subdir = "pkg" specified.
  • put development in a branch, and to create a special package branch without docs folder. Merge two branch but let package branch exclude docs folder. I tried make .gitignore to be branch specific but it doesn't seem to work. This seemed to be impossible.
  • My newest attempt is to create a separate repo solely for the website, just let pkgdown create the website in that folder like build_site(path = "../docsite/docs"). This should solve the problem and is simple and clean. The only imperfection is the website url will not be the usually pattern.

EDIT: with the latest version of pkgdown, there is no path parameter anymore, you need to specify it in the site configuration yaml, which works better (you don't need to specify it in every command).

6
  • 2
    Create a package, set up a (R package) repo at GitHub with drat, have users download from that (R package) repo. Else split your source repo and exclude those files. Clone will always fetch them. Jan 18, 2018 at 21:08
  • I took a brief look at drat. It seemed that greater control can be achieved with drat, though I'm afraid there will be a little bit learning cost for me, and I'm kind of spoiled by the devtools integration with rstudio for now. The 3 branches method (!) is working for me now. I may look at drat if some new problem arise and I have to control more details.
    – dracodoc
    Jan 18, 2018 at 21:21
  • I took some time to try drat because of some github install issues. Pros and cons for my user case: pros: more control, user can use regular R install methods; cons: need to build package, update the repo manually. Of course you can make a script for it, just need several clicks for every release.
    – dracodoc
    Mar 9, 2018 at 14:05
  • pkgdown to gh-pages branch
    – JohnCoene
    Apr 1, 2018 at 17:59
  • @JohnCoene, it's difficult to maintain two branches that hold different contents(one for code, one for doc site), when the doc branch actually need to be generated from code branch. And that was my 3rd attempt in post.
    – dracodoc
    Apr 2, 2018 at 15:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.