#!/bin/bash # TODO: Move the tidying up of sidekiq config file onto a function # TODO: Have the bundle install for dev- prefix argument before_commands () { if [ "$RAILS_ENV" = 'development' ]; then echo "App in development mode running bundle install and yarn install to update components" bundle install > /dev/null yarn install > /dev/null fi } set -e if [ "$1" = 'dev-server' ]; then before_commands exec rails s -b 0.0.0.0 -p 3000 elif [ "$1" = 'puma' ]; then before_commands exec bundle exec puma -C config/puma.rb elif [ "$1" = 'rails' ]; then echo "Rails command detected!" before_commands exec bundle exec "$@" elif [ "$1" = 'rake' ]; then echo "Rake command detected!" before_commands exec bundle exec "$@" else exec bundle exec puma -C config/puma.rb fi exec "$@"