summaryrefslogtreecommitdiff
path: root/bin/bootstrap
blob: 7278eee07cd85f7a13ff3ad4149437b5aab2abbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh

# bin/bootstrap: Resolve all dependencies that the application requires to run.
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

if [ -f ".ruby-version" ] && [ -z "$(rbenv version-name 2>/dev/null)" ]; then
  echo "==> Installing Ruby…"
  rbenv install --skip-existing
  command -v bundle >/dev/null 2>&1  || {
    gem install bundler
    rbenv rehash
  }
fi

if [ -f "Gemfile" ]; then
  echo "==> Installing gem dependencies…"
  bundle check --path vendor/bundle >/dev/null 2>&1 || {
    bundle install --path vendor/bundle --quiet
  }
fi