JGCRI / fldgen

Given a global mean temperature pathway, generate random global climate fields consistent with it and with spatial and temporal correlation derived from an ESM
https://jgcri.github.io/fldgen/
GNU General Public License v2.0
12 stars 6 forks source link

Add package down to fldgen #38

Closed kdorheim closed 4 years ago

kdorheim commented 4 years ago

Consolidate the documentation and make it reproducible using https://pkgdown.r-lib.org/articles/pkgdown.html

kdorheim commented 4 years ago

The documentation has been consolidated on the gh-pages branch!

So it turns out that adding the docs file to the master branch while easy to do can increase the size of the repo. There is a work around however it is some what convoluted. Instead of the regular pkgdown::build_site() you will need to use the deploy_to_branch() see https://pkgdown.r-lib.org/reference/deploy_to_branch.html. I ran into a lot of issues with git hub permissions and ended up using something like as recommend by Alexey.

The ability to run the following from command line depends on having pandoc installed.

# Create gh-pages branch
git checkout --orphan gh-pages
# Make sure this works before running next command!
git rm -rf .
git commit --allow-empty -m "Initialize gh-pages"
git push -u origin gh-pages
# Create a new worktree
git worktree add ../fldgen-pkgdown gh-pages
# Launch R
R
# From R, run pkgdown
library(pkgdown)
pkg <- as_pkgdown(".", override = list(destination = "../fldgen-pkgdown"))
build_site(pkg, devel = FALSE, preview = FALSE, install = FALSE)
quit()
# Back to command line
cd ../fldgen-pkgdown
git push