- # if ! test -x /var/lib/gems/bin/bundler ; then
- # bundleversion=2.0.2
- # bundlergem=$(ls -r $GEM_HOME/cache/bundler-${bundleversion}.gem 2>/dev/null | head -n1 || true)
- # if test -n "$bundlergem" ; then
- # flock /var/lib/gems/gems.lock gem install --verbose --local --no-document $bundlergem
- # else
- # flock /var/lib/gems/gems.lock gem install --verbose --no-document bundler --version ${bundleversion}
- # fi
- # fi
- if ! flock /var/lib/gems/gems.lock bundler install --verbose --path $GEM_HOME --local --no-deployment $frozen "$@" ; then
- flock /var/lib/gems/gems.lock bundler install --verbose --path $GEM_HOME --no-deployment $frozen "$@"
+ BUNDLER=bundle
+ if test -x $PWD/bin/bundle ; then
+ # If present, use the one associated with rails workbench or API
+ BUNDLER=$PWD/bin/bundle
+ fi
+ if ! flock $GEMLOCK $BUNDLER install --verbose --local --no-deployment $frozen "$@" ; then
+ flock $GEMLOCK $BUNDLER install --verbose --no-deployment $frozen "$@"