From 28c70de1a1b3e473ac5014d552565e8c1c578162 Mon Sep 17 00:00:00 2001 From: Felipe Lima Date: Mon, 21 Oct 2024 17:49:42 -0700 Subject: [PATCH] fix(ruby): Require shared lib from correct subdir --- .github/workflows/publish.yml | 2 +- .gitignore | 1 + ruby-sdk/lib/eppo_client/client.rb | 11 +++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 871cc862..f9f6bd45 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -175,7 +175,7 @@ jobs: -- ${{ matrix._.rb-sys-dock-setup }} - name: Smoke gem install - if: matrix.ruby-platform == 'x86_64-linux' # GitHub actions architecture + if: matrix._.platform == 'x86_64-linux' # GitHub actions architecture run: | gem install pkg/eppo-server-sdk-*.gem --verbose script="puts EppoClient::Core::Client.new(EppoClient::Config.new('placeholder'))" diff --git a/.gitignore b/.gitignore index 8b05231f..8dded34d 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ node_modules .idea/ +.DS_Store diff --git a/ruby-sdk/lib/eppo_client/client.rb b/ruby-sdk/lib/eppo_client/client.rb index fd453b1f..fee3476a 100644 --- a/ruby-sdk/lib/eppo_client/client.rb +++ b/ruby-sdk/lib/eppo_client/client.rb @@ -4,7 +4,14 @@ require "logger" require_relative "config" -require_relative "eppo_client" + +# Tries to require the extension for the current Ruby version first +begin + RUBY_VERSION =~ /(\d+\.\d+)/ + require_relative "#{Regexp.last_match(1)}/eppo_client" +rescue LoadError + require_relative "eppo_client" +end module EppoClient # The main client singleton @@ -15,7 +22,7 @@ class Client def init(config) config.validate - if !@core.nil? then + if !@core.nil? STDERR.puts "Eppo Warning: multiple initialization of the client" @core.shutdown end