language: python

branches:
  only:
    - master
    - next
    - /^dev\/.*$/

os:
  - linux
#  - osx

env:
  - VIM_VERSION=normal
  - VIM_VERSION=last
  - VIM_VERSION=neovim
  - VIM_VERSION=macvim

matrix:
  exclude:
    - os: osx
      env: VIM_VERSION=last
# neovim build fails with homebrew
# Error: undefined method `desc' for Neovim:Class
    - os: osx
      env: VIM_VERSION=neovim
    - os: linux
      env: VIM_VERSION=macvim

install:
  - if [ "$TRAVIS_OS_NAME" = 'osx' ]; then
      if [ "$VIM_VERSION" = 'neovim' ]; then
        brew tap neovim/neovim &&
        brew tap --repair &&
        brew install --HEAD neovim;
      elif [ "$VIM_VERSION" = 'macvim' ]; then
        brew install macvim;
      elif [ "$VIM_VERSION" = 'normal' ]; then
        echo "use normal vim";
      else
        echo "VIM_VERSION is not set";
        exit 1;
      fi
    elif [ "$TRAVIS_OS_NAME" = 'linux' ]; then
      if [ "$VIM_VERSION" = 'last' ]; then
        sudo add-apt-repository -y ppa:fcwu-tw/ppa &&
        sudo apt-get -qq update &&
        sudo apt-get -qq -f install &&
        sudo apt-get -qq install vim;
      elif [ "$VIM_VERSION" = 'neovim' ]; then
        sudo add-apt-repository -y ppa:neovim-ppa/unstable &&
        sudo apt-get -qq update &&
        sudo apt-get -qq -f install &&
        sudo apt-get -qq install neovim;
      elif [ "$VIM_VERSION" = 'normal' ]; then
        echo "use normal vim";
      else
        echo "VIM_VERSION is not set";
        exit 1;
      fi
    fi

before_script:
  - git clone https://github.com/jreybert/djooks "djooks with spaces"
  - git clone https://github.com/jreybert/vader.vim

script:
  - ./test/run.sh . vader.vim "djooks with spaces" $VIM_VERSION

after_success:
  - ./test/merge.sh

notifications:
  webhooks:
    urls:
      - https://webhooks.gitter.im/e/7c45628030298f184461
    on_success: change  # options: [always|never|change] default: always
    on_failure: always  # options: [always|never|change] default: always
    on_start:   never   # options: [always|never|change] default: always
