Actions
Feature #41976
closedRuby 3.4 support
Added by Go MAEDA 11 months ago. Updated 7 months ago.
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Description
Ruby 3.4.0 will be released on December 25, 2024.
Files
| 0001-Fix-Avoid-literal-string-will-be-frozen-in-the-futur.patch (2.36 KB) 0001-Fix-Avoid-literal-string-will-be-frozen-in-the-futur.patch | Go MAEDA, 2024-12-13 08:19 | ||
| Add-Ruby-3.4-to-supported-Ruby-versions.patch (1.43 KB) Add-Ruby-3.4-to-supported-Ruby-versions.patch | Katsuya HIDAKA, 2025-02-14 07:06 | 
Related issues
      
      Updated by Go MAEDA 11 months ago
      
    
    - Copied from Feature #39761: Ruby 3.3 support added
 
      
      Updated by Go MAEDA 11 months ago
      
    
    - File 0001-Fix-Avoid-literal-string-will-be-frozen-in-the-futur.patch 0001-Fix-Avoid-literal-string-will-be-frozen-in-the-futur.patch added
 
The attached patch fixes "literal string will be frozen in the future" warnings on Ruby 3.4.0 rc1.
/path/to/redmine/app/views/gantts/show.html.erb:342: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information)
/path/to/redmine/app/views/repositories/_breadcrumbs.html.erb:18: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information)
/path/to/redmine/lib/redmine/i18n.rb:154: warning: warning: string returned by :ar.to_s will be frozen in the future
      
      Updated by Katsuya HIDAKA 11 months ago
      
    
    +1
0001-Fix-Avoid-literal-string-will-be-frozen-in-the-futur.patch
-      clss << " nwday" if @gantt.non_working_week_days.include?(wday)
+      clss += " nwday" if @gantt.non_working_week_days.include?(wday)
	How about modifying it like this?
       clss = "gantt_hdr" 
       clss << " nwday" if @gantt.non_working_week_days.include?(wday)
     %>
-    <%= content_tag(:div, :style => style, :class => clss) do %>
+    <%= content_tag(:div, :style => style, :class => ["gantt_hdr", { nwday: @gantt.non_working_week_days.include?(wday) }]) do %>
       <%= day_num.day %>
     <% end %>
     <%
	With this change, the class attribute would produce the following results:
redmine-app(dev)> helper.content_tag(:div, "", :class => ["gantt_hdr", { nwday: false }])
=> "<div class=\"gantt_hdr\"></div>" 
redmine-app(dev)> helper.content_tag(:div, "", :class => ["gantt_hdr", { nwday: true }])
=> "<div class=\"gantt_hdr nwday\"></div>" 
	Alternatively, this approach would also work:
-      clss = "gantt_hdr" 
+      clss = +"gantt_hdr" 
       clss << " nwday" if @gantt.non_working_week_days.include?(wday)
Reasons:
	- The current implementation in the patch always creates a new string instance.
 - Other similar parts of the code use String#+@, so this would improve consistency.
 
Personally, I think the former approach is preferable, but the latter also seems like a valid option.
      
      Updated by Katsuya HIDAKA 9 months ago
      
    
    - File Add-Ruby-3.4-to-supported-Ruby-versions.patch Add-Ruby-3.4-to-supported-Ruby-versions.patch added
 
Redmine appears to work fine with Ruby 3.4.
- I confirmed that the patch in #note-3 works correctly.
 - All tests, including system tests run in CI, passed.
https://github.com/hidakatsuya/redmine/actions/runs/13323213831 - It seems that there are no warnings or errors in the test results that might cause issues (Ruby warnings are enabled).
 
I am attaching a patch to add Ruby 3.4 to the supported Ruby versions.
      
      Updated by Marius BĂLTEANU 7 months ago
      
    
    - Related to Patch #42496: Drop support for Ruby 3.1 added
 
Actions