language: erlang

env:
  matrix:
    - LUA=lua5.1 LUA_INCDIR=/usr/include/lua5.1
    - LUA=lua5.2 LUA_INCDIR=/usr/include/lua5.2
    - LUA=luajit-2.0.0-beta9 LUA_INCDIR=/usr/include/luajit-2.0

branches:
  only:
    - master

before_install:
  - sudo apt-get install lua5.1
  - sudo apt-get install lua5.2
  - sudo apt-get install luajit
  - sudo apt-get install luarocks
  - sudo pip install cpp-coveralls
  - sudo luarocks install luacov-coveralls --server=http://rocks.moonscript.org/dev

script: 
  - $LUA dummy_test.lua

after_success:
  - coveralls -b .. -r .. --dump c.report.json
  - luacov-coveralls -j c.report.json

notifications:
  email:
    on_success: change
    on_failure: always

language: erlang

env:
  global:
    - LUAROCKS_BASE=luarocks-2.1.0
  matrix:
    - LUA=lua5.1 LUA_DEV=liblua5.1-dev LUA_VER=5.1 LUA_SFX=5.1 LUA_INCDIR=/usr/include/lua5.1
    - LUA=lua5.2 LUA_DEV=liblua5.2-dev LUA_VER=5.2 LUA_SFX=5.2 LUA_INCDIR=/usr/include/lua5.2
    - LUA=luajit LUA_DEV=libluajit-5.1-dev LUA_VER=5.1 LUA_SFX=jit LUA_INCDIR=/usr/include/luajit-2.0

branches:
  only:
    - master

before_install:
  - if [ $LUA = "luajit" ]; then
      sudo add-apt-repository ppa:mwild1/ppa -y && sudo apt-get update -y;
    fi
  - sudo apt-get install $LUA
  - sudo apt-get install $LUA_DEV
  - lua$LUA_SFX -v
  # Install a recent luarocks release
  - wget http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz
  - tar zxvpf $LUAROCKS_BASE.tar.gz
  - cd $LUAROCKS_BASE
  - ./configure
    --lua-version=$LUA_VER --lua-suffix=$LUA_SFX --with-lua-include="$LUA_INCDIR"
  - make build
  - sudo make install
  - cd $TRAVIS_BUILD_DIR
  - luarocks --version
  - sudo luarocks install luacov-coveralls --server=http://rocks.moonscript.org/dev

script: 
  - lua$LUA_SFX -lluacov dummy_test.lua

after_success:
  - luacov-coveralls 

notifications:
  email:
    on_success: change
    on_failure: always

Install recent luarocks and only one Lua
Install recent luarocks and only one Lua