Sha256: c1d8ff184ebb3d4b4088164bea5c2524ec02898ea9ad04f2d2af1940624b7062

Contents?: true

Size: 873 Bytes

Versions: 3

Compression:

Stored size: 873 Bytes

Contents

#!/usr/bin/env sh

_webtrap_has_compatible_ruby () {
  if ! type ruby > /dev/null 2>&1; then
    return 1
  fi

  local major_version=`ruby --version | cut -d\  -f2 | cut -dp -f1 | cut -d. -f1`

  [ "$major_version" -ge "2" ]
}

_webtrap_has_gem () {
  type gem > /dev/null 2>&1
}

_webtrap_has_bundler () {
  type bundler > /dev/null 2>&1
}

_webtrap_setup () {
  if ! _webtrap_has_compatible_ruby || ! _webtrap_has_gem; then
    echo '* Compatible Ruby environment not found' >&2
    echo 'WebTrap Setup error: this project requires MRI 2.0+ to be available.' >&2
    exit 1
  fi

  if ! _webtrap_has_bundler; then
    echo '* Bundler not found.'
    echo 'WebTrap Setup error: this project requires Bundler to be available.' >&2
    exit 2
  fi

  echo '* Checking dependencies'
  (bundle check || bundle install) > /dev/null

  echo '* All done'
}

_webtrap_setup "$@"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webtrap-0.1.1 bin/setup
webtrap-0.1.0 bin/setup
webtrap-0.0.1 bin/setup