container.sh 537 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. set -e
  3. dir="$(mktemp -d)"
  4. trap "rm -rf '$dir'" EXIT
  5. cp Gemfile "$dir"
  6. # make sure that running "bundle" twice doesn't change Gemfile.lock the second time
  7. cd "$dir"
  8. BUNDLE_FROZEN=0 bundle install
  9. cp Gemfile.lock Gemfile.lock.orig
  10. BUNDLE_FROZEN=1 bundle install
  11. diff -u Gemfile.lock.orig Gemfile.lock >&2
  12. if ruby -rbundler -e 'exit Gem::Version.new(Bundler::VERSION) >= Gem::Version.new("2.1") ? 0 : 1'; then
  13. BUNDLE_DEPLOYMENT=1 bundle install
  14. else
  15. bundle install --deployment
  16. fi
  17. diff -u Gemfile.lock.orig Gemfile.lock >&2