Sha256: 6f9acbdbbbfbe8337b524a44863c27fe211fa917d7fddcfffa17d368d7646e7e

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

#!/bin/bash -e

#This script is used during the release process. It is not intended to be ran manually.

VERSION="$1"
VERSION="${VERSION:?"must provide version as first parameter"}"
SCRIPT_DIR="$(cd "$(dirname "$0")"; pwd)"

updateVersion(){
    updateGemspec
    updateLockfile
    commitStagedFiles "Update version to ${VERSION}"
}

updateGemspec(){
    echo -e "\nUpdating gemspec version"
    local gemspecPath="${SCRIPT_DIR}/logatron.gemspec"
    sed -i 's/\(\.version\s*=\s*\).*/\1'"'${VERSION}'/" "${gemspecPath}"
    stageFiles "${gemspecPath}"
}

updateLockfile(){
    echo -e "\nUpdating lockfile"
    bundle package --no-install > /dev/null
    rm -rf .bundle/ vendor/
    stageFiles "${SCRIPT_DIR}/Gemfile.lock"
}

stageAndCommit(){
    local msg="$1"
    shift
    local files=( "$@" )
    stageFiles "${files[@]}"
    commitStagedFiles "${msg}"
}

stageFiles(){
    local files=( "$@" )
    git add "${files[@]}"
}

commitStagedFiles(){
    local msg="$1"
    if thereAreStagedFiles; then
        git commit -m "${msg}"
    else
        echo "No changes to commit"
    fi
}

thereAreStagedFiles(){
    git update-index -q --ignore-submodules --refresh
    if git diff-index --cached --quiet HEAD --ignore-submodules -- ; then
        return 1;
    else
        return 0;
    fi
}

updateVersion

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
logatron-0.7.0 update_version.sh
logatron-0.6.0 update_version.sh
logatron-0.5.0 update_version.sh
logatron-0.3.0 update_version.sh