fix.sh in checkoff-0.14.1 vs fix.sh in checkoff-0.15.0

- old
+ new

@@ -125,15 +125,38 @@ set_rbenv_env_variables bundle --version >/dev/null 2>&1 || gem install --no-document bundler bundler_version=$(bundle --version | cut -d ' ' -f3) bundler_version_major=$(cut -d. -f1 <<< "${bundler_version}") bundler_version_minor=$(cut -d. -f2 <<< "${bundler_version}") + bundler_version_patch=$(cut -d. -f3 <<< "${bundler_version}") # Version 2.1 of bundler seems to have some issues with nokogiri: # # https://app.asana.com/0/1107901397356088/1199504270687298 - if [ "${bundler_version_major}" == 2 ] && [ "${bundler_version_minor}" -lt 2 ] + + # Version 2.2.22 of bundler comes with a fix to ensure the 'bundle + # update --conservative' flag works as expected - important when + # doing a 'bundle update' on a about-to-be-published gem after + # bumping a gem version. + need_better_bundler=false + if [ "${bundler_version_major}" -lt 2 ] then + need_better_bundler=true + elif [ "${bundler_version_major}" -eq 2 ] + then + if [ "${bundler_version_minor}" -lt 2 ] + then + need_better_bundler=true + elif [ "${bundler_version_minor}" -eq 2 ] + then + if [ "${bundler_version_patch}" -lt 22 ] + then + need_better_bundler=true + fi + fi + fi + if [ "${need_better_bundler}" = true ] + then gem install --no-document bundler fi make bundle_install # https://bundler.io/v2.0/bundle_lock.html#SUPPORTING-OTHER-PLATFORMS # @@ -141,10 +164,16 @@ # you're running locally, you can run bundle lock --add-platform # PLATFORM to add PLATFORM to the lockfile, force bundler to # re-resolve and consider the new platform when picking gems, all # without needing to have a machine that matches PLATFORM handy to # install those platform-specific gems on.' - grep x86_64-darwin-20 Gemfile.lock >/dev/null 2>&1 || bundle lock --add-platform x86_64-darwin-20 x86_64-linux + # + # This affects nokogiri, which will try to reinstall itself in + # Docker builds where it's already installed if this is not run. + for platform in x86_64-darwin-20 x86_64-linux + do + grep "${platform:?}" Gemfile.lock >/dev/null 2>&1 || bundle lock --add-platform "${platform:?}" + done } set_ruby_local_version() { latest_ruby_version="$(cut -d' ' -f1 <<< "${ruby_versions}")" echo "${latest_ruby_version}" > .ruby-version