Sha256: 172980b4e9e1ab4ef919858e8aaac722d35431e7ae399dc10aef9353c3e7d247

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

#!/bin/bash

export CHECKOUT_DIR=`pwd`

if [ ! -e $CHECKOUT_DIR/.git ]; then
    echo "This script should run in the root of a Foreman git checkout"
    exit 1
fi

function usage {
    echo "USAGE: extras/ci/migration.sh (tag|SHA) point <end_point> "
    # This function should never be called when execution is meant to succeed.
    exit 1
}

if [ $# == 2 ]; then
    echo "Performing a single-step migration."
elif [ $# == 3 ]; then
    echo "Performing a point-to-point migration."
else
    usage
fi

case $1 in
SHA)
        echo "Checking out SHA $2"
        git checkout $2
        ;;
tag)
        echo "Checking out tag $2"
        git checkout $2
        ;;
*)
        usage
esac

if [ -e Gemfile.lock ]; then
    rm Gemfile.lock
fi

echo "Bundlizing..."
bundle install

echo "Dropping the database."
rake db:drop:all

echo "Creating the new database."
rake db:create

echo "Migrating..."
rake db:migrate

if [ $# == 3 ]; then
    echo "Updating to $3"
    git checkout $3

    echo "Updating bundled gems"
    bundle update

    echo "Migrating to the new revision"
    rake db:migrate
fi

echo "You've made it this far. Looks like things are operational..."

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/extras/ci/migration.sh
foreman_discovery-1.0.0.rc4 test/foreman_app/extras/ci/migration.sh
foreman_discovery-1.0.0.rc3 test/foreman_app/extras/ci/migration.sh
foreman_discovery-1.0.0.rc2 test/foreman_app/extras/ci/migration.sh
foreman_discovery-1.0.0.rc1 test/foreman_app/extras/ci/migration.sh