#!/bin/sh

set -e

cd "$(dirname "$0")/.."

if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
  brew bundle check >/dev/null 2>&1  || {
    echo "==> Installing Homebrew dependencies…"
    brew bundle
  }
fi

bundle config --local path vendor/gems

bundle check > /dev/null 2>&1 || bundle install

echo "==> Initialising submodules…"
git submodule init
git submodule sync --quiet
script/fast-submodule-update

echo "==> Generating samples…"
bundle exec rake samples > /dev/null 2>&1
