diff --git a/.github/workflows/2.5.yml b/.github/workflows/2.5.yml deleted file mode 100644 index 27fc3c528..000000000 --- a/.github/workflows/2.5.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Ruby 2.5 -on: - push: - branches: - - main - pull_request: - branches: - - main - workflow_dispatch: - branches: - - '*' -jobs: - tests: - env: - TEST_ES_SERVER: http://localhost:9200 - RAILS_VERSIONS: '5.0,6.0' - strategy: - fail-fast: false - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Increase system limits - run: | - sudo swapoff -a - sudo sysctl -w vm.swappiness=1 - sudo sysctl -w fs.file-max=262144 - sudo sysctl -w vm.max_map_count=262144 - - uses: opensearch-project/opensearch-ruby/.github/actions/opensearch@main - with: - cluster-version: 2 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.5 - - name: Bundle - run: | - sudo apt-get install libsqlite3-dev - gem install bundler - bundle install - bundle exec rake bundle:clean - bundle exec rake bundle:install - - name: Test opensearch-rails - run: cd opensearch-rails && bundle exec rake test:all - - name: Test opensearch-persistence - run: cd opensearch-persistence && bundle exec rake test:all - - name: Test opensearch-model - run: cd opensearch-model && bundle exec rake test:all - diff --git a/.github/workflows/2.6.yml b/.github/workflows/2.6.yml deleted file mode 100644 index aa11e8573..000000000 --- a/.github/workflows/2.6.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Ruby 2.6 -on: - push: - branches: - - main - pull_request: - branches: - - main - workflow_dispatch: - branches: - - '*' -jobs: - tests: - env: - TEST_ES_SERVER: http://localhost:9200 - RAILS_VERSIONS: '5.0,6.0' - strategy: - fail-fast: false - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Increase system limits - run: | - sudo swapoff -a - sudo sysctl -w vm.swappiness=1 - sudo sysctl -w fs.file-max=262144 - sudo sysctl -w vm.max_map_count=262144 - - uses: opensearch-project/opensearch-ruby/.github/actions/opensearch@main - with: - cluster-version: 2 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.6 - - name: Bundle - run: | - sudo apt-get install libsqlite3-dev - gem install bundler - bundle install - bundle exec rake bundle:clean - bundle exec rake bundle:install - - name: Test opensearch-rails - run: cd opensearch-rails && bundle exec rake test:all - - name: Test opensearch-persistence - run: cd opensearch-persistence && bundle exec rake test:all - - name: Test opensearch-model - run: cd opensearch-model && bundle exec rake test:all diff --git a/.github/workflows/2.7.yml b/.github/workflows/2.7.yml index 69b5cf3e8..d5da70cfe 100644 --- a/.github/workflows/2.7.yml +++ b/.github/workflows/2.7.yml @@ -13,7 +13,7 @@ jobs: tests: env: TEST_ES_SERVER: http://localhost:9200 - RAILS_VERSIONS: '5.0,6.0' + RAILS_VERSIONS: '6.1,7.1' strategy: fail-fast: false runs-on: ubuntu-latest @@ -34,7 +34,7 @@ jobs: - name: Bundle run: | sudo apt-get install libsqlite3-dev - gem install bundler + gem install bundler -v 2.4.22 bundle install bundle exec rake bundle:clean bundle exec rake bundle:install diff --git a/.github/workflows/2.4.yml b/.github/workflows/3.2.yml similarity index 94% rename from .github/workflows/2.4.yml rename to .github/workflows/3.2.yml index 4377af149..8bae5452d 100644 --- a/.github/workflows/2.4.yml +++ b/.github/workflows/3.2.yml @@ -1,4 +1,4 @@ -name: Ruby 2.4 +name: Ruby 3.2 on: push: branches: @@ -13,7 +13,7 @@ jobs: tests: env: TEST_ES_SERVER: http://localhost:9200 - RAILS_VERSIONS: '5.0' + RAILS_VERSIONS: '7.1' strategy: fail-fast: false runs-on: ubuntu-latest @@ -30,7 +30,7 @@ jobs: cluster-version: 2 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.4 + ruby-version: 3.2 - name: Bundle run: | sudo apt-get install libsqlite3-dev diff --git a/CHANGELOG.md b/CHANGELOG.md index e5d2f641f..4e1798bca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.1.0 + +No functional changes. + +- Ruby 3.2 support +- Remove CI / CD support for unsupported Ruby & Rails versions +- Ensure compatibility with opensearch-ruby 3 + ## 1.0.0 * Support OpenSearch 2 by removing deprecated type and include_type_name parameters diff --git a/README.md b/README.md index cb37f94ba..e14ddb0f8 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ # OpenSearch +[![Ruby 3.2](https://github.com/compliance-innovations/opensearch-rails/actions/workflows/3.2.yml/badge.svg)](https://github.com/compliance-innovations/opensearch-rails/actions/workflows/3.2.yml) [![Ruby 2.7](https://github.com/compliance-innovations/opensearch-rails/workflows/Ruby%202.7/badge.svg)](https://github.com/compliance-innovations/opensearch-rails/actions) -[![Ruby 2.6](https://github.com/compliance-innovations/opensearch-rails/workflows/Ruby%202.6/badge.svg)](https://github.com/compliance-innovations/opensearch-rails/actions) -[![Ruby 2.5](https://github.com/compliance-innovations/opensearch-rails/workflows/Ruby%202.5/badge.svg)](https://github.com/compliance-innovations/opensearch-rails/actions) -[![Ruby 2.4](https://github.com/compliance-innovations/opensearch-rails/workflows/Ruby%202.4/badge.svg)](https://github.com/compliance-innovations/opensearch-rails/actions) [![JRuby](https://github.com/compliance-innovations/opensearch-rails/workflows/JRuby/badge.svg)](https://github.com/compliance-innovations/opensearch-rails/actions) This repository contains various Ruby and Rails integrations for [OpenSearch](https://opensearch.org/). This is a fork @@ -92,7 +90,7 @@ You can generate a simple Ruby on Rails application with a single command --env "cluster.name=opensearch-rails" \ --env "cluster.routing.allocation.disk.threshold_enabled=false" \ --rm \ - opensearchproject/opensearch:1.3.0 + opensearchproject/opensearch:latest ``` Once OpenSearch is running, you can generate the simple app with this command: @@ -168,9 +166,9 @@ This software is licensed under the Apache 2 license, quoted below. the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY diff --git a/opensearch-model/Rakefile b/opensearch-model/Rakefile index ab1d6cab7..c430e08f3 100644 --- a/opensearch-model/Rakefile +++ b/opensearch-model/Rakefile @@ -21,8 +21,8 @@ desc 'Run unit tests' task default: 'test:all' task test: 'test:all' -gemfiles = ['5.0.gemfile', '6.0.gemfile'] -gemfiles << '4.0.gemfile' if RUBY_VERSION < '2.7' +gemfiles = ['7.1.gemfile'] +gemfiles << '6.1.gemfile' if RUBY_VERSION <= '3.0' GEMFILES = gemfiles.freeze namespace :bundle do diff --git a/opensearch-model/gemfiles/3.0.gemfile b/opensearch-model/gemfiles/3.0.gemfile deleted file mode 100644 index 1641023d7..000000000 --- a/opensearch-model/gemfiles/3.0.gemfile +++ /dev/null @@ -1,35 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Usage: -# -# $ BUNDLE_GEMFILE=./gemfiles/3.0.gemfile bundle install -# $ BUNDLE_GEMFILE=./gemfiles/3.0.gemfile bundle exec rake test:integration - -source 'https://rubygems.org' - -gemspec path: '../' - -gem 'activemodel', '>= 3.0' -gem 'activerecord', '~> 3.2' -gem 'mongoid', '>= 3.0' -gem 'sqlite3', '> 1.3', '< 1.4' unless defined?(JRUBY_VERSION) - -group :development, :testing do - gem 'rspec' - gem 'pry-nav' -end \ No newline at end of file diff --git a/opensearch-model/gemfiles/4.0.gemfile b/opensearch-model/gemfiles/4.0.gemfile deleted file mode 100644 index 944568fce..000000000 --- a/opensearch-model/gemfiles/4.0.gemfile +++ /dev/null @@ -1,36 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Usage: -# -# $ BUNDLE_GEMFILE=./gemfiles/4.0.gemfile bundle install -# $ BUNDLE_GEMFILE=./gemfiles/4.0.gemfile bundle exec rake test:integration - -source 'https://rubygems.org' - -gemspec path: '../' - -gem 'activemodel', '~> 4' -gem 'activerecord', '~> 4' -gem 'mongoid', '~> 5' -gem 'sqlite3', '> 1.3', '< 1.4' unless defined?(JRUBY_VERSION) - -group :development, :testing do - gem 'bigdecimal', '~> 1' - gem 'pry-nav' - gem 'rspec' -end diff --git a/opensearch-model/gemfiles/6.0.gemfile b/opensearch-model/gemfiles/6.1.gemfile similarity index 95% rename from opensearch-model/gemfiles/6.0.gemfile rename to opensearch-model/gemfiles/6.1.gemfile index dd859f68b..fb5b1996e 100644 --- a/opensearch-model/gemfiles/6.0.gemfile +++ b/opensearch-model/gemfiles/6.1.gemfile @@ -25,8 +25,8 @@ source 'https://rubygems.org' gemspec path: '../' -gem 'activemodel', '6.0.0' -gem 'activerecord', '6.0.0' +gem 'activemodel', '~> 6.1' +gem 'activerecord', '~> 6.1' gem 'sqlite3' unless defined?(JRUBY_VERSION) #gem 'mongoid', '~> 6' diff --git a/opensearch-model/gemfiles/5.0.gemfile b/opensearch-model/gemfiles/7.1.gemfile similarity index 82% rename from opensearch-model/gemfiles/5.0.gemfile rename to opensearch-model/gemfiles/7.1.gemfile index 8b1930961..e51b18ee0 100644 --- a/opensearch-model/gemfiles/5.0.gemfile +++ b/opensearch-model/gemfiles/7.1.gemfile @@ -17,17 +17,18 @@ # Usage: # -# $ BUNDLE_GEMFILE=./gemfiles/5.0.gemfile bundle install -# $ BUNDLE_GEMFILE=./gemfiles/5.0.gemfile bundle exec rake test:integration +# $ BUNDLE_GEMFILE=./gemfiles/6.0.gemfile bundle install +# $ BUNDLE_GEMFILE=./gemfiles/6.0.gemfile bundle exec rake test:integration + source 'https://rubygems.org' gemspec path: '../' -gem 'activemodel', '~> 5' -gem 'activerecord', '~> 5' +gem 'activemodel', '~> 7.1' +gem 'activerecord', '~> 7.1' gem 'sqlite3' unless defined?(JRUBY_VERSION) -gem 'mongoid', '~> 6' +#gem 'mongoid', '~> 6' group :development, :testing do gem 'rspec' diff --git a/opensearch-model/lib/opensearch/model/version.rb b/opensearch-model/lib/opensearch/model/version.rb index ee92d7fb0..7af173110 100644 --- a/opensearch-model/lib/opensearch/model/version.rb +++ b/opensearch-model/lib/opensearch/model/version.rb @@ -17,6 +17,6 @@ module OpenSearch module Model - VERSION = "1.0.0" + VERSION = "1.1.0" end end diff --git a/opensearch-model/opensearch-model.gemspec b/opensearch-model/opensearch-model.gemspec index 3e9b533b5..2c795397a 100644 --- a/opensearch-model/opensearch-model.gemspec +++ b/opensearch-model/opensearch-model.gemspec @@ -24,7 +24,7 @@ require 'opensearch/model/version' Gem::Specification.new do |s| s.name = 'opensearch-model' s.version = OpenSearch::Model::VERSION - s.authors = ['Compliance Innovations B.V.'] + s.authors = ['CDD Solutions B.V.'] s.email = ['developers@compliance-innovations.com'] s.description = 'ActiveModel/Record integrations for OpenSearch.' s.summary = 'ActiveModel/Record integrations for OpenSearch.' @@ -42,7 +42,7 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 2.4' s.add_dependency 'activesupport', '> 3' - s.add_dependency "opensearch-ruby", '~> 2.0' + s.add_dependency "opensearch-ruby", '>= 2' s.add_dependency 'hashie' s.add_development_dependency 'activemodel', '> 3' diff --git a/opensearch-model/spec/opensearch/model/adapters/active_record/namespaced_model_spec.rb b/opensearch-model/spec/opensearch/model/adapters/active_record/namespaced_model_spec.rb index 20341cb86..4071b147b 100644 --- a/opensearch-model/spec/opensearch/model/adapters/active_record/namespaced_model_spec.rb +++ b/opensearch-model/spec/opensearch/model/adapters/active_record/namespaced_model_spec.rb @@ -32,7 +32,7 @@ MyNamespace::Book.__opensearch__.refresh_index! end - after do + after(:all) do clear_indices(MyNamespace::Book) clear_tables(MyNamespace::Book) end diff --git a/opensearch-model/spec/opensearch/model/adapters/active_record/serialization_spec.rb b/opensearch-model/spec/opensearch/model/adapters/active_record/serialization_spec.rb index b3e41a9c0..4a9bad0b8 100644 --- a/opensearch-model/spec/opensearch/model/adapters/active_record/serialization_spec.rb +++ b/opensearch-model/spec/opensearch/model/adapters/active_record/serialization_spec.rb @@ -52,7 +52,7 @@ context 'when a document is updated' do before do - article.update_attributes(title: 'UPDATED', status: 'yellow') + article.update(title: 'UPDATED', status: 'yellow') ArticleWithCustomSerialization.__opensearch__.refresh_index! end diff --git a/opensearch-model/spec/opensearch/model/adapters/mongoid_spec.rb b/opensearch-model/spec/opensearch/model/adapters/mongoid_spec.rb index f8d28ac87..0078f9349 100644 --- a/opensearch-model/spec/opensearch/model/adapters/mongoid_spec.rb +++ b/opensearch-model/spec/opensearch/model/adapters/mongoid_spec.rb @@ -174,7 +174,7 @@ class DummyClassForMongoid; end context 'query criteria specified as a hash' do before do - expect(relation).to receive(:where).with(color: 'red').and_return(relation) + expect(relation).to receive(:where).with({ color: 'red' }).and_return(relation) end let(:query) do diff --git a/opensearch-model/spec/opensearch/model/importing_spec.rb b/opensearch-model/spec/opensearch/model/importing_spec.rb index f5e31a64c..dc45dca20 100644 --- a/opensearch-model/spec/opensearch/model/importing_spec.rb +++ b/opensearch-model/spec/opensearch/model/importing_spec.rb @@ -133,8 +133,8 @@ def importing_mixin context 'when the method is called with the force option' do before do - expect(DummyImportingModel).to receive(:create_index!).with(force: true, index: 'foo').and_return(true) - expect(DummyImportingModel).to receive(:__find_in_batches).with(foo: 'bar').and_return(true) + expect(DummyImportingModel).to receive(:create_index!).with({ force: true, index: 'foo' }).and_return(true) + expect(DummyImportingModel).to receive(:__find_in_batches).with({ foo: 'bar' }).and_return(true) end it 'deletes and creates the index' do @@ -145,8 +145,8 @@ def importing_mixin context 'when the method is called with the refresh option' do before do - expect(DummyImportingModel).to receive(:refresh_index!).with(index: 'foo').and_return(true) - expect(DummyImportingModel).to receive(:__find_in_batches).with(foo: 'bar').and_return(true) + expect(DummyImportingModel).to receive(:refresh_index!).with({ index: 'foo' }).and_return(true) + expect(DummyImportingModel).to receive(:__find_in_batches).with({ foo: 'bar' }).and_return(true) end it 'refreshes the index' do @@ -158,7 +158,7 @@ def importing_mixin before do expect(DummyImportingModel).to receive(:client).and_return(client) - expect(client).to receive(:bulk).with(body: nil, index: 'my-new-index').and_return(response) + expect(client).to receive(:bulk).with({ body: nil, index: 'my-new-index' }).and_return(response) end it 'uses the alternate index name' do @@ -219,7 +219,7 @@ def importing_mixin before do expect(DummyImportingModel).to receive(:client).and_return(client) - expect(client).to receive(:bulk).with(body: nil, index: 'foo', pipeline: 'my-pipeline').and_return(response) + expect(client).to receive(:bulk).with({ body: nil, index: 'foo', pipeline: 'my-pipeline' }).and_return(response) end it 'uses the pipeline option' do diff --git a/opensearch-model/spec/opensearch/model/indexing_spec.rb b/opensearch-model/spec/opensearch/model/indexing_spec.rb index 4e40bb835..60b57e43f 100644 --- a/opensearch-model/spec/opensearch/model/indexing_spec.rb +++ b/opensearch-model/spec/opensearch/model/indexing_spec.rb @@ -387,7 +387,7 @@ def changes context 'when no options are passed to the method' do before do - expect(client).to receive(:index).with(index: 'foo', id: '1', body: 'JSON').and_return(true) + expect(client).to receive(:index).with({ index: 'foo', id: '1', body: 'JSON' }).and_return(true) end it 'provides the method on an instance' do @@ -398,7 +398,7 @@ def changes context 'when extra options are passed to the method' do before do - expect(client).to receive(:index).with(index: 'foo', id: '1', body: 'JSON', parent: 'A').and_return(true) + expect(client).to receive(:index).with({ index: 'foo', id: '1', body: 'JSON', parent: 'A' }).and_return(true) end it 'passes the extra options to the method call on the client' do @@ -426,7 +426,7 @@ def changes context 'when no options are passed to the method' do before do - expect(client).to receive(:delete).with(index: 'foo', id: '1').and_return(true) + expect(client).to receive(:delete).with({ index: 'foo', id: '1' }).and_return(true) end it 'provides the method on an instance' do @@ -437,7 +437,7 @@ def changes context 'when extra options are passed to the method' do before do - expect(client).to receive(:delete).with(index: 'foo', id: '1', parent: 'A').and_return(true) + expect(client).to receive(:delete).with({ index: 'foo', id: '1', parent: 'A' }).and_return(true) end it 'passes the extra options to the method call on the client' do @@ -482,7 +482,7 @@ def changes before do instance.instance_variable_set(:@__changed_model_attributes, { foo: 'bar' }) - expect(client).to receive(:update).with(index: 'foo', id: '1', body: { doc: { foo: 'bar' } }).and_return(true) + expect(client).to receive(:update).with({ index: 'foo', id: '1', body: { doc: { foo: 'bar' } } }).and_return(true) end it 'updates the document' do @@ -498,7 +498,7 @@ def changes before do instance.instance_variable_set(:@__changed_model_attributes, {'foo' => 'B', 'bar' => 'D' }) - expect(client).to receive(:update).with(index: 'foo', id: '1', body: { doc: { foo: 'B' } }).and_return(true) + expect(client).to receive(:update).with({ index: 'foo', id: '1', body: { doc: { foo: 'B' } } }).and_return(true) end it 'updates the document' do @@ -528,9 +528,9 @@ def changes end before do - instance.instance_variable_set(:@__changed_model_attributes, { 'foo' => { 'bar' => 'BAR'} }) + instance.instance_variable_set(:@__changed_model_attributes, { 'foo' => { 'bar' => 'BAR' } }) expect(instance).to receive(:as_indexed_json).and_return('foo' => 'BAR') - expect(client).to receive(:update).with(index: 'foo', id: '1', body: { doc: { 'foo' => 'BAR' } }).and_return(true) + expect(client).to receive(:update).with({ index: 'foo', id: '1', body: { doc: { 'foo' => 'BAR' } } }).and_return(true) end it 'updates the document' do @@ -562,7 +562,7 @@ def changes context 'when no options are specified' do before do - expect(client).to receive(:update).with(index: 'foo', id: '1', body: { doc: { title: 'green' } }).and_return(true) + expect(client).to receive(:update).with({ index: 'foo', id: '1', body: { doc: { title: 'green' } } }).and_return(true) end it 'updates the document' do @@ -573,7 +573,7 @@ def changes context 'when extra options are provided' do before do - expect(client).to receive(:update).with(index: 'foo', id: '1', body: { doc: { title: 'green' } }, refresh: true).and_return(true) + expect(client).to receive(:update).with({ index: 'foo', id: '1', body: { doc: { title: 'green' } }, refresh: true }).and_return(true) end it 'updates the document' do @@ -701,7 +701,7 @@ class ::DummyIndexingModelForRecreate before do expect(DummyIndexingModelForRecreate).to receive(:client).and_return(client) - expect(indices).to receive(:delete).with(index: 'custom-foo') + expect(indices).to receive(:delete).with({ index: 'custom-foo' }) end let(:client) do @@ -764,7 +764,7 @@ class ::DummyIndexingModelForCreate end before do - expect(indices).to receive(:create).with(index: 'foo', body: expected_body).and_return(true) + expect(indices).to receive(:create).with({ index: 'foo', body: expected_body }).and_return(true) end it 'creates the index' do @@ -780,7 +780,7 @@ class ::DummyIndexingModelForCreate end before do - expect(indices).to receive(:create).with(index: 'foobar', body: expected_body).and_return(true) + expect(indices).to receive(:create).with({ index: 'foobar', body: expected_body }).and_return(true) end it 'creates the index' do @@ -826,7 +826,7 @@ class ::DummyIndexingModelForCreate before do expect(DummyIndexingModelForCreate).to receive(:client).and_return(client).twice expect(indices).to receive(:exists).and_return(false) - expect(indices).to receive(:create).with(index: 'custom-foo', body: expected_body) + expect(indices).to receive(:create).with({ index: 'custom-foo', body: expected_body }) end let(:expected_body) do @@ -930,7 +930,7 @@ class ::DummyIndexingModelForRefresh context 'when an index name is provided in the options' do before do - expect(indices).to receive(:refresh).with(index: 'custom-foo') + expect(indices).to receive(:refresh).with({ index: 'custom-foo' }) end it 'uses the index name' do diff --git a/opensearch-model/spec/opensearch/model/searching_search_request_spec.rb b/opensearch-model/spec/opensearch/model/searching_search_request_spec.rb index ce887cdd7..7a1bbd938 100644 --- a/opensearch-model/spec/opensearch/model/searching_search_request_spec.rb +++ b/opensearch-model/spec/opensearch/model/searching_search_request_spec.rb @@ -44,7 +44,7 @@ def self.document_type; 'bar'; end context 'when the search definition is a simple query' do before do - expect(client).to receive(:search).with(index: 'foo', q: 'foo').and_return({}) + expect(client).to receive(:search).with({ index: 'foo', q: 'foo' }).and_return({}) end let(:search) do @@ -59,7 +59,7 @@ def self.document_type; 'bar'; end context 'when the search definition is a hash' do before do - expect(client).to receive(:search).with(index: 'foo', body: { foo: 'bar' }).and_return({}) + expect(client).to receive(:search).with({ index: 'foo', body: { foo: 'bar' } }).and_return({}) end let(:search) do @@ -74,7 +74,7 @@ def self.document_type; 'bar'; end context 'when the search definition is a json string' do before do - expect(client).to receive(:search).with(index: 'foo', body: '{"foo":"bar"}').and_return({}) + expect(client).to receive(:search).with({ index: 'foo', body: '{"foo":"bar"}' }).and_return({}) end let(:search) do @@ -99,7 +99,7 @@ def to_hash; {foo: 'bar'}; end end before do - expect(client).to receive(:search).with(index: 'foo', body: {foo: 'bar'}).and_return({}) + expect(client).to receive(:search).with({ index: 'foo', body: { foo: 'bar' } }).and_return({}) end let(:search) do @@ -114,7 +114,7 @@ def to_hash; {foo: 'bar'}; end context 'when extra options are specified' do before do - expect(client).to receive(:search).with(index: 'foo', q: 'foo', size: 15).and_return({}) + expect(client).to receive(:search).with({ index: 'foo', q: 'foo', size: 15 }).and_return({}) end let(:search) do diff --git a/opensearch-model/spec/spec_helper.rb b/opensearch-model/spec/spec_helper.rb index 15cbef134..834499f60 100644 --- a/opensearch-model/spec/spec_helper.rb +++ b/opensearch-model/spec/spec_helper.rb @@ -42,7 +42,7 @@ config.before(:suite) do require 'ansi' tracer = ::Logger.new(STDERR) - tracer.formatter = lambda { |s, d, p, m| "#{m.gsub(/^.*$/) { |n| ' ' + n }.ansi(:faint)}\n" } + tracer.formatter = lambda { |s, d, p, m| "#{m&.gsub(/^.*$/) { |n| ' ' + n }&.ansi(:faint)}\n" } OpenSearch::Model.client = OpenSearch::Client.new host: OPENSEARCH_URL, tracer: (ENV['QUIET'] ? nil : tracer) puts "OpenSearch Version: #{OpenSearch::Model.client.info['version']}" diff --git a/opensearch-model/spec/support/app/article_for_pagination.rb b/opensearch-model/spec/support/app/article_for_pagination.rb index efbb0c641..1a3ceea09 100644 --- a/opensearch-model/spec/support/app/article_for_pagination.rb +++ b/opensearch-model/spec/support/app/article_for_pagination.rb @@ -18,6 +18,11 @@ class ::ArticleForPagination < ActiveRecord::Base include OpenSearch::Model + # NOTE: This was added to fix pagination tests in ruby 3. It is not clear why + # this is necessary since this should be done automatically by including + # `OpenSearch::Model`. + include OpenSearch::Model::Importing + scope :published, -> { where(published: true) } settings index: { number_of_shards: 1, number_of_replicas: 0 } do diff --git a/opensearch-model/spec/support/app/import_article.rb b/opensearch-model/spec/support/app/import_article.rb index 62744b567..5a754631a 100644 --- a/opensearch-model/spec/support/app/import_article.rb +++ b/opensearch-model/spec/support/app/import_article.rb @@ -17,6 +17,7 @@ class ImportArticle < ActiveRecord::Base include OpenSearch::Model + include OpenSearch::Model::Importing scope :popular, -> { where('views >= 5') } diff --git a/opensearch-persistence/lib/opensearch/persistence/version.rb b/opensearch-persistence/lib/opensearch/persistence/version.rb index fda4847c8..ded11bbc4 100644 --- a/opensearch-persistence/lib/opensearch/persistence/version.rb +++ b/opensearch-persistence/lib/opensearch/persistence/version.rb @@ -17,6 +17,6 @@ module OpenSearch module Persistence - VERSION = '1.0.0' + VERSION = '1.1.0' end end diff --git a/opensearch-persistence/opensearch-persistence.gemspec b/opensearch-persistence/opensearch-persistence.gemspec index 78f9cce83..e7f3068cc 100644 --- a/opensearch-persistence/opensearch-persistence.gemspec +++ b/opensearch-persistence/opensearch-persistence.gemspec @@ -23,7 +23,7 @@ require 'opensearch/persistence/version' Gem::Specification.new do |s| s.name = "opensearch-persistence" s.version = OpenSearch::Persistence::VERSION - s.authors = ["Compliance Innovations B.V."] + s.authors = ["CDD Solutions B.V."] s.email = ["developers@compliance-innovations.com"] s.description = "Persistence layer for Ruby models and OpenSearch." s.summary = "Persistence layer for Ruby models and OpenSearch." @@ -38,9 +38,9 @@ Gem::Specification.new do |s| s.extra_rdoc_files = [ "README.md", "LICENSE.txt" ] s.rdoc_options = [ "--charset=UTF-8" ] - s.required_ruby_version = ">= 1.9.3" + s.required_ruby_version = ">= 2.4" - s.add_dependency "opensearch-ruby", '~> 2.0' + s.add_dependency "opensearch-ruby", '>= 2.0' s.add_dependency "opensearch-model" s.add_dependency "activesupport", '> 4' s.add_dependency "activemodel", '> 4' @@ -51,7 +51,7 @@ Gem::Specification.new do |s| s.add_development_dependency "oj" unless defined?(JRUBY_VERSION) - s.add_development_dependency "rails", '> 4' + s.add_development_dependency "rails", '>= 6.1' s.add_development_dependency "minitest" s.add_development_dependency "test-unit" diff --git a/opensearch-rails/lib/opensearch/rails/version.rb b/opensearch-rails/lib/opensearch/rails/version.rb index 90142a6c2..d4d0fa1c7 100644 --- a/opensearch-rails/lib/opensearch/rails/version.rb +++ b/opensearch-rails/lib/opensearch/rails/version.rb @@ -17,6 +17,6 @@ module OpenSearch module Rails - VERSION = "1.0.0" + VERSION = "1.1.0" end end diff --git a/opensearch-rails/opensearch-rails.gemspec b/opensearch-rails/opensearch-rails.gemspec index 32dfa8906..4841c3b40 100644 --- a/opensearch-rails/opensearch-rails.gemspec +++ b/opensearch-rails/opensearch-rails.gemspec @@ -23,7 +23,7 @@ require 'opensearch/rails/version' Gem::Specification.new do |s| s.name = 'opensearch-rails' s.version = OpenSearch::Rails::VERSION - s.authors = ['Compliance Innovations B.V.'] + s.authors = ['CDD Solutions B.V.'] s.email = ['developers@compliance-innovations.com'] s.description = 'Ruby on Rails integrations for OpenSearch.' s.summary = 'Ruby on Rails integrations for OpenSearch.' @@ -52,7 +52,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'minitest' s.add_development_dependency 'mocha' s.add_development_dependency 'pry' - s.add_development_dependency 'rails', '> 3.1' + s.add_development_dependency 'rails', '> 6.1' s.add_development_dependency 'rake', '~> 12' s.add_development_dependency 'require-prof' s.add_development_dependency 'shoulda-context' diff --git a/opensearch-rails/spec/spec_helper.rb b/opensearch-rails/spec/spec_helper.rb index d6d94ad6b..e6658fe02 100644 --- a/opensearch-rails/spec/spec_helper.rb +++ b/opensearch-rails/spec/spec_helper.rb @@ -34,7 +34,7 @@ config.before(:suite) do require 'ansi' tracer = ::Logger.new(STDERR) - tracer.formatter = lambda { |s, d, p, m| "#{m.gsub(/^.*$/) { |n| ' ' + n }.ansi(:faint)}\n" } + tracer.formatter = lambda { |s, d, p, m| "#{m&.gsub(/^.*$/) { |n| ' ' + n }&.ansi(:faint)}\n" } OpenSearch::Model.client = OpenSearch::Client.new host: OPENSEARCH_URL, tracer: (ENV['QUIET'] ? nil : tracer) puts "OpenSearch Version: #{OpenSearch::Model.client.info['version']}"