Sha256: c7a3637b9f4459ca6953feef468ec4fef65ac1da0398cb56097dacd2d87fa274

Contents?: true

Size: 1.16 KB

Versions: 15

Compression:

Stored size: 1.16 KB

Contents

#!/usr/bin/env bash
#
# Updates the *.gemspec in the current directory to use the latest releases of gems
#
set -uf -o pipefail
IFS=$'\n'

gemspec=$(find . -type f -maxdepth 1 -name "*.gemspec")
if [ "${gemspec}" = "" ]; then
  exit 0
fi
add_dependency_lines=$(cat ${gemspec} | grep "s.add_[a-z_]*dependency '[^']*'")
if [ $? -ne 0 ]; then
  # No add_dependency_lines found - nothing to do
  exit 0
fi

set -e

gems=$(echo "${add_dependency_lines}" | tr -s ' ' | cut -d ' ' -f3 | cut -d"'" -f 2)
while read -r gem; do
  echo "upgrading ${gem}"
  if [ "${gem}" = "bundler" ]; then
    cat "${gemspec}" | sed "s/\(s.add_[a-z_]*dependency\) '${gem}'.*/\1 '${gem}', '>= 1.16.2'/" > ${gemspec}.tmp
  else
    gem_line=$(gem list "${gem}" --remote --all --no-prerelease | grep "^${gem}\s")
    latest_patch_version=$(echo "${gem_line}" | cut -d'(' -f2 | cut -d')' -f1 | cut -d',' -f1 | cut -d' ' -f1)
    latest_minor_version=$(echo "${latest_patch_version}" | cut -d. -f1,2)
    cat "${gemspec}" | sed "s/\(s.add_[a-z_]*dependency\) '${gem}'.*/\1 '${gem}', '~> ${latest_minor_version}', '>= ${latest_patch_version}'/" > ${gemspec}.tmp
  fi
  mv ${gemspec}.tmp ${gemspec}
done <<< "${gems}"

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
cucumber-cucumber-expressions-12.1.1 scripts/update-gemspec
cucumber-cucumber-expressions-12.1.0 scripts/update-gemspec
cucumber-cucumber-expressions-12.0.1 scripts/update-gemspec
cucumber-cucumber-expressions-12.0.0 scripts/update-gemspec
cucumber-cucumber-expressions-11.0.2 scripts/update-gemspec
cucumber-cucumber-expressions-11.0.1 scripts/update-gemspec
cucumber-cucumber-expressions-11.0.0 scripts/update-gemspec
cucumber-cucumber-expressions-10.3.0 scripts/update-gemspec
cucumber-cucumber-expressions-10.2.2 scripts/update-gemspec
cucumber-cucumber-expressions-10.2.1 scripts/update-gemspec
cucumber-cucumber-expressions-10.2.0 scripts/update-gemspec
cucumber-cucumber-expressions-10.1.0 scripts/update-gemspec
cucumber-cucumber-expressions-10.0.0 scripts/update-gemspec
cucumber-cucumber-expressions-9.0.0 scripts/update-gemspec
cucumber-cucumber-expressions-8.3.1 scripts/update-gemspec