diff --git a/.gitattributes b/.gitattributes index dc15ed793c..bb040f9a84 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,4 +8,3 @@ # Same thing for following files, but they don't have an sh extension pre-commit eol=lf webpack-dev-server eol=lf -install-bundler eol=lf \ No newline at end of file diff --git a/.ruby-version b/.ruby-version index 5f6fc5edc2..7921bd0c89 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.10 +3.4.8 diff --git a/Dockerfile b/Dockerfile index 2c7ed56f58..5af71e90e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.3.10-alpine3.19 AS base +FROM ruby:3.4.8-alpine3.19 AS base ENV LANG=C.UTF-8 \ LC_ALL=C.UTF-8 \ TZ=Europe/London \ diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu index 4d67450b24..5900b7156a 100644 --- a/Dockerfile.ubuntu +++ b/Dockerfile.ubuntu @@ -83,11 +83,8 @@ RUN wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.z # Copy code and install app dependencies COPY . /usr/src/app/ -# Install Bundler -RUN ./script/install-bundler - # Install front-end dependencies RUN yarn install # Run bundler install in parallel with the amount of available CPUs -RUN bundle install --jobs="$(nproc)" \ No newline at end of file +RUN bundle install --jobs="$(nproc)" diff --git a/Gemfile.lock b/Gemfile.lock index c81e0fd26f..e86a88289b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1114,7 +1114,7 @@ DEPENDENCIES wkhtmltopdf-binary RUBY VERSION - ruby 3.3.10p183 + ruby 3.4.8p72 BUNDLED WITH - 2.5.22 + 4.0.3 diff --git a/app/models/spree/payment_method.rb b/app/models/spree/payment_method.rb index b66d8d239b..50fbb69158 100644 --- a/app/models/spree/payment_method.rb +++ b/app/models/spree/payment_method.rb @@ -93,8 +93,8 @@ module Spree type.demodulize.downcase end - def self.find_with_destroyed(*args) - unscoped { find(*args) } + def self.find_with_destroyed(*) + unscoped { find(*) } end def payment_profiles_supported? diff --git a/bin/setup b/bin/setup index 52411f7240..1f75470d94 100755 --- a/bin/setup +++ b/bin/setup @@ -16,7 +16,7 @@ FileUtils.chdir APP_ROOT do # Add necessary setup steps to this file. puts "== Installing dependencies ==" - system! "script/install-bundler" + # Check first (it's quicker), then install new gems if necessary system("bundle check 2> /dev/null") || system!(BUNDLE_ENV, "bundle install") diff --git a/lib/reporting/reports/enterprise_fee_summary/scope.rb b/lib/reporting/reports/enterprise_fee_summary/scope.rb index 5aa518f5c4..f678a5750b 100644 --- a/lib/reporting/reports/enterprise_fee_summary/scope.rb +++ b/lib/reporting/reports/enterprise_fee_summary/scope.rb @@ -392,9 +392,9 @@ module Reporting end end - def filter_scope(*args) + def filter_scope(*) chain_to_scope do - where(*args) + where(*) end end end diff --git a/script/bump-ruby.sh b/script/bump-ruby.sh new file mode 100755 index 0000000000..337f23cb2a --- /dev/null +++ b/script/bump-ruby.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env sh + +if [ "$#" -lt 1 ]; then + echo "Usage: $0 " + echo "Example: $0 3.4.8" + exit 1 +fi + +set -ex + +OLD_VERSION=$(cat .ruby-version) +NEW_VERSION=$1 +PATTERN="$(echo "$OLD_VERSION" | sed 's:[]\[^$.*/]:\\&:g')" + +sed -i "s/\<$PATTERN\>/$NEW_VERSION/" .ruby-version Dockerfile + +script/rbenv-install.sh + +# Update bundler to the version shipped with Ruby: +bundle update --bundler + +git commit -a -m "Bump Ruby from $OLD_VERSION to $NEW_VERSION" diff --git a/script/install-bundler b/script/install-bundler deleted file mode 100755 index 1fb3e7d945..0000000000 --- a/script/install-bundler +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -# This shell script looks for the last used Bundler version in Gemfile.lock and -# installs exactly that version, removing all other versions. - -# Command line arguments are passed on to `gem install`. So you can call this -# script with with arguments: -# -# ./script/install-bundler --no-ri --no-rdoc - -# This script is used by ofn-install and can by handy in your development -# environment. - -# Fail if a single command fails. -set -e - -# `grep`: find the occurrences of "BUNDLED WITH" (-m is unnecessary and behaves different on macOS) -# `-A`: print the next line after "BUNDLED WITH" as well -# `-F`: find exactly that string -# `tail -n 1`: take the last line, the version line -# `tr -d`: delete all spaces, the indent before the version -version="$(grep -A 1 -F "BUNDLED WITH" Gemfile.lock | tail -n 1 | tr -d '[:space:]')" - -# if the length of $version is zero -if [ -z "$version" ]; then - echo >&2 "No bundler version in Gemfile.lock." - exit 1 -fi - -# Get the currently used bundler version. -# We ignore all errors with `2>/dev/null || true` in case there is no bundler -# or only an orphaned shim installed. -current="$(bundler --version 2>/dev/null || true)" - -if [ "$current" = "Bundler version $version" ]; then - echo >&2 "Already up-to-date: $current" - exit 0 -fi - -# Passing on all arguments of this script with "$@". -gem install bundler -v "$version" "$@" -gem uninstall bundler -v "!= $version" 2>/dev/null || true diff --git a/spec/support/performance_helper.rb b/spec/support/performance_helper.rb index f0236997fb..8967258717 100644 --- a/spec/support/performance_helper.rb +++ b/spec/support/performance_helper.rb @@ -2,12 +2,12 @@ module OpenFoodNetwork module PerformanceHelper - def multi_benchmark(num_samples, cache_key_patterns: [], &block) + def multi_benchmark(num_samples, cache_key_patterns: [], &) results = (0..num_samples).map do |_i| ActiveRecord::Base.connection.query_cache.clear delete_cache_keys(cache_key_patterns) - result = Benchmark.measure(&block) + result = Benchmark.measure(&) puts result diff --git a/spec/system/admin/enterprises/dfc_permissions_spec.rb b/spec/system/admin/enterprises/dfc_permissions_spec.rb index 7c86f6ed0f..b88c4e0d48 100644 --- a/spec/system/admin/enterprises/dfc_permissions_spec.rb +++ b/spec/system/admin/enterprises/dfc_permissions_spec.rb @@ -68,9 +68,9 @@ RSpec.describe "DFC Permissions", feature: "cqcm-dev", vcr: true do end end - def within_platform_list(variant, &block) + def within_platform_list(variant, &) retry_expectations(on: Ferrum::JavaScriptError) do - within(platform_list(variant), &block) + within(platform_list(variant), &) end end