knitr::opts_chunk$set(echo = TRUE)
satrdays.org = Domain
captetown.satrdays.org = Subdomain
satrdays.org/satRdays-devsite = Directory
A project with your username that serves as the entrypoint to all your github hosted stuff
There are other alternative CI systems, esp. if you need to work with private repos
Your .travis.yml
language: r
There are triggers which allow you perform actions at different points in the process. Can run any bash command here, including calling R!
after_success:
- R CMD build .
- chmod 755 .push_gh_pages.sh
- ./.push_gh_pages.sh
#!/bin/bash GH_REPO="@github.com/$TRAVIS_REPO_SLUG.git" FULL_REPO="https://$GH_TOKEN$GH_REPO" git config --global user.name "stephs-travis" git config --global user.email "steph@travis.ci" for files in '*.tar.gz'; do tar xfz $files done git clone $FULL_REPO out --branch gh-pages for files in 'inst/doc/*.html'; do cp $files out done cd out git add . git commit -m "$TRAVIS_COMMIT" git push --quiet $FULL_REPO
A package to generate package websites!
library(rmarkdown) reports <- list.files( "inst/reports", pattern = "*.Rmd" , recursive = TRUE ,full.names = TRUE ``) for (f in reports) render(f,output_dir = "out" ,output_format = html_document()) render("inst/index.Rmd", output_dir = "out" ,intermediates_dir = "out")
#!/bin/bash FULL_REPO="https://$GH_TOKEN$@github.com/$TRAVIS_REPO_SLUG.git" git clone $FULL_REPO out --branch gh-pages cd out git config user.name "stephs-travis" git config user.email "steph@travis.ci" cd .. R CMD BATCH '../Rtraining/ghgenerate.R' cp ghgenerate.Rout out cd out git add . git commit -m "$TRAVIS_COMMIT" git push --quiet $FULL_REPO
Using revealjs, produce HTML sliides like these!
There are others coming along like xaringan too
library(rmarkdown) reports <- list.files( "inst/slidedecks", pattern = "*.Rmd" , recursive = TRUE ,full.names = TRUE ``) for (f in slidedecks) render(f,output_dir = "out" ,output_format = stephStyle::stephRevealSlideStyle()) render("inst/index.Rmd", output_dir = "out" ,intermediates_dir = "out")
MeetingsR is a neat example of a project using bookdown.
Get in-depth with Yi Hui's book bookdown: Authoring Books and Technical Documents with R Markdown
language: r cache: packages script: - make html after_success: - test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && bash deploy.sh
html: Rscript -e 'bookdown::render_book("index.Rmd", output_format = "bookdown::gitbook", clean = FALSE)' cp -fvr css/style.css _book/ cp -fvr _main.utf8.md _book/main.md build: make html Rscript -e 'browseURL("_book/index.html")'
#!/bin/bash FULL_REPO="https://$GH_TOKEN$@github.com/$TRAVIS_REPO_SLUG.git" git clone $FULL_REPO book-output cd book-output git config user.name "stephs-travis" git config user.email "steph@travis.ci" cp -fvr ../_book/* docs/ cd docs git add libs/; git add css/ git add *.json; git add *.html; git add main.md; git add style.css cd .. git commit -am "Travis: updating website (${TRAVIS_BUILD_NUMBER})" git push origin master 2>err.txt
Uses Hugo (which I love) to build a static blog site with Rmarkdown posts
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.