language: ruby
rvm: 2.1.5

before_install:
  # Set the database.
  - export DB=test
  # Set up a headless display so capybara will work.
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start

  # We need qt5 to make capybara-webkit work with React.
  # Copied from https://gist.github.com/jreese/6207161
  - sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa
  - sudo apt-get update -qq
  - sudo apt-get install -qq libqt5webkit5-dev qtdeclarative5-dev
  - export QMAKE=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake

  # pandoc for markdown->mediawiki
  - sudo apt-get install pandoc

  - npm install gulp -g
  - npm install bower -g
  - npm install
  - bower install
  - gulp build

before_script:
  # Set up our database.
  - mysql -e '''CREATE DATABASE test
                DEFAULT CHARACTER SET utf8
                DEFAULT COLLATE utf8_general_ci;'''
  - cp config/database.travis.yml config/database.yml
  - bundle exec rake db:migrate RAILS_ENV=test

language: ruby
rvm: 2.1.5

before_install:
  # Set the database.
  - export DB=test
  # Set up a headless display so capybara will work.
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start

  # We need qt5 to make capybara-webkit work with React.
  # Copied from https://gist.github.com/jreese/6207161
  - sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa
  - sudo apt-get update -qq
  - sudo apt-get install -qq libqt5webkit5-dev qtdeclarative5-dev
  - export QMAKE=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake

  # pandoc for markdown->mediawiki
  - sudo apt-get install pandoc

install:
  - npm install gulp -g
  - npm install bower -g
  - npm install
  - bower install
  - bundle install --jobs=3 --retry=3 --deployment
  - gulp build

before_script:
  # Set up our database.
  - mysql -e '''CREATE DATABASE test
                DEFAULT CHARACTER SET utf8
                DEFAULT COLLATE utf8_general_ci;'''
  - cp config/database.travis.yml config/database.yml
  - bundle exec rake db:migrate RAILS_ENV=test

Fix ordering of build steps
Fix ordering of build steps
