refinerycms icon indicating copy to clipboard operation
refinerycms copied to clipboard

Bundle fails on ruby 3.2.1

Open avonderluft opened this issue 1 year ago • 1 comments

Bundler version 2.4.7

% bundle

[!] There was an error parsing `Gemfile`: undefined method `=~' for ["~> 4.0", ">= 4.0.0"]:Array. Bundler cannot continue.

 #  from /Users/wonder/dev/refinerycms/Gemfile:15
 #  -------------------------------------------
 #  # Add support for refinerycms-acts-as-indexed
 >  gem 'refinerycms-acts-as-indexed', ['~> 4.0', '>= 4.0.0'],
 #    git: 'https://github.com/refinery/refinerycms-acts-as-indexed',
 #  -------------------------------------------

avonderluft avatar Mar 01 '23 19:03 avonderluft

Hi @avonderluft

2.4.7 version of Bundler is probably too new, we had some issues with this version also in another non-Refinery projects. I recommend to use 2.3.3

Year ago, I have migrated my Refinery project to Ruby 3.1.0. The current Refinery main branch doesnt support Ruby 3.2.1 yet, but there is opened pull request https://github.com/refinery/refinerycms/pull/3518 which brings the support of Ruby 3.1.0. I dont know what is the state of this pull request branch, maybe you can try that branch, to get it working - at least for Ruby 3.1.0.

The following steps are needed, if you need Ruby 3.2.1. (Use the already linked ruby3 branch as base branch)

Instal older bundler via: $ gem install bundler -v=2.3.3

Add or modify the Ruby version in your Gemfile to 3.2.1: ruby '3.2.1'

Install $ bundle install

Add to Gemfile gem 'digest', '3.1.1'

$ bundle update digest

Then, you will have few issues with removed methods, you need to solve it on your own:

Removed methods (https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-released/) The following deprecated methods are removed.

Dir.exists? [Feature #17391] File.exists? [Feature #17391] Kernel#=~ [Feature #15231] Kernel#taint, Kernel#untaint, Kernel#tainted? [Feature #16131] Kernel#trust, Kernel#untrust, Kernel#untrusted? [Feature #16131]

The first one error is result !~ %r{^/(#{Refinery::Core.backend_route}|wymiframe)} due to removed Kernel#=~

The second one error you will (maybe) get if File.exists?('/.dockerenv') Solution here is to rename exists to exist

Then you will have issues with pg gem (symbol lookup error: /home/martin/.rvm/gems/ruby-3.2.1@zskalnica/gems/pg-1.1.4/lib/pg_ext.so: undefined symbol: rb_tainted_str_new2). Seems that upgrading to latest pg version solves this problem:

Change in Gemfile gem 'pg', '>= 1.4.6', '< 2.0'

$ bundle update pg

Then your project should start on Ruby 3.2.1 .

Note: I havent upgraded my project to Ruby 3.2.1, yet. Probably you will have more issues due to removed Ruby methods in the Refinery modules.

Matho avatar Mar 19 '23 17:03 Matho