Sha256: 60b2394169f2a67605200d5d900cae4f86ab2bf9a0fb6c4f259378e69df2dddb

Contents?: true

Size: 1.24 KB

Versions: 16

Compression:

Stored size: 1.24 KB

Contents

#!/usr/bin/env bash
# Usage: cached-bundle install --deployment
#
# After running `bundle`, caches the `vendor/bundle` directory to S3.
# On the next run, restores the cached directory before running `bundle`.
# When `Gemfile.lock` changes, the cache gets rebuilt.
#
# Requirements:
# - Gemfile.lock
# - TRAVIS_REPO_SLUG
# - TRAVIS_RUBY_VERSION
# - AMAZON_S3_BUCKET
# - script/s3-put
# - bundle
# - curl
#
# Author: Mislav Marohnić

set -e

compute_md5() {
  local output="$(openssl md5)"
  echo "${output##* }"
}

download() {
  curl --tcp-nodelay -qsfL "$1" -o "$2"
}


gemfile="${BUNDLE_GEMFILE:-Gemfile}"
bundle_fullpath="$(dirname $gemfile)/vendor/bundle"
bundle_path=${bundle_fullpath#$PWD/}
gemfile_hash="$(compute_md5 <"${gemfile}.lock")"
cache_name="${TRAVIS_RUBY_VERSION}-${gemfile_hash}.tgz"
fetch_url="http://${AMAZON_S3_BUCKET}.s3.amazonaws.com/${TRAVIS_REPO_SLUG}/${cache_name}"

if download "$fetch_url" "$cache_name"; then
  echo "Reusing cached bundle ${cache_name}"
  tar xzf "$cache_name"
fi

bundle "$@"

if [ ! -f "$cache_name" ] && [ -n "$AMAZON_SECRET_ACCESS_KEY" ]; then
  echo "Caching \`${bundle_path}' to S3"
  tar czf "$cache_name" "$bundle_path"
  script/s3-put "$cache_name" "${AMAZON_S3_BUCKET}:${TRAVIS_REPO_SLUG}/${cache_name}"
fi

Version data entries

16 entries across 16 versions & 4 rubygems

Version Path
devise-3.5.10 script/cached-bundle
devise-3.5.9 script/cached-bundle
devise-3.5.8 script/cached-bundle
devise-3.5.7 script/cached-bundle
devise-3.5.6 script/cached-bundle
devise-3.5.5 script/cached-bundle
devise-3.5.4 script/cached-bundle
devise-3.5.3 script/cached-bundle
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/devise-3.5.2/script/cached-bundle
devise-3.5.2 script/cached-bundle
devise-3.5.1 script/cached-bundle
deviseOne-1.0.0 script/cached-bundle
devise-3.4.1 script/cached-bundle
devise-3.4.0 script/cached-bundle
brainsome_devise-3.3.0 script/cached-bundle
devise-3.3.0 script/cached-bundle