Sha256: e421850b4a294cdb866a0b28549e78566148e31d3ff4edf2c7ce4d3a440b59ee

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

#!/bin/bash
DOCKER_SOCK="/var/run/docker.sock:/var/run/docker.sock"
RVM_COMMAND="source /usr/local/rvm/scripts/rvm"
ERROR="Please specify a command e.g. ./minke.sh rake app:test"
COMMAND=""
NEW_UUID=$(base64 /dev/urandom | tr -d '/+' | head -c 32 | tr '[:upper:]' '[:lower:]')
NETWORK
GEMSET='minkegems'
GEMSETFOLDER="/usr/local/rvm/gems/ruby-2.3.1@${GEMSET}"

if [ "$1" == '' ]; then
  echo $ERROR;
  exit 1;
fi

COMMAND=$*

if [[ $1 == \ -g* ]]; then
  echo "Generating new template"
  DIR=${PWD}
  DOCKER_RUN="docker run --rm -v ${DOCKER_SOCK} -v ${DIR}:${DIR} -v ${DIR}/_build/vendor/gems:${GEMSETFOLDER} -e DOCKER_NETWORK=minke_${NEW_UUID} -w ${DIR} nicholasjackson/minke /bin/bash -c '${RVM_COMMAND} && bundle install && minke ${COMMAND}'"
  eval "${DOCKER_RUN}"
fi

if [[ $1 != \ -g* ]]; then
  DIR=$(dirname `pwd`)
  DOCKER_RUN="docker run --rm --net=minke_${NEW_UUID} -v ${DOCKER_SOCK} -v ${DIR}:${DIR} -v ${DIR}/_build/vendor/gems:${GEMSETFOLDER} -e DOCKER_NETWORK=minke_${NEW_UUID} -w ${DIR}/_build nicholasjackson/minke /bin/bash -c '${RVM_COMMAND} && ${COMMAND}'"

  echo "Running command: ${COMMAND}"

  eval "docker network create minke_${NEW_UUID}"
  eval "${DOCKER_RUN}"
  eval "docker network rm minke_${NEW_UUID}"
fi

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
minke-1.12.0 lib/minke/scripts/minke.sh
minke-1.11.9 lib/minke/scripts/minke.sh
minke-1.11.8 lib/minke/scripts/minke.sh