os:
  - linux
  - osx
sudo: false
language: cpp
addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
    packages:
      - g++-4.8
env:
  matrix:
    - TRAVIS_NODE_VERSION="0.10"
    - TRAVIS_NODE_VERSION="0.12"
    - TRAVIS_NODE_VERSION="2"
    - TRAVIS_NODE_VERSION="4"

install:
  - rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
  - if [[ $TRAVIS_OS_NAME == "linux" ]]; then export CXX=g++-4.8; fi
  - $CXX --version
  - PATH="`npm bin`:`npm bin -g`:$PATH"
  # Node 0.8 comes with a too obsolete npm
  - if [[ "`node --version`" =~ ^v0\.8\. ]]; then npm install -g npm@1.4.28 ; fi
  # Install dependencies and build
  - npm install

script:
  # Output useful info for debugging
  - node --version
  - npm --version
  # Run tests
  - node test/test.js
