Skip to content

Commit

Permalink
feat: Ruby version 3.4 [1]
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Dec 30, 2024
1 parent b9fd6be commit e8dd987
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
12 changes: 7 additions & 5 deletions lib/tebako/packager/pass1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ module Pass1
"#option nodynamic" => "option nodynamic"
}.freeze

# ....................................................
# This is something that I cannnot explain
# (this patch does not seem related to static compilation)

EXT_BIGDECIMAL_BIGDECIMAL_H_PATCH = {
"#include \"ruby/ruby.h\"" => <<~SUBST
#include "ruby/ruby.h"
Expand Down Expand Up @@ -132,11 +136,6 @@ def get_base_patch_map(mount_point)
# No match and patching on Ruby 3.1.4 but works wo issues
"tool/rbinstall.rb" => TOOL_RBINSTALL_RB_PATCH,

# ....................................................
# This is something that I cannnot explain
# (this patch does not seem related to static compilation)
# "ext/bigdecimal/bigdecimal.h" => EXT_BIGDECIMAL_BIGDECIMAL_H_PATCH,

# ....................................................
# Allow only packaged gems (from within memfs)
"lib/rubygems/path_support.rb" => rubygems_path_support_patch(mount_point),
Expand All @@ -150,6 +149,9 @@ def get_base_patch_map(mount_point)
def get_patch_map(ostype, mount_point, ruby_ver)
patch_map = get_base_patch_map(mount_point)

# ....................................................
patch_map.store("ext/bigdecimal/bigdecimal.h", EXT_BIGDECIMAL_BIGDECIMAL_H_PATCH) unless ruby_ver.ruby4x?

Check warning on line 153 in lib/tebako/packager/pass1.rb

View check run for this annotation

Codecov / codecov/patch

lib/tebako/packager/pass1.rb#L153

Added line #L153 was not covered by tests

# ....................................................
patch_map.store("configure", DARWIN_CONFIGURE_PATCH) if ostype =~ /darwin/

Expand Down
12 changes: 8 additions & 4 deletions lib/tebako/ruby_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,27 @@ def initialize(ruby_version)
attr_reader :ruby_version

def ruby3x?
@ruby3x ||= @ruby_version[0] == "3"
@ruby3x ||= @ruby_version[0] >= "3"
end

def ruby31?
@ruby31 ||= ruby3x? && @ruby_version[2].to_i >= 1
@ruby31 ||= (ruby3x? && @ruby_version[2].to_i >= 1) || ruby4x?
end

def ruby32?
@ruby32 ||= ruby3x? && @ruby_version[2].to_i >= 2
@ruby32 ||= (ruby3x? && @ruby_version[2].to_i >= 2) || ruby4x?
end

def ruby32only?
@ruby32only ||= ruby3x? && @ruby_version[2] == "2"
end

def ruby33?
@ruby33 ||= ruby3x? && @ruby_version[2].to_i >= 3
@ruby33 ||= (ruby3x? && @ruby_version[2].to_i >= 3) || ruby4x?
end

def ruby4x?
@ruby4x ||= @ruby_version[0] >= "4"
end

def api_version
Expand Down

0 comments on commit e8dd987

Please sign in to comment.