#!/bin/bash -e
#
# script/bootstrap
# mas
#
# Installs development dependencies and builds project dependencies.
#

main() {
  script/clean

  echo "==> 👢 Bootstrapping"

  # Install Ruby tools
  bundle install

  # Install Homebrew tools
  rm -f Brewfile.lock.json
  brew bundle install --no-upgrade --verbose

  if [[ "CI" != "true" ]]; then
    # Already installed on GitHub Actions runner.
    if ! command -v swiftlint >/dev/null; then
      brew install swiftlint
    fi
  fi

  # Generate Package.swift
  script/version
}

main
