From df818f5881d668e00d1e3455224b605ed1f8e4b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aslak=20Helles=C3=B8y?= Date: Thu, 15 Aug 2019 15:06:38 +0100 Subject: [PATCH] Upgrade to gherkin 7 --- cucumber-wire.gemspec | 4 ++-- scripts/update-gemspec | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100755 scripts/update-gemspec diff --git a/cucumber-wire.gemspec b/cucumber-wire.gemspec index dcbe5c7..18095a3 100644 --- a/cucumber-wire.gemspec +++ b/cucumber-wire.gemspec @@ -13,8 +13,8 @@ Gem::Specification.new do |s| s.license = 'MIT' s.required_ruby_version = '>= 2.3' - s.add_dependency 'cucumber-core', '~> 4.0' - s.add_dependency 'cucumber-expressions', '~> 7.0' + s.add_dependency 'cucumber-core', '~> 5.0', '>= 5.0.0' + s.add_dependency 'cucumber-expressions', '~> 8.0', '>= 8.0.0' s.add_development_dependency 'cucumber', '~> 4.0' s.add_development_dependency 'rake', '~> 12.0' diff --git a/scripts/update-gemspec b/scripts/update-gemspec new file mode 100755 index 0000000..5e2d111 --- /dev/null +++ b/scripts/update-gemspec @@ -0,0 +1,24 @@ +#!/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") +add_dependency_lines=$(cat ${gemspec} | grep "s.add_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 + gem_line=$(gem list "${gem}" --remote --all --no-prerelease | grep "^${gem}\s") + latest_patch_version=$(echo "${gem_line}" | cut -d'(' -f2 | cut -d',' -f1) + latest_minor_version=$(echo "${latest_patch_version}" | cut -d. -f1,2) + cat "${gemspec}" | sed "s/s.add_dependency '${gem}', .*/s.add_dependency '${gem}', '~> ${latest_minor_version}', '>= ${latest_patch_version}'/" > ${gemspec}.tmp + mv ${gemspec}.tmp ${gemspec} +done <<< "${gems}"