#!/usr/bin/env sh

# Set up Rails app. Run this script immediately after cloning the codebase.
# https://github.com/thoughtbot/guides/tree/master/protocol

# Exit if any subcommand fails
set -e

# Set up Ruby dependencies via Bundler
gem install bundler --conservative
bundle check || bundle install

# Set up configurable environment variables
if [ ! -f .env ]; then
  cp .sample.env .env
fi

# Set up database and add any development seed data
bundle exec rake db:setup dev:prime

# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
mkdir -p .git/safe

# Pick a port for Foreman
if ! grep --quiet --no-messages --fixed-strings 'port' .foreman; then
  printf 'port: 3000\n' >> .foreman
fi

if ! command -v foreman > /dev/null; then
  printf 'Foreman is not installed.\n'
  printf 'See https://github.com/ddollar/foreman for install instructions.\n'
fi

# Only if this isn't CI
# if [ -z "$CI" ]; then
# fi

#!/usr/bin/env sh

# Set up Rails app. Run this script immediately after cloning the codebase.
# https://github.com/thoughtbot/guides/tree/master/protocol

# Exit if any subcommand fails
set -e

# Set up Ruby dependencies via Bundler
gem install bundler --conservative
bundle check || bundle install

# Set up configurable environment variables
if [ ! -f .env ]; then
  cp .sample.env .env
fi

# Set up database and add any development seed data
bundle exec rake db:setup dev:prime

# Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
mkdir -p .git/safe

# Pick a port for Foreman
if ! grep --quiet --no-messages --fixed-strings 'port' .foreman; then
  printf 'port: 3000\n' >> .foreman
fi

if ! command -v foreman > /dev/null; then
  gem install foreman
fi

# Only if this isn't CI
# if [ -z "$CI" ]; then
# fi

Install Foreman automatically in setup script
Install Foreman automatically in setup script

Why:

* Right now, the setup script informs you to install Foreman manually
  if is not already installed. Unfortunately, it's very easy to miss
  this message amid all of the other output when you're running the
  script for the first time.
* Foreman is a staple in our development toolkit, and not having it
  installed is frustrating for designers who aren't as familiar with
  Ruby as developers are. Having them ask developers for help every time
  this occurs isn't a long-term solution.

To satisfy the above:

* Just ensure that Foreman is installed.

[fixes #619]
