branches:
  only:
    - master

language: python

python:
  - 2.6
  - 2.7

env:
  - REQUIREMENTS=1.3.X           TESTS="mutant boolean datetime file numeric related text web" SETTINGS=test_project.settings
  - REQUIREMENTS=1.3.X-postgres  TESTS="mutant boolean datetime file numeric related text web" SETTINGS=travis.postgres_settings TEMPLATE=template0
  - REQUIREMENTS=stable          TESTS="mutant boolean datetime file numeric related text web" SETTINGS=test_project.settings
  - REQUIREMENTS=stable-postgres TESTS="mutant boolean datetime file numeric related text web" SETTINGS=travis.postgres_settings TEMPLATE=template0
  - REQUIREMENTS=trunk           TESTS="mutant boolean datetime file numeric related text web" SETTINGS=test_project.settings
  - REQUIREMENTS=trunk-postgres  TESTS="mutant boolean datetime file numeric related text web" SETTINGS=travis.postgres_settings TEMPLATE=template0
  - REQUIREMENTS=mongo           TESTS="mutant boolean datetime file numeric nonrel text web"  SETTINGS=mongodb_settings

postgres:
  adapter: postgresql
  database: mutant
  username: postgres

install:
  - python setup.py install
  - pip install -r requirements/$REQUIREMENTS.txt --use-mirrors -I

before_script:
  - "if echo $REQUIREMENTS | grep 'postgres'; then psql -c 'CREATE DATABASE mutant TEMPLATE $TEMPLATE;' -U postgres; fi"

script:
  - cd tests
  - python manage.py test $TESTS --settings=$SETTINGS

branches:
  only:
    - master

language: python

python:
  - 2.6
  - 2.7

env:
  - REQUIREMENTS=1.3.X           TESTS="mutant boolean datetime file numeric related text web" SETTINGS=test_project.settings
  - REQUIREMENTS=1.3.X-postgres  TESTS="mutant boolean datetime file numeric related text web" SETTINGS=travis.postgres_settings TEMPLATE=template0
  - REQUIREMENTS=stable          TESTS="mutant boolean datetime file numeric related text web" SETTINGS=test_project.settings
  - REQUIREMENTS=stable-postgres TESTS="mutant boolean datetime file numeric related text web" SETTINGS=travis.postgres_settings TEMPLATE=template0
  - REQUIREMENTS=trunk           TESTS="mutant boolean datetime file numeric related text web" SETTINGS=test_project.settings
  - REQUIREMENTS=trunk-postgres  TESTS="mutant boolean datetime file numeric related text web" SETTINGS=travis.postgres_settings TEMPLATE=template0
  - REQUIREMENTS=mongo           TESTS="mutant boolean datetime file numeric nonrel text web"  SETTINGS=mongodb_settings

postgres:
  adapter: postgresql
  database: mutant
  username: postgres

install:
  - python setup.py install
  - pip install -r requirements/$REQUIREMENTS.txt --use-mirrors -I

before_script:
  - "if echo $REQUIREMENTS | grep 'postgres'; then psql -c \"CREATE DATABASE mutant TEMPLATE ${TEMPLATE};\" -U postgres; fi"

script:
  - cd tests
  - python manage.py test $TESTS --settings=$SETTINGS

Make sure the TEMPLATE env variable is correctly interpolated into the postgresql CREATE DATABASE command
Make sure the TEMPLATE env variable is correctly interpolated into the postgresql CREATE DATABASE command
