language: r
cache: packages
dist: trusty
sudo: required
before_install:
  - sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable --yes
  - sudo add-apt-repository ppa:opencpu/jq --yes
  - sudo apt-get --yes --force-yes update -qq
  - sudo apt-get install --yes libudunits2-dev libproj-dev libgeos-dev libgdal-dev libv8-dev
  - sudo apt-get install --yes libjq-dev libprotobuf-dev libprotoc-dev protobuf-compiler r-cran-ncdf4
  
install:
  - R -e "install.packages('devtools')"
  - R -e "install.packages('spDataLarge', repos = 'https://nowosad.github.io/drat/', type = 'source')"
  - R -e "devtools::install_github('geocompr/geocompkg')"

script:
  - make html

after_success:
  - test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && bash deploy.sh

notifications:
  email:
    on_success: change
    on_failure: change
