#!/bin/bash

# Fail fast (e) and echo commands (vx)
set -evx

echo --color > .rspec
echo -fp >> .rspec

sudo sed -i -e 's/^Defaults\tsecure_path.*$//' /etc/sudoers;
# If we have any args, just run the given command
if [ -n "$1" ]; then
  sudo -E $(which bundle) exec $@;
else
  sudo -E $(which bundle) exec rake spec;
  bundle exec rake style;
  bundle exec bundle-audit check --update;
fi
