Sha256: 1e57808d107fd0bc9ebaa50c93473bd96ecd8daca110be74a87cf9afcd611819

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

#!/bin/bash
if [[ "${@}" == "--init" ]]; then
  echo "doing a thing"
  # Add next? top of Gemfile
  cat <<-STRING > Gemfile.tmp
def next?
  File.basename(__FILE__) == "Gemfile.next"
end
STRING
  cat Gemfile >> Gemfile.tmp
  mv Gemfile.tmp Gemfile

  ln -s Gemfile Gemfile.next
  exit $?
fi

if [[ "${@}" =~ ^bundle ]]; then
  BUNDLE_GEMFILE=Gemfile.next BUNDLE_CACHE_PATH=vendor/cache.next $@
else
  BUNDLE_GEMFILE=Gemfile.next BUNDLE_CACHE_PATH=vendor/cache.next bundle exec $@
fi

COMMAND_EXIT=$?

GEM_NOT_FOUND=7 # https://github.com/bundler/bundler/blob/master/lib/bundler/errors.rb#L35
EXECUTABLE_NOT_FOUND=127 # https://github.com/bundler/bundler/blob/master/lib/bundler/cli/exec.rb#L62
if [[ $COMMAND_EXIT -eq $GEM_NOT_FOUND || $COMMAND_EXIT -eq $EXECUTABLE_NOT_FOUND ]]; then
  BLUE='\033[0;34m'
  UNDERLINE_WHITE='\033[37m'
  NO_COLOR='\033[0m'

  echo -e "${BLUE}Having trouble running commands with ${UNDERLINE_WHITE}bin/next${BLUE}?"
  echo -e "Try running ${UNDERLINE_WHITE}bin/next bundle install${BLUE}, then try your command again.${NO_COLOR}"
fi

exit $COMMAND_EXIT

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
ten_years_rails-0.2.0 exe/next.sh
ten_years_rails_conf_2018-0.1.0 exe/next.sh