#!/usr/bin/env bash # Copyright (c) 2026 Egor Tensin # This file is part of the "My blog" project. # For details, see https://github.com/egor-tensin/blog # Distributed under the MIT License. set -o errexit -o nounset -o pipefail shopt -s inherit_errexit lastpipe script_dir="$( dirname -- "${BASH_SOURCE[0]}" )" script_dir="$( cd -- "$script_dir" && pwd )" readonly script_dir update_gems() { echo echo ====================================================================== echo Updating gems echo ====================================================================== bundle config set frozen false bundle update echo ---------------------------------------------------------------------- } push_changes() { echo echo ====================================================================== echo Pushing changes echo ====================================================================== local git_status git_status="$( git status --porcelain=v1 )" if [ -z "$git_status" ]; then echo 'No changes.' echo ---------------------------------------------------------------------- return fi if [ "$git_status" != ' M Gemfile.lock' ]; then echo 'Error: unrecognized modifications in the repository:' echo "$git_status" echo ---------------------------------------------------------------------- return 1 fi git commit -am 'bump dependencies' git push -q echo ---------------------------------------------------------------------- } main() { cd -- "$script_dir/.." update_gems push_changes } main