From 28c70de1a1b3e473ac5014d552565e8c1c578162 Mon Sep 17 00:00:00 2001 From: Felipe Lima Date: Mon, 21 Oct 2024 17:49:42 -0700 Subject: [PATCH 1/2] 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 From 7937130899cbaebff87f343b332a9bbb10e0d751 Mon Sep 17 00:00:00 2001 From: Felipe Lima Date: Mon, 21 Oct 2024 17:54:16 -0700 Subject: [PATCH 2/2] version bump --- ruby-sdk/Cargo.lock | 2 +- ruby-sdk/Gemfile.lock | 2 +- ruby-sdk/README.md | 5 +++-- ruby-sdk/ext/eppo_client/Cargo.toml | 2 +- ruby-sdk/lib/eppo_client/version.rb | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ruby-sdk/Cargo.lock b/ruby-sdk/Cargo.lock index 3d56af0f..599d5139 100644 --- a/ruby-sdk/Cargo.lock +++ b/ruby-sdk/Cargo.lock @@ -304,7 +304,7 @@ dependencies = [ [[package]] name = "eppo_client" -version = "3.2.4" +version = "3.2.5" dependencies = [ "env_logger", "eppo_core", diff --git a/ruby-sdk/Gemfile.lock b/ruby-sdk/Gemfile.lock index 093afb83..59d45905 100644 --- a/ruby-sdk/Gemfile.lock +++ b/ruby-sdk/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - eppo-server-sdk (3.2.4) + eppo-server-sdk (3.2.5) rb_sys (~> 0.9.102) GEM diff --git a/ruby-sdk/README.md b/ruby-sdk/README.md index 434260b6..ec5f15a5 100644 --- a/ruby-sdk/README.md +++ b/ruby-sdk/README.md @@ -23,5 +23,6 @@ Make sure you remove the override before updating `Cargo.lock`. Otherwise, the l ## Releasing -* Bump versions in `ruby-sdk/lib/eppo_client/version.rb` and `ruby-sdk/ext/eppo_client/Cargo.toml`. -* Run `cargo update --workspace --verbose` to update `Cargo.lock` and `Gemfile.lock`. +* Bump versions in `ruby-sdk/lib/eppo_client/version.rb` and `ruby-sdk/ext/eppo_client/Cargo.toml` +* Run `cargo update --workspace --verbose` to update `Cargo.lock` +* Run `bundle` to update `Gemfile.lock` diff --git a/ruby-sdk/ext/eppo_client/Cargo.toml b/ruby-sdk/ext/eppo_client/Cargo.toml index ccda8bad..677b8144 100644 --- a/ruby-sdk/ext/eppo_client/Cargo.toml +++ b/ruby-sdk/ext/eppo_client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "eppo_client" # TODO: this version and lib/eppo_client/version.rb should be in sync -version = "3.2.4" +version = "3.2.5" edition = "2021" license = "MIT" publish = false diff --git a/ruby-sdk/lib/eppo_client/version.rb b/ruby-sdk/lib/eppo_client/version.rb index 29ccc2b4..39791641 100644 --- a/ruby-sdk/lib/eppo_client/version.rb +++ b/ruby-sdk/lib/eppo_client/version.rb @@ -2,5 +2,5 @@ # TODO: this version and ext/eppo_client/Cargo.toml should be in sync module EppoClient - VERSION = "3.2.4" + VERSION = "3.2.5" end