From d16fdd3ab4ffb532a11db1c4abb28bbfbee58d7b Mon Sep 17 00:00:00 2001 From: Pierre Merlin Date: Thu, 16 Jan 2025 17:09:50 +0100 Subject: [PATCH 1/9] Rm Ruby 2.7 from test strategy matrix Since it reached EOL at 2023-03-31 (cf https://www.ruby-lang.org/en/downloads/branches/) --- .github/workflows/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e35e566..3f65fbf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,9 +23,6 @@ jobs: - ruby: '3.0' gemfile: '7.0.0' couchbase: '7.1.0' - - ruby: '2.7' - gemfile: '7.0.0' - couchbase: '7.1.0' fail-fast: false runs-on: ubuntu-20.04 name: ${{ matrix.ruby }} rails-${{ matrix.gemfile }} couchbase-${{ matrix.couchbase }} From 6eb1ae626eb67625831885a7b1ca9f4c9e6b016e Mon Sep 17 00:00:00 2001 From: Pierre Merlin Date: Thu, 16 Jan 2025 17:13:04 +0100 Subject: [PATCH 2/9] Bump minimum Ruby version to 3.1 Since 3.0 reached EOL 2024-04-23 --- couchbase-orm.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchbase-orm.gemspec b/couchbase-orm.gemspec index 5fda97c..62caf4e 100644 --- a/couchbase-orm.gemspec +++ b/couchbase-orm.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |gem| gem.summary = 'Couchbase ORM for Rails' gem.description = 'A Couchbase ORM for Rails' - gem.required_ruby_version = '>= 2.7.0' + gem.required_ruby_version = '>= 3.1.0' gem.require_paths = ['lib'] gem.add_runtime_dependency 'activemodel', ENV['ACTIVE_MODEL_VERSION'] || '>= 5.2' From 3b1e4b8a288e3456475b4b23fa8d557c4c6bf9ab Mon Sep 17 00:00:00 2001 From: Pierre Merlin Date: Thu, 16 Jan 2025 17:15:06 +0100 Subject: [PATCH 3/9] Use Ruby 3.1 instead of 3.0 in test strategy matrix --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3f65fbf..933ec1b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,10 +17,10 @@ jobs: - ruby: '3.2' gemfile: '7.1.0' couchbase: '7.1.1' - - ruby: '3.0' + - ruby: '3.1' gemfile: '7.0.0' couchbase: '6.6.5' - - ruby: '3.0' + - ruby: '3.1' gemfile: '7.0.0' couchbase: '7.1.0' fail-fast: false From 3890dafd1c9861fe8bd6a403a7c784f9abec9320 Mon Sep 17 00:00:00 2001 From: Pierre Merlin Date: Thu, 16 Jan 2025 17:36:08 +0100 Subject: [PATCH 4/9] Drop support of Active Model 7.0.0 And introduce AM 8.0.0 --- .github/workflows/test.yml | 17 ++++++++++------- couchbase-orm.gemspec | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 933ec1b..9774c91 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,20 +12,23 @@ jobs: matrix: include: - ruby: '3.3' - gemfile: '7.1.0' + active-model: '8.0.0' + couchbase: '7.2.3' + - ruby: '3.3' + active-model: '7.2' couchbase: '7.2.3' - ruby: '3.2' - gemfile: '7.1.0' + active-model: '7.2.0' couchbase: '7.1.1' - - ruby: '3.1' - gemfile: '7.0.0' + - ruby: '3.2' + active-model: '7.1.0' couchbase: '6.6.5' - ruby: '3.1' - gemfile: '7.0.0' + active-model: '7.1.0' couchbase: '7.1.0' fail-fast: false runs-on: ubuntu-20.04 - name: ${{ matrix.ruby }} rails-${{ matrix.gemfile }} couchbase-${{ matrix.couchbase }} + name: ${{ matrix.ruby }} rails-${{ matrix.active-model }} couchbase-${{ matrix.couchbase }} steps: - uses: actions/checkout@v3 - run: sudo apt-get update && sudo apt-get install libevent-dev libev-dev python-httplib2 @@ -36,7 +39,7 @@ jobs: - run: sudo ./ci/run_couchbase.sh $COUCHBASE_VERSION $COUCHBASE_BUCKET $COUCHBASE_USER $COUCHBASE_PASSWORD - run: bundle exec rspec env: - ACTIVE_MODEL_VERSION: ${{ matrix.gemfile }} + ACTIVE_MODEL_VERSION: ${{ matrix.active-model }} BUNDLE_JOBS: 4 BUNDLE_PATH: vendor/bundle COUCHBASE_BUCKET: default diff --git a/couchbase-orm.gemspec b/couchbase-orm.gemspec index 62caf4e..5a67a51 100644 --- a/couchbase-orm.gemspec +++ b/couchbase-orm.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |gem| gem.required_ruby_version = '>= 3.1.0' gem.require_paths = ['lib'] - gem.add_runtime_dependency 'activemodel', ENV['ACTIVE_MODEL_VERSION'] || '>= 5.2' + gem.add_runtime_dependency 'activemodel', ENV['ACTIVE_MODEL_VERSION'] || '>= 7.1' gem.add_runtime_dependency 'couchbase', '>= 3.4.2' gem.add_runtime_dependency 'radix', '~> 2.2' # converting numbers to and from any base From c4c3e423bea168d86f628ee8b6f8784727728dc4 Mon Sep 17 00:00:00 2001 From: Pierre Merlin Date: Tue, 10 Jun 2025 17:14:15 +0200 Subject: [PATCH 5/9] Rm Ruby 3.1 from test grid --- .github/workflows/test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9774c91..c57a851 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,9 +23,6 @@ jobs: - ruby: '3.2' active-model: '7.1.0' couchbase: '6.6.5' - - ruby: '3.1' - active-model: '7.1.0' - couchbase: '7.1.0' fail-fast: false runs-on: ubuntu-20.04 name: ${{ matrix.ruby }} rails-${{ matrix.active-model }} couchbase-${{ matrix.couchbase }} From 79c257fbba1cc113619b5e5b004ccc51cb02170a Mon Sep 17 00:00:00 2001 From: Pierre Merlin Date: Tue, 10 Jun 2025 17:15:17 +0200 Subject: [PATCH 6/9] Bump required ruby version to >= 3.2.0 --- couchbase-orm.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchbase-orm.gemspec b/couchbase-orm.gemspec index 5a67a51..a10e9d7 100644 --- a/couchbase-orm.gemspec +++ b/couchbase-orm.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |gem| gem.summary = 'Couchbase ORM for Rails' gem.description = 'A Couchbase ORM for Rails' - gem.required_ruby_version = '>= 3.1.0' + gem.required_ruby_version = '>= 3.2.0' gem.require_paths = ['lib'] gem.add_runtime_dependency 'activemodel', ENV['ACTIVE_MODEL_VERSION'] || '>= 7.1' From 756c53b8b349ca9c36bc816cd8a1d5b53b34dcd0 Mon Sep 17 00:00:00 2001 From: Pierre Merlin Date: Tue, 10 Jun 2025 17:17:07 +0200 Subject: [PATCH 7/9] Add Ruby 3.4 in test grid --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c57a851..8324f6e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,6 +11,9 @@ jobs: strategy: matrix: include: + - ruby: '3.4' + active-model: '8.0.2' + couchbase: '7.2.3' - ruby: '3.3' active-model: '8.0.0' couchbase: '7.2.3' From 5839f839704034bfafc89afe03e473122296cdcc Mon Sep 17 00:00:00 2001 From: Pierre Merlin Date: Tue, 10 Jun 2025 17:39:50 +0200 Subject: [PATCH 8/9] Keep suport of some EOL Ruby versions --- .github/workflows/test.yml | 6 ++++++ couchbase-orm.gemspec | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8324f6e..18a5a70 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,12 @@ jobs: - ruby: '3.2' active-model: '7.1.0' couchbase: '6.6.5' + - ruby: '3.0' + gemfile: '7.0.0' + couchbase: '7.1.0' + - ruby: '2.7' + gemfile: '7.0.0' + couchbase: '7.1.0' fail-fast: false runs-on: ubuntu-20.04 name: ${{ matrix.ruby }} rails-${{ matrix.active-model }} couchbase-${{ matrix.couchbase }} diff --git a/couchbase-orm.gemspec b/couchbase-orm.gemspec index a10e9d7..5fda97c 100644 --- a/couchbase-orm.gemspec +++ b/couchbase-orm.gemspec @@ -15,10 +15,10 @@ Gem::Specification.new do |gem| gem.summary = 'Couchbase ORM for Rails' gem.description = 'A Couchbase ORM for Rails' - gem.required_ruby_version = '>= 3.2.0' + gem.required_ruby_version = '>= 2.7.0' gem.require_paths = ['lib'] - gem.add_runtime_dependency 'activemodel', ENV['ACTIVE_MODEL_VERSION'] || '>= 7.1' + gem.add_runtime_dependency 'activemodel', ENV['ACTIVE_MODEL_VERSION'] || '>= 5.2' gem.add_runtime_dependency 'couchbase', '>= 3.4.2' gem.add_runtime_dependency 'radix', '~> 2.2' # converting numbers to and from any base From cfb84ba514ecabe4a3f40abd7764d93e5bae4a0a Mon Sep 17 00:00:00 2001 From: Pierre Merlin Date: Mon, 16 Jun 2025 17:41:41 +0200 Subject: [PATCH 9/9] Use 0 as default precision Since Time has been rewritten in C in Ruby 3.4 --- lib/couchbase-orm/types/date_time.rb | 3 ++- lib/couchbase-orm/utilities/query_helper.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/couchbase-orm/types/date_time.rb b/lib/couchbase-orm/types/date_time.rb index 37bdaff..504e168 100644 --- a/lib/couchbase-orm/types/date_time.rb +++ b/lib/couchbase-orm/types/date_time.rb @@ -7,7 +7,8 @@ def cast(value) end def serialize(value) - value&.iso8601(@precision) + value&. + iso8601(@precision || 0) end end end diff --git a/lib/couchbase-orm/utilities/query_helper.rb b/lib/couchbase-orm/utilities/query_helper.rb index 0df2f55..3f1a71c 100644 --- a/lib/couchbase-orm/utilities/query_helper.rb +++ b/lib/couchbase-orm/utilities/query_helper.rb @@ -133,7 +133,7 @@ def quote(value) if [String, Date].any? { |clazz| value.is_a?(clazz) } "'#{N1ql.sanitize(value)}'" elsif [DateTime, Time].any? { |clazz| value.is_a?(clazz) } - formatedDate = value&.iso8601(@precision) + formatedDate = value&.iso8601(@precision || 0) "'#{N1ql.sanitize(formatedDate)}'" elsif value.is_a? Array "[#{value.map{|v|quote(v)}.join(', ')}]"