sudo: required
dist: trusty

# install the pre-release chef-dk.  Use chef-stable-precise to install the stable release
addons:
  apt:
    sources:
      - chef-current-precise
    packages:
      - chefdk

branches:
  only:
  - master

services: docker

env:
  global:
    # Ignore warnings when running specs.
    - RUBYOPT="-W0"
  matrix:
    - CHEF_VERSION=latest


  fast_finish: true

before_script:
  - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
  - eval "$(/opt/chefdk/bin/chef shell-init bash)"
  - /opt/chefdk/embedded/bin/chef gem install kitchen-docker

script:
  - /opt/chefdk/embedded/bin/chef --version
  - /opt/chefdk/embedded/bin/cookstyle --version
  - /opt/chefdk/embedded/bin/cookstyle
  - /opt/chefdk/embedded/bin/foodcritic --version
  - /opt/chefdk/embedded/bin/foodcritic . --exclude spec -f any
  - /opt/chefdk/embedded/bin/rspec
  - KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify smoke-war-stable-ubuntu-docker

sudo: required
dist: trusty

# install the pre-release chef-dk.  Use chef-stable-precise to install the stable release
addons:
  apt:
    sources:
      - chef-current-trusty
    packages:
      - chefdk

# Don't `bundle install` which takes about 1.5 mins
install: echo "skip bundle install"

branches:
  only:
    - master

services: docker

env:
  matrix:
    - CHEF_VERSION=latest

before_script:
  - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
  - eval "$(/opt/chefdk/bin/chef shell-init bash)"
  - /opt/chefdk/embedded/bin/chef gem install kitchen-docker

script:
  - /opt/chefdk/embedded/bin/chef --version
  - /opt/chefdk/embedded/bin/cookstyle --version
  - /opt/chefdk/embedded/bin/foodcritic --version
  - /opt/chefdk/embedded/bin/rake
  - KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify smoke-war-stable-ubuntu-docker

Use rake for lint/unit in Travis
Use rake for lint/unit in Travis

Also:
-remove fast finish since it doesn't make sense unless you have allowed failure tests
-don't bundle install since we're testing via DK
-remove the line to avoid warnings in the specs. We'll do this the right way later on

Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
