From d104c2ce07c21d8e23834abfa41f9f27642762d2 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 8 Apr 2024 19:22:17 +0200 Subject: [PATCH 01/60] Update README --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6577bd9..a3fc869 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,10 @@ It's tested against : -* Rails 6.0.6 / 6.1.7 / 7.0.4 -* Ruby 2.7 / 3.0 / 3.1 -* SQLite3 -* Postgresql 13 -* MySQL 8 -* Oracle XE 11.2 (thanks to [travis-oracle](https://github.com/cbandy/travis-oracle)) +* Rails: 6.0.6 / 6.1.7 / 7.0.4 / 7.1.0 +* Ruby: 2.7 / 3.0 / 3.1 / 3.2 / 3.3 +* Databases: MySQL 8 / SQLite3 / Postgresql 16 / Oracle XE 11.2 (thanks to [travis-oracle](https://github.com/cbandy/travis-oracle)) +* Adapters: sqlite / mysql2 / trilogy / postgres / postgis / oracle ## Description From 51ce060c5becac23f974203cc92653a1e4250d2b Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 8 Apr 2024 19:24:04 +0200 Subject: [PATCH 02/60] Drop support for Ruby 2.7 --- .github/workflows/ci.yml | 9 +-------- .rubocop.yml | 2 +- README.md | 2 +- ajax-datatables-rails.gemspec | 2 +- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e98bb51..af7784b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,6 @@ jobs: - '3.2' - '3.1' - '3.0' - - '2.7' - 'head' rails: - rails_7.1.0 @@ -74,10 +73,6 @@ jobs: - rails: rails_7.1.0 adapter: oracle_enhanced - - rails: rails_7.1.0 - adapter: postgis - ruby: 2.7' - steps: - name: Checkout uses: actions/checkout@v4 @@ -121,9 +116,7 @@ jobs: DB_ADAPTER: ${{ matrix.adapter }} BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile run: | - if [[ "${RUBY_VERSION}" != "2.7" ]]; then - gem install bundler - fi + gem install bundler bundle config path vendor/bundle bundle install --jobs 4 --retry 3 diff --git a/.rubocop.yml b/.rubocop.yml index ba60a76..308bd07 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ AllCops: NewCops: enable SuggestExtensions: false - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.0 Exclude: - bin/* - lib/generators/**/*.rb diff --git a/README.md b/README.md index a3fc869..bc22eca 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ It's tested against : * Rails: 6.0.6 / 6.1.7 / 7.0.4 / 7.1.0 -* Ruby: 2.7 / 3.0 / 3.1 / 3.2 / 3.3 +* Ruby: 3.0 / 3.1 / 3.2 / 3.3 * Databases: MySQL 8 / SQLite3 / Postgresql 16 / Oracle XE 11.2 (thanks to [travis-oracle](https://github.com/cbandy/travis-oracle)) * Adapters: sqlite / mysql2 / trilogy / postgres / postgis / oracle diff --git a/ajax-datatables-rails.gemspec b/ajax-datatables-rails.gemspec index 09facdc..b1450e0 100644 --- a/ajax-datatables-rails.gemspec +++ b/ajax-datatables-rails.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |s| 'bug_tracker_uri' => 'https://github.com/jbox-web/ajax-datatables-rails/issues', } - s.required_ruby_version = '>= 2.7.0' + s.required_ruby_version = '>= 3.0.0' s.files = `git ls-files`.split("\n") From 470f1368e22e9711168af8d46836837e63a1c41e Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 8 Apr 2024 19:30:46 +0200 Subject: [PATCH 03/60] Drop support for Rails 6.0.x --- .github/workflows/ci.yml | 1 - README.md | 2 +- ajax-datatables-rails.gemspec | 2 +- appraisal.yml | 33 ------------------------------- gemfiles/rails_6.0.6.gemfile | 37 ----------------------------------- 5 files changed, 2 insertions(+), 73 deletions(-) delete mode 100644 gemfiles/rails_6.0.6.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af7784b..9b6488b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,6 @@ jobs: - rails_7.1.0 - rails_7.0.8 - rails_6.1.7 - - rails_6.0.6 adapter: - sqlite3 - postgresql diff --git a/README.md b/README.md index bc22eca..5a81fd5 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It's tested against : -* Rails: 6.0.6 / 6.1.7 / 7.0.4 / 7.1.0 +* Rails: 6.1.7 / 7.0.4 / 7.1.0 * Ruby: 3.0 / 3.1 / 3.2 / 3.3 * Databases: MySQL 8 / SQLite3 / Postgresql 16 / Oracle XE 11.2 (thanks to [travis-oracle](https://github.com/cbandy/travis-oracle)) * Adapters: sqlite / mysql2 / trilogy / postgres / postgis / oracle diff --git a/ajax-datatables-rails.gemspec b/ajax-datatables-rails.gemspec index b1450e0..dcdb9a6 100644 --- a/ajax-datatables-rails.gemspec +++ b/ajax-datatables-rails.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |s| s.files = `git ls-files`.split("\n") - s.add_runtime_dependency 'rails', '>= 6.0' + s.add_runtime_dependency 'rails', '>= 6.1' s.add_runtime_dependency 'zeitwerk' s.add_development_dependency 'activerecord-oracle_enhanced-adapter' diff --git a/appraisal.yml b/appraisal.yml index d0cdb88..ebda601 100644 --- a/appraisal.yml +++ b/appraisal.yml @@ -1,37 +1,4 @@ --- -6.0.6: - sqlite3: - version: ~> 1.4.0 - install_if: '-> { ENV["DB_ADAPTER"] == "sqlite3" }' - mysql2: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "mysql2" }' - activerecord-trilogy-adapter: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "trilogy" }' - activerecord-oracle_enhanced-adapter: - version: ~> 6.0.0 - install_if: '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' - ruby-oci8: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' - activerecord-postgis-adapter: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "postgis" }' - base64: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - bigdecimal: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - mutex_m: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - drb: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - - 6.1.7: sqlite3: version: ~> 1.4.0 diff --git a/gemfiles/rails_6.0.6.gemfile b/gemfiles/rails_6.0.6.gemfile deleted file mode 100644 index b7162e1..0000000 --- a/gemfiles/rails_6.0.6.gemfile +++ /dev/null @@ -1,37 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org/" - -gem "appraisal", git: "https://github.com/n-rodriguez/appraisal.git", branch: "wip/combustion" -gem "combustion", git: "https://github.com/pat/combustion.git" -gem "rails", "6.0.6" - -install_if -> { ENV["DB_ADAPTER"] == "sqlite3" } do - gem "sqlite3", "~> 1.4.0" -end - -install_if -> { ENV["DB_ADAPTER"] == "mysql2" } do - gem "mysql2" -end - -install_if -> { ENV["DB_ADAPTER"] == "trilogy" } do - gem "activerecord-trilogy-adapter" -end - -install_if -> { ENV["DB_ADAPTER"] == "oracle_enhanced" } do - gem "activerecord-oracle_enhanced-adapter", "~> 6.0.0" - gem "ruby-oci8" -end - -install_if -> { ENV["DB_ADAPTER"] == "postgis" } do - gem "activerecord-postgis-adapter" -end - -install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do - gem "base64" - gem "bigdecimal" - gem "mutex_m" - gem "drb" -end - -gemspec path: "../" From 2a44b9867ec79d94ad10144ea89a1dbf2d223e2e Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 8 Apr 2024 19:43:39 +0200 Subject: [PATCH 04/60] Remove dead code --- lib/ajax-datatables-rails/base.rb | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/lib/ajax-datatables-rails/base.rb b/lib/ajax-datatables-rails/base.rb index 208f120..3d8c421 100644 --- a/lib/ajax-datatables-rails/base.rb +++ b/lib/ajax-datatables-rails/base.rb @@ -4,22 +4,8 @@ module AjaxDatatablesRails class Base class << self - def rails_52? - Rails.gem_version >= Gem::Version.new('5.2') && Rails.gem_version <= Gem::Version.new('6.0') - end - - def rails_60? - Rails.gem_version >= Gem::Version.new('6.0') && Rails.gem_version <= Gem::Version.new('6.1') - end - def default_db_adapter - if rails_52? - ::ActiveRecord::Base.configurations.dig(Rails.env, 'adapter').downcase.to_sym - elsif rails_60? - ::ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).first.config['adapter'].downcase.to_sym - else - ::ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).first.adapter.downcase.to_sym - end + ::ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).first.adapter.downcase.to_sym end end From cdf2e6d00e02c5e837f49fc30d6d1f7c8f1a1397 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 8 Apr 2024 23:12:36 +0200 Subject: [PATCH 05/60] Improve objects shape --- lib/ajax-datatables-rails/base.rb | 6 ++++++ lib/ajax-datatables-rails/datatable/column.rb | 10 ++++++++++ lib/ajax-datatables-rails/datatable/datatable.rb | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/lib/ajax-datatables-rails/base.rb b/lib/ajax-datatables-rails/base.rb index 3d8c421..27c8529 100644 --- a/lib/ajax-datatables-rails/base.rb +++ b/lib/ajax-datatables-rails/base.rb @@ -20,6 +20,12 @@ def initialize(params, options = {}) @params = params @options = options @datatable = Datatable::Datatable.new(self) + + @connected_columns = nil + @searchable_columns = nil + @search_columns = nil + @records = nil + @build_conditions = nil end # User defined methods diff --git a/lib/ajax-datatables-rails/datatable/column.rb b/lib/ajax-datatables-rails/datatable/column.rb index 747e546..24edc84 100644 --- a/lib/ajax-datatables-rails/datatable/column.rb +++ b/lib/ajax-datatables-rails/datatable/column.rb @@ -16,6 +16,16 @@ def initialize(datatable, index, options) @index = index @options = options @view_column = datatable.view_columns[column_name] + + @model = nil + @field = nil + @type_cast = nil + @casted_column = nil + @search = nil + @delimiter = nil + @range_start = nil + @range_end = nil + validate_settings! end diff --git a/lib/ajax-datatables-rails/datatable/datatable.rb b/lib/ajax-datatables-rails/datatable/datatable.rb index ceaf63c..0d4e4d6 100644 --- a/lib/ajax-datatables-rails/datatable/datatable.rb +++ b/lib/ajax-datatables-rails/datatable/datatable.rb @@ -8,6 +8,10 @@ class Datatable def initialize(datatable) @datatable = datatable @options = datatable.params + + @orders = nil + @search = nil + @columns = nil end # ----------------- ORDER METHODS -------------------- From 7faacef64e0557499014f9cdd5b29dd6eaf2ef09 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 8 Apr 2024 23:21:01 +0200 Subject: [PATCH 06/60] Replace case/when by a hash lookup --- .../datatable/simple_order.rb | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/ajax-datatables-rails/datatable/simple_order.rb b/lib/ajax-datatables-rails/datatable/simple_order.rb index b7824b6..b817a58 100644 --- a/lib/ajax-datatables-rails/datatable/simple_order.rb +++ b/lib/ajax-datatables-rails/datatable/simple_order.rb @@ -41,17 +41,29 @@ def sort_nulls_last? column.nulls_last? || @nulls_last == true end + PG_NULL_STYLE = 'NULLS LAST' + MYSQL_NULL_STYLE = 'IS NULL' + private_constant :PG_NULL_STYLE + private_constant :MYSQL_NULL_STYLE + + NULL_STYLE_MAP = { + pg: PG_NULL_STYLE, + postgresql: PG_NULL_STYLE, + postgres: PG_NULL_STYLE, + postgis: PG_NULL_STYLE, + oracle: PG_NULL_STYLE, + mysql: MYSQL_NULL_STYLE, + mysql2: MYSQL_NULL_STYLE, + trilogy: MYSQL_NULL_STYLE, + sqlite: MYSQL_NULL_STYLE, + sqlite3: MYSQL_NULL_STYLE, + }.freeze + private_constant :NULL_STYLE_MAP + def nulls_last_sql return unless sort_nulls_last? - case @adapter - when :pg, :postgresql, :postgres, :oracle, :postgis - 'NULLS LAST' - when :mysql, :mysql2, :trilogy, :sqlite, :sqlite3 - 'IS NULL' - else - raise "unsupported database adapter: #{@adapter}" - end + NULL_STYLE_MAP[@adapter] || raise("unsupported database adapter: #{@adapter}") end end From fab2908f5e12edde7dd2d8f1fb4207df11778f46 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 8 Apr 2024 23:21:46 +0200 Subject: [PATCH 07/60] Improve objects shape --- lib/ajax-datatables-rails/datatable/column.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/ajax-datatables-rails/datatable/column.rb b/lib/ajax-datatables-rails/datatable/column.rb index 24edc84..4b23d4a 100644 --- a/lib/ajax-datatables-rails/datatable/column.rb +++ b/lib/ajax-datatables-rails/datatable/column.rb @@ -8,14 +8,15 @@ class Column include Order include DateFilter - attr_reader :datatable, :index, :options + attr_reader :datatable, :index, :options, :column_name attr_writer :search def initialize(datatable, index, options) @datatable = datatable @index = index @options = options - @view_column = datatable.view_columns[column_name] + @column_name = options[:data]&.to_sym + @view_column = datatable.view_columns[@column_name] @model = nil @field = nil @@ -29,10 +30,6 @@ def initialize(datatable, index, options) validate_settings! end - def column_name - @column_name ||= options[:data]&.to_sym - end - def data options[:data].presence || options[:name] end From dd899e25abc58c82150f0a2a0cc399304045c2ba Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 8 Apr 2024 23:25:11 +0200 Subject: [PATCH 08/60] Fix Rubocop offenses --- lib/ajax-datatables-rails/orm/active_record.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/ajax-datatables-rails/orm/active_record.rb b/lib/ajax-datatables-rails/orm/active_record.rb index fae27f3..b57ac9f 100644 --- a/lib/ajax-datatables-rails/orm/active_record.rb +++ b/lib/ajax-datatables-rails/orm/active_record.rb @@ -35,15 +35,14 @@ def build_conditions # rubocop:disable Metrics/AbcSize def build_conditions_for_datatable - columns = searchable_columns.reject(&:searched?) - criteria = search_for.inject([]) do |crit, atom| + columns = searchable_columns.reject(&:searched?) + search_for.inject([]) do |crit, atom| search = Datatable::SimpleSearch.new(value: atom, regex: datatable.search.regexp?) crit << columns.map do |simple_column| simple_column.search = search simple_column.search_query end.compact.reduce(:or) end.compact.reduce(:and) - criteria end # rubocop:enable Metrics/AbcSize From 92fa3441018e7bccde39994c19c803a4ecaa4994 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 8 Apr 2024 23:25:46 +0200 Subject: [PATCH 09/60] Remove useless local variable --- lib/ajax-datatables-rails/orm/active_record.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/ajax-datatables-rails/orm/active_record.rb b/lib/ajax-datatables-rails/orm/active_record.rb index b57ac9f..0ae8248 100644 --- a/lib/ajax-datatables-rails/orm/active_record.rb +++ b/lib/ajax-datatables-rails/orm/active_record.rb @@ -37,9 +37,8 @@ def build_conditions def build_conditions_for_datatable columns = searchable_columns.reject(&:searched?) search_for.inject([]) do |crit, atom| - search = Datatable::SimpleSearch.new(value: atom, regex: datatable.search.regexp?) crit << columns.map do |simple_column| - simple_column.search = search + simple_column.search = Datatable::SimpleSearch.new(value: atom, regex: datatable.search.regexp?) simple_column.search_query end.compact.reduce(:or) end.compact.reduce(:and) From 70e673cdee5315d648df29f1af933194c0c91b43 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 8 Apr 2024 23:35:23 +0200 Subject: [PATCH 10/60] Add tests on exceptions messages --- lib/ajax-datatables-rails/base.rb | 6 +++--- spec/ajax-datatables-rails/base_spec.rb | 21 ++++++++++++++++++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/ajax-datatables-rails/base.rb b/lib/ajax-datatables-rails/base.rb index 27c8529..e3f2b75 100644 --- a/lib/ajax-datatables-rails/base.rb +++ b/lib/ajax-datatables-rails/base.rb @@ -150,7 +150,7 @@ def draw_id end def raw_records_error_text - <<-ERROR + <<~ERROR You should implement this method in your class and specify how records are going to be retrieved from the database. @@ -158,7 +158,7 @@ def raw_records_error_text end def data_error_text - <<-ERROR + <<~ERROR You should implement this method in your class and return an array of arrays, or an array of hashes, as defined in the jQuery.dataTables @@ -167,7 +167,7 @@ def data_error_text end def view_columns_error_text - <<-ERROR + <<~ERROR You should implement this method in your class and return an array of database columns based on the columns displayed in the HTML view. diff --git a/spec/ajax-datatables-rails/base_spec.rb b/spec/ajax-datatables-rails/base_spec.rb index 17d3738..1936ab7 100644 --- a/spec/ajax-datatables-rails/base_spec.rb +++ b/spec/ajax-datatables-rails/base_spec.rb @@ -20,7 +20,13 @@ context 'when method is not defined by the user' do it 'raises an error' do datatable = described_class.new(sample_params) - expect { datatable.view_columns }.to raise_error NotImplementedError + expect { datatable.view_columns }.to raise_error(NotImplementedError).with_message(<<~ERROR) + + You should implement this method in your class and return an array + of database columns based on the columns displayed in the HTML view. + These columns should be represented in the ModelName.column_name, + or aliased_join_table.column_name notation. + ERROR end end @@ -36,7 +42,11 @@ context 'when method is not defined by the user' do it 'raises an error' do datatable = described_class.new(sample_params) - expect { datatable.get_raw_records }.to raise_error NotImplementedError + expect { datatable.get_raw_records }.to raise_error(NotImplementedError).with_message(<<~ERROR) + + You should implement this method in your class and specify + how records are going to be retrieved from the database. + ERROR end end end @@ -45,7 +55,12 @@ context 'when method is not defined by the user' do it 'raises an error' do datatable = described_class.new(sample_params) - expect { datatable.data }.to raise_error NotImplementedError + expect { datatable.data }.to raise_error(NotImplementedError).with_message(<<~ERROR) + + You should implement this method in your class and return an array + of arrays, or an array of hashes, as defined in the jQuery.dataTables + plugin documentation. + ERROR end end From f342bab7429a4c945d37f0ded12830a29bb9ea54 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 8 Apr 2024 23:36:03 +0200 Subject: [PATCH 11/60] Remove *_error_text methods --- lib/ajax-datatables-rails/base.rb | 48 ++++++++++++------------------- 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/lib/ajax-datatables-rails/base.rb b/lib/ajax-datatables-rails/base.rb index e3f2b75..da6624a 100644 --- a/lib/ajax-datatables-rails/base.rb +++ b/lib/ajax-datatables-rails/base.rb @@ -30,15 +30,30 @@ def initialize(params, options = {}) # User defined methods def view_columns - raise(NotImplementedError, view_columns_error_text) + raise(NotImplementedError, <<~ERROR) + + You should implement this method in your class and return an array + of database columns based on the columns displayed in the HTML view. + These columns should be represented in the ModelName.column_name, + or aliased_join_table.column_name notation. + ERROR end def get_raw_records - raise(NotImplementedError, raw_records_error_text) + raise(NotImplementedError, <<~ERROR) + + You should implement this method in your class and specify + how records are going to be retrieved from the database. + ERROR end def data - raise(NotImplementedError, data_error_text) + raise(NotImplementedError, <<~ERROR) + + You should implement this method in your class and return an array + of arrays, or an array of hashes, as defined in the jQuery.dataTables + plugin documentation. + ERROR end # ORM defined methods @@ -149,32 +164,5 @@ def draw_id params[:draw].present? ? { draw: params[:draw].to_i } : {} end - def raw_records_error_text - <<~ERROR - - You should implement this method in your class and specify - how records are going to be retrieved from the database. - ERROR - end - - def data_error_text - <<~ERROR - - You should implement this method in your class and return an array - of arrays, or an array of hashes, as defined in the jQuery.dataTables - plugin documentation. - ERROR - end - - def view_columns_error_text - <<~ERROR - - You should implement this method in your class and return an array - of database columns based on the columns displayed in the HTML view. - These columns should be represented in the ModelName.column_name, - or aliased_join_table.column_name notation. - ERROR - end - end end From db76973aba267054780319dd6e11d7fecdc4fbfa Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 8 Apr 2024 23:36:55 +0200 Subject: [PATCH 12/60] Fix Rubocop offenses --- .rubocop.yml | 3 +++ lib/ajax-datatables-rails/base.rb | 14 +++----------- lib/ajax-datatables-rails/datatable/column.rb | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 308bd07..2dce968 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -8,6 +8,9 @@ AllCops: - gemfiles/* - spec/**/* +Gemspec/DevelopmentDependencies: + Enabled: false + Style/Documentation: Enabled: false diff --git a/lib/ajax-datatables-rails/base.rb b/lib/ajax-datatables-rails/base.rb index da6624a..be075f3 100644 --- a/lib/ajax-datatables-rails/base.rb +++ b/lib/ajax-datatables-rails/base.rb @@ -101,23 +101,15 @@ def column_data(column) # helper methods def connected_columns - @connected_columns ||= begin - view_columns.keys.map do |field_name| - datatable.column_by(:data, field_name.to_s) - end.compact - end + @connected_columns ||= view_columns.keys.map { |field_name| datatable.column_by(:data, field_name.to_s) }.compact end def searchable_columns - @searchable_columns ||= begin - connected_columns.select(&:searchable?) - end + @searchable_columns ||= connected_columns.select(&:searchable?) end def search_columns - @search_columns ||= begin - searchable_columns.select(&:searched?) - end + @search_columns ||= searchable_columns.select(&:searched?) end def sanitize_data(data) diff --git a/lib/ajax-datatables-rails/datatable/column.rb b/lib/ajax-datatables-rails/datatable/column.rb index 4b23d4a..921c76c 100644 --- a/lib/ajax-datatables-rails/datatable/column.rb +++ b/lib/ajax-datatables-rails/datatable/column.rb @@ -100,7 +100,7 @@ def casted_column end def validate_settings! - raise AjaxDatatablesRails::Error::InvalidSearchColumn, "Unknown column. Check that `data` field is filled on JS side with the column name" if column_name.empty? + raise AjaxDatatablesRails::Error::InvalidSearchColumn, 'Unknown column. Check that `data` field is filled on JS side with the column name' if column_name.empty? raise AjaxDatatablesRails::Error::InvalidSearchColumn, "Check that column '#{column_name}' exists in view_columns" unless valid_search_column?(column_name) raise AjaxDatatablesRails::Error::InvalidSearchCondition, cond unless valid_search_condition?(cond) end From cbf654ef7e5f12c3ffc31aee3e39d68c839ccd03 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 8 Apr 2024 23:43:19 +0200 Subject: [PATCH 13/60] Fix Rubocop MFA offense --- ajax-datatables-rails.gemspec | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ajax-datatables-rails.gemspec b/ajax-datatables-rails.gemspec index dcdb9a6..a0c861f 100644 --- a/ajax-datatables-rails.gemspec +++ b/ajax-datatables-rails.gemspec @@ -13,10 +13,11 @@ Gem::Specification.new do |s| s.description = "A wrapper around datatable's ajax methods that allow synchronization with server-side pagination in a rails app" s.license = 'MIT' s.metadata = { - 'homepage_uri' => 'https://github.com/jbox-web/ajax-datatables-rails', - 'changelog_uri' => 'https://github.com/jbox-web/ajax-datatables-rails/blob/master/CHANGELOG.md', - 'source_code_uri' => 'https://github.com/jbox-web/ajax-datatables-rails', - 'bug_tracker_uri' => 'https://github.com/jbox-web/ajax-datatables-rails/issues', + 'homepage_uri' => 'https://github.com/jbox-web/ajax-datatables-rails', + 'changelog_uri' => 'https://github.com/jbox-web/ajax-datatables-rails/blob/master/CHANGELOG.md', + 'source_code_uri' => 'https://github.com/jbox-web/ajax-datatables-rails', + 'bug_tracker_uri' => 'https://github.com/jbox-web/ajax-datatables-rails/issues', + 'rubygems_mfa_required' => 'true', } s.required_ruby_version = '>= 3.0.0' From ff85109c8a2f5f934d92fd2a9a91706736f7ca15 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Tue, 9 Apr 2024 00:39:18 +0200 Subject: [PATCH 14/60] Improve object shape --- lib/ajax-datatables-rails/base.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ajax-datatables-rails/base.rb b/lib/ajax-datatables-rails/base.rb index be075f3..fba400c 100644 --- a/lib/ajax-datatables-rails/base.rb +++ b/lib/ajax-datatables-rails/base.rb @@ -21,6 +21,7 @@ def initialize(params, options = {}) @options = options @datatable = Datatable::Datatable.new(self) + @view_columns = nil @connected_columns = nil @searchable_columns = nil @search_columns = nil From 74da2c50b370ef0d40bd795cc51d854e718e3f01 Mon Sep 17 00:00:00 2001 From: Jonathan Chan Date: Tue, 19 Mar 2024 21:56:42 -0500 Subject: [PATCH 15/60] Adding searchable false test case --- CHANGELOG.md | 2 ++ .../datatable/column_spec.rb | 8 +++++ .../datatable/datatable_spec.rb | 4 +-- .../orm/active_record_filter_records_spec.rb | 35 ++++++++++++------- spec/support/datatables/complex_datatable.rb | 2 ++ spec/support/helpers/params.rb | 6 ++++ spec/support/models/user.rb | 8 +++++ 7 files changed, 51 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f915a5e..ca0e88a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # CHANGELOG +* Implementing `searchable: false` tests + ## 1.5.0 (2024-04-08) * Drop support of Rails 5.2 diff --git a/spec/ajax-datatables-rails/datatable/column_spec.rb b/spec/ajax-datatables-rails/datatable/column_spec.rb index 772694a..69738ab 100644 --- a/spec/ajax-datatables-rails/datatable/column_spec.rb +++ b/spec/ajax-datatables-rails/datatable/column_spec.rb @@ -128,6 +128,14 @@ end end + describe 'unsearchable column' do + let(:column) { datatable.datatable.columns.find{ |c| c.data == 'email_hash' } } + + it 'is not searchable' do + expect(column.searchable?).to eql(false) + end + end + describe '#formatter' do let(:datatable) { DatatableWithFormater.new(sample_params) } let(:column) { datatable.datatable.columns.find { |c| c.data == 'last_name' } } diff --git a/spec/ajax-datatables-rails/datatable/datatable_spec.rb b/spec/ajax-datatables-rails/datatable/datatable_spec.rb index 6d26628..7e8f977 100644 --- a/spec/ajax-datatables-rails/datatable/datatable_spec.rb +++ b/spec/ajax-datatables-rails/datatable/datatable_spec.rb @@ -40,8 +40,8 @@ end shared_examples 'columns methods' do - it 'has 7 columns' do - expect(datatable.columns.count).to eq(7) + it 'has 8 columns' do + expect(datatable.columns.count).to eq(8) end it 'child class' do diff --git a/spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb b/spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb index 6ee96bb..8f59020 100644 --- a/spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb +++ b/spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb @@ -12,12 +12,23 @@ expect { datatable.filter_records }.to raise_error(ArgumentError) end - it 'performs a simple search first' do - datatable.params[:search] = { value: 'msmith' } - expect(datatable).to receive(:build_conditions_for_datatable) - datatable.filter_records(records) + context 'with simple search' do + before do + datatable.params[:search] = { value: 'msmith' } + end + + it 'performs a simple search first' do + expect(datatable).to receive(:build_conditions_for_datatable) + datatable.filter_records(records) + end + + it 'does not search unsearchable fields' do + criteria = datatable.filter_records(records) + expect(criteria.to_sql).not_to include('email_hash') + end end + it 'performs a composite search second' do datatable.params[:search] = { value: '' } expect(datatable).to receive(:build_conditions_for_selected_columns) @@ -246,7 +257,7 @@ context 'when range is empty' do it 'does not filter records' do - datatable.params[:columns]['6'][:search][:value] = '-' + datatable.params[:columns]['7'][:search][:value] = '-' expect(datatable.data.size).to eq 2 item = datatable.data.first expect(item[:last_name]).to eq 'Doe' @@ -255,21 +266,21 @@ context 'when start date is filled' do it 'filters records created after this date' do - datatable.params[:columns]['6'][:search][:value] = '31/12/1999-' + datatable.params[:columns]['7'][:search][:value] = '31/12/1999-' expect(datatable.data.size).to eq 2 end end context 'when end date is filled' do it 'filters records created before this date' do - datatable.params[:columns]['6'][:search][:value] = '-31/12/1999' + datatable.params[:columns]['7'][:search][:value] = '-31/12/1999' expect(datatable.data.size).to eq 0 end end context 'when both date are filled' do it 'filters records created between the range' do - datatable.params[:columns]['6'][:search][:value] = '01/12/1999-15/01/2000' + datatable.params[:columns]['7'][:search][:value] = '01/12/1999-15/01/2000' expect(datatable.data.size).to eq 1 end end @@ -278,7 +289,7 @@ context 'when range is empty' do it 'filters records' do datatable.params[:columns]['0'][:search][:value] = 'doe' - datatable.params[:columns]['6'][:search][:value] = '-' + datatable.params[:columns]['7'][:search][:value] = '-' expect(datatable.data.size).to eq 1 item = datatable.data.first expect(item[:last_name]).to eq 'Doe' @@ -288,7 +299,7 @@ context 'when start date is filled' do it 'filters records' do datatable.params[:columns]['0'][:search][:value] = 'doe' - datatable.params[:columns]['6'][:search][:value] = '01/12/1999-' + datatable.params[:columns]['7'][:search][:value] = '01/12/1999-' expect(datatable.data.size).to eq 1 item = datatable.data.first expect(item[:last_name]).to eq 'Doe' @@ -298,7 +309,7 @@ context 'when end date is filled' do it 'filters records' do datatable.params[:columns]['0'][:search][:value] = 'doe' - datatable.params[:columns]['6'][:search][:value] = '-15/01/2000' + datatable.params[:columns]['7'][:search][:value] = '-15/01/2000' expect(datatable.data.size).to eq 1 item = datatable.data.first expect(item[:last_name]).to eq 'Doe' @@ -308,7 +319,7 @@ context 'when both date are filled' do it 'filters records' do datatable.params[:columns]['0'][:search][:value] = 'doe' - datatable.params[:columns]['6'][:search][:value] = '01/12/1999-15/01/2000' + datatable.params[:columns]['7'][:search][:value] = '01/12/1999-15/01/2000' expect(datatable.data.size).to eq 1 item = datatable.data.first expect(item[:last_name]).to eq 'Doe' diff --git a/spec/support/datatables/complex_datatable.rb b/spec/support/datatables/complex_datatable.rb index 6969f74..ece7ee4 100644 --- a/spec/support/datatables/complex_datatable.rb +++ b/spec/support/datatables/complex_datatable.rb @@ -9,6 +9,7 @@ def view_columns last_name: { source: 'User.last_name' }, full_name: { source: 'full_name' }, post_id: { source: 'User.post_id', orderable: false }, + email_hash: { source: 'email_hash', searchable: false }, created_at: { source: 'User.created_at' }, } end @@ -22,6 +23,7 @@ def data last_name: record.last_name, full_name: record.full_name, post_id: record.post_id, + email_hash: record.email_hash, created_at: record.created_at, } end diff --git a/spec/support/helpers/params.rb b/spec/support/helpers/params.rb index 406b038..dff2e79 100644 --- a/spec/support/helpers/params.rb +++ b/spec/support/helpers/params.rb @@ -43,6 +43,12 @@ def sample_params } }, '6' => { + 'data' => 'email_hash', 'name' => '', 'searchable' => 'false', 'orderable' => 'true', + 'search' => { + 'value' => '', 'regex' => 'false' + } + }, + '7' => { 'data' => 'created_at', 'name' => '', 'searchable' => 'true', 'orderable' => 'true', 'search' => { 'value' => '', 'regex' => 'false' diff --git a/spec/support/models/user.rb b/spec/support/models/user.rb index 7ad18b2..887efd9 100644 --- a/spec/support/models/user.rb +++ b/spec/support/models/user.rb @@ -1,7 +1,15 @@ # frozen_string_literal: true +require 'digest' + class User < ActiveRecord::Base def full_name "#{first_name} #{last_name}" end + + def email_hash + return nil if email.nil? + + Digest::SHA256.hexdigest email + end end From aab8d990cde8f44e3a0cb9df315c8e8b484872cf Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 2 Aug 2024 00:58:58 +0200 Subject: [PATCH 16/60] Update sqlite3 development dependency --- ajax-datatables-rails.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ajax-datatables-rails.gemspec b/ajax-datatables-rails.gemspec index a0c861f..cebd035 100644 --- a/ajax-datatables-rails.gemspec +++ b/ajax-datatables-rails.gemspec @@ -43,5 +43,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'rspec-retry' s.add_development_dependency 'rubocop' s.add_development_dependency 'simplecov' - s.add_development_dependency 'sqlite3', '~> 1.4.0' + s.add_development_dependency 'sqlite3', '~> 1.5.0' end From ef74896adcf6b14e6e40df2e5e2a45f1e2369656 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 2 Aug 2024 01:26:12 +0200 Subject: [PATCH 17/60] Update GithubActions actions --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b6488b..380b452 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,7 +120,7 @@ jobs: bundle install --jobs 4 --retry 3 - name: RSpec & publish code coverage - uses: paambaati/codeclimate-action@v5.0.0 + uses: paambaati/codeclimate-action@v8.0.0 env: RAILS_VERSION: ${{ matrix.rails }} DB_ADAPTER: ${{ matrix.adapter }} From 17514718790d95ab00eb35a79ceb6819e71dbe69 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 2 Aug 2024 02:31:21 +0200 Subject: [PATCH 18/60] Remove actions/cache@v4 from GithubActions --- .github/workflows/ci.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 380b452..60ca205 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,14 +100,6 @@ jobs: sudo ln -s ${ORACLE_HOME}/lib/libnnz11.so /usr/lib/libnnz11.so fi - - name: Setup Ruby cache - uses: actions/cache@v4 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ matrix.adapter }}-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ matrix.adapter }}- - - name: Bundle env: RUBY_VERSION: ${{ matrix.ruby }} From f808c158c04bd3d1cc457c488b1423827c82f6e9 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 5 Aug 2024 02:02:41 +0200 Subject: [PATCH 19/60] Improve dependencies settings --- Gemfile | 17 ++++++++++++++++- ajax-datatables-rails.gemspec | 22 ++-------------------- appraisal.yml | 6 +++--- gemfiles/rails_6.1.7.gemfile | 17 +++++++++++++++-- gemfiles/rails_7.0.8.gemfile | 17 +++++++++++++++-- gemfiles/rails_7.1.0.gemfile | 17 +++++++++++++++-- 6 files changed, 66 insertions(+), 30 deletions(-) diff --git a/Gemfile b/Gemfile index e145353..11ed664 100644 --- a/Gemfile +++ b/Gemfile @@ -5,4 +5,19 @@ source 'https://rubygems.org/' gemspec gem 'appraisal', git: 'https://github.com/n-rodriguez/appraisal.git', branch: 'wip/combustion' -gem 'combustion', git: 'https://github.com/pat/combustion.git' + +# gem 'activerecord-oracle_enhanced-adapter' +gem 'combustion' +gem 'database_cleaner' +gem 'factory_bot' +gem 'faker' +gem 'generator_spec' +gem 'guard-rspec' +gem 'pg' +gem 'pry' +gem 'puma' +gem 'rake' +gem 'rspec' +gem 'rspec-retry' +gem 'rubocop' +gem 'simplecov' diff --git a/ajax-datatables-rails.gemspec b/ajax-datatables-rails.gemspec index cebd035..4d98273 100644 --- a/ajax-datatables-rails.gemspec +++ b/ajax-datatables-rails.gemspec @@ -24,24 +24,6 @@ Gem::Specification.new do |s| s.files = `git ls-files`.split("\n") - s.add_runtime_dependency 'rails', '>= 6.1' - s.add_runtime_dependency 'zeitwerk' - - s.add_development_dependency 'activerecord-oracle_enhanced-adapter' - s.add_development_dependency 'appraisal' - s.add_development_dependency 'combustion', '~> 1.3' - s.add_development_dependency 'database_cleaner' - s.add_development_dependency 'factory_bot' - s.add_development_dependency 'faker' - s.add_development_dependency 'generator_spec' - s.add_development_dependency 'guard-rspec' - s.add_development_dependency 'pg' - s.add_development_dependency 'pry' - s.add_development_dependency 'puma' - s.add_development_dependency 'rake' - s.add_development_dependency 'rspec' - s.add_development_dependency 'rspec-retry' - s.add_development_dependency 'rubocop' - s.add_development_dependency 'simplecov' - s.add_development_dependency 'sqlite3', '~> 1.5.0' + s.add_dependency 'rails', '>= 6.1' + s.add_dependency 'zeitwerk' end diff --git a/appraisal.yml b/appraisal.yml index ebda601..7622cce 100644 --- a/appraisal.yml +++ b/appraisal.yml @@ -1,7 +1,7 @@ --- 6.1.7: sqlite3: - version: ~> 1.4.0 + version: ~> 1.5.0 install_if: '-> { ENV["DB_ADAPTER"] == "sqlite3" }' mysql2: version: '' @@ -34,7 +34,7 @@ 7.0.8: sqlite3: - version: ~> 1.4.0 + version: ~> 1.5.0 install_if: '-> { ENV["DB_ADAPTER"] == "sqlite3" }' mysql2: version: '' @@ -67,7 +67,7 @@ 7.1.0: sqlite3: - version: ~> 1.4.0 + version: ~> 1.5.0 install_if: '-> { ENV["DB_ADAPTER"] == "sqlite3" }' mysql2: version: '' diff --git a/gemfiles/rails_6.1.7.gemfile b/gemfiles/rails_6.1.7.gemfile index 5d03cbf..894773d 100644 --- a/gemfiles/rails_6.1.7.gemfile +++ b/gemfiles/rails_6.1.7.gemfile @@ -3,11 +3,24 @@ source "https://rubygems.org/" gem "appraisal", git: "https://github.com/n-rodriguez/appraisal.git", branch: "wip/combustion" -gem "combustion", git: "https://github.com/pat/combustion.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pg" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "simplecov" gem "rails", "6.1.7" install_if -> { ENV["DB_ADAPTER"] == "sqlite3" } do - gem "sqlite3", "~> 1.4.0" + gem "sqlite3", "~> 1.5.0" end install_if -> { ENV["DB_ADAPTER"] == "mysql2" } do diff --git a/gemfiles/rails_7.0.8.gemfile b/gemfiles/rails_7.0.8.gemfile index 95f76e6..bc42438 100644 --- a/gemfiles/rails_7.0.8.gemfile +++ b/gemfiles/rails_7.0.8.gemfile @@ -3,11 +3,24 @@ source "https://rubygems.org/" gem "appraisal", git: "https://github.com/n-rodriguez/appraisal.git", branch: "wip/combustion" -gem "combustion", git: "https://github.com/pat/combustion.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pg" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "simplecov" gem "rails", "7.0.8" install_if -> { ENV["DB_ADAPTER"] == "sqlite3" } do - gem "sqlite3", "~> 1.4.0" + gem "sqlite3", "~> 1.5.0" end install_if -> { ENV["DB_ADAPTER"] == "mysql2" } do diff --git a/gemfiles/rails_7.1.0.gemfile b/gemfiles/rails_7.1.0.gemfile index d1af3c9..fa72c32 100644 --- a/gemfiles/rails_7.1.0.gemfile +++ b/gemfiles/rails_7.1.0.gemfile @@ -3,11 +3,24 @@ source "https://rubygems.org/" gem "appraisal", git: "https://github.com/n-rodriguez/appraisal.git", branch: "wip/combustion" -gem "combustion", git: "https://github.com/pat/combustion.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pg" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "simplecov" gem "rails", "7.1.0" install_if -> { ENV["DB_ADAPTER"] == "sqlite3" } do - gem "sqlite3", "~> 1.4.0" + gem "sqlite3", "~> 1.5.0" end install_if -> { ENV["DB_ADAPTER"] == "mysql2" } do From d77e38210b39983c6ff95f7462bd1ee19b109299 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 5 Aug 2024 02:09:39 +0200 Subject: [PATCH 20/60] Remove useless file --- .rspec | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .rspec diff --git a/.rspec b/.rspec deleted file mode 100644 index 4e1e0d2..0000000 --- a/.rspec +++ /dev/null @@ -1 +0,0 @@ ---color From 1a6ec89554a1820ff848144bae7587e845b8f7f1 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 5 Aug 2024 02:10:04 +0200 Subject: [PATCH 21/60] Improve GithubActions settings --- .github/workflows/ci.yml | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60ca205..ef59763 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,8 @@ jobs: rspec: runs-on: ubuntu-latest - env: + env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails }}.gemfile ORACLE_COOKIE: sqldev ORACLE_FILE: oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip ORACLE_HOME: /u01/app/oracle/product/11.2.0/xe @@ -76,14 +77,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - - name: Set DB Adapter env: - RAILS_VERSION: ${{ matrix.rails }} DB_ADAPTER: ${{ matrix.adapter }} CUSTOM_ORACLE_FILE: ${{ secrets.CUSTOM_ORACLE_FILE }} @@ -100,23 +95,18 @@ jobs: sudo ln -s ${ORACLE_HOME}/lib/libnnz11.so /usr/lib/libnnz11.so fi - - name: Bundle + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true env: - RUBY_VERSION: ${{ matrix.ruby }} - RAILS_VERSION: ${{ matrix.rails }} DB_ADAPTER: ${{ matrix.adapter }} - BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile - run: | - gem install bundler - bundle config path vendor/bundle - bundle install --jobs 4 --retry 3 - name: RSpec & publish code coverage uses: paambaati/codeclimate-action@v8.0.0 env: - RAILS_VERSION: ${{ matrix.rails }} DB_ADAPTER: ${{ matrix.adapter }} - BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} with: coverageCommand: bin/rake From a0d7389d19571975a061f0191bbbf2661cb1b961 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sun, 11 Aug 2024 05:28:37 +0200 Subject: [PATCH 22/60] Ignore MacOS files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 5c8920d..bb537c9 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ spec/dummy/db/*.sqlite3 spec/dummy/db/*.sqlite3-journal spec/dummy/log/*.log spec/dummy/tmp/ + +# Ignore MacOS files +.DS_Store From a2d1efbd27fd55b2af7ab713a6b6993f6aff2335 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 6 Sep 2024 17:04:55 +0200 Subject: [PATCH 23/60] Minor change --- Guardfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Guardfile b/Guardfile index 1517596..5a44087 100644 --- a/Guardfile +++ b/Guardfile @@ -1,6 +1,6 @@ # frozen_string_literal: true -guard :rspec, cmd: 'bundle exec rspec' do +guard :rspec, cmd: 'bin/rspec' do require 'guard/rspec/dsl' dsl = Guard::RSpec::Dsl.new(self) From db0356ca49ec98ab730b44647307cf755306182a Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 6 Sep 2024 17:07:32 +0200 Subject: [PATCH 24/60] Drop support for Rails 6.1 --- .github/workflows/ci.yml | 1 - ajax-datatables-rails.gemspec | 2 +- appraisal.yml | 33 ----------------------- gemfiles/rails_6.1.7.gemfile | 50 ----------------------------------- 4 files changed, 1 insertion(+), 85 deletions(-) delete mode 100644 gemfiles/rails_6.1.7.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef59763..8961a08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,6 @@ jobs: rails: - rails_7.1.0 - rails_7.0.8 - - rails_6.1.7 adapter: - sqlite3 - postgresql diff --git a/ajax-datatables-rails.gemspec b/ajax-datatables-rails.gemspec index 4d98273..1c2ddb1 100644 --- a/ajax-datatables-rails.gemspec +++ b/ajax-datatables-rails.gemspec @@ -24,6 +24,6 @@ Gem::Specification.new do |s| s.files = `git ls-files`.split("\n") - s.add_dependency 'rails', '>= 6.1' + s.add_dependency 'rails', '>= 7.0' s.add_dependency 'zeitwerk' end diff --git a/appraisal.yml b/appraisal.yml index 7622cce..0b1c73f 100644 --- a/appraisal.yml +++ b/appraisal.yml @@ -1,37 +1,4 @@ --- -6.1.7: - sqlite3: - version: ~> 1.5.0 - install_if: '-> { ENV["DB_ADAPTER"] == "sqlite3" }' - mysql2: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "mysql2" }' - activerecord-trilogy-adapter: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "trilogy" }' - activerecord-oracle_enhanced-adapter: - version: ~> 6.1.0 - install_if: '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' - ruby-oci8: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' - activerecord-postgis-adapter: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "postgis" }' - base64: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - bigdecimal: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - mutex_m: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - drb: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - - 7.0.8: sqlite3: version: ~> 1.5.0 diff --git a/gemfiles/rails_6.1.7.gemfile b/gemfiles/rails_6.1.7.gemfile deleted file mode 100644 index 894773d..0000000 --- a/gemfiles/rails_6.1.7.gemfile +++ /dev/null @@ -1,50 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org/" - -gem "appraisal", git: "https://github.com/n-rodriguez/appraisal.git", branch: "wip/combustion" -gem "combustion" -gem "database_cleaner" -gem "factory_bot" -gem "faker" -gem "generator_spec" -gem "guard-rspec" -gem "pg" -gem "pry" -gem "puma" -gem "rake" -gem "rspec" -gem "rspec-retry" -gem "rubocop" -gem "simplecov" -gem "rails", "6.1.7" - -install_if -> { ENV["DB_ADAPTER"] == "sqlite3" } do - gem "sqlite3", "~> 1.5.0" -end - -install_if -> { ENV["DB_ADAPTER"] == "mysql2" } do - gem "mysql2" -end - -install_if -> { ENV["DB_ADAPTER"] == "trilogy" } do - gem "activerecord-trilogy-adapter" -end - -install_if -> { ENV["DB_ADAPTER"] == "oracle_enhanced" } do - gem "activerecord-oracle_enhanced-adapter", "~> 6.1.0" - gem "ruby-oci8" -end - -install_if -> { ENV["DB_ADAPTER"] == "postgis" } do - gem "activerecord-postgis-adapter" -end - -install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do - gem "base64" - gem "bigdecimal" - gem "mutex_m" - gem "drb" -end - -gemspec path: "../" From 761758b6590a3fd82b62bb09faf083e20d070764 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 6 Sep 2024 17:12:46 +0200 Subject: [PATCH 25/60] Add some Rubocop extensions --- .rubocop.yml | 8 +++++++- Gemfile | 4 ++++ gemfiles/rails_7.0.8.gemfile | 4 ++++ gemfiles/rails_7.1.0.gemfile | 4 ++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 2dce968..209a163 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,12 @@ +--- +require: + - rubocop-factory_bot + - rubocop-performance + - rubocop-rake + - rubocop-rspec + AllCops: NewCops: enable - SuggestExtensions: false TargetRubyVersion: 3.0 Exclude: - bin/* diff --git a/Gemfile b/Gemfile index 11ed664..f6dbad7 100644 --- a/Gemfile +++ b/Gemfile @@ -20,4 +20,8 @@ gem 'rake' gem 'rspec' gem 'rspec-retry' gem 'rubocop' +gem 'rubocop-factory_bot' +gem 'rubocop-performance' +gem 'rubocop-rake' +gem 'rubocop-rspec' gem 'simplecov' diff --git a/gemfiles/rails_7.0.8.gemfile b/gemfiles/rails_7.0.8.gemfile index bc42438..f986146 100644 --- a/gemfiles/rails_7.0.8.gemfile +++ b/gemfiles/rails_7.0.8.gemfile @@ -16,6 +16,10 @@ gem "rake" gem "rspec" gem "rspec-retry" gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" gem "simplecov" gem "rails", "7.0.8" diff --git a/gemfiles/rails_7.1.0.gemfile b/gemfiles/rails_7.1.0.gemfile index fa72c32..441f505 100644 --- a/gemfiles/rails_7.1.0.gemfile +++ b/gemfiles/rails_7.1.0.gemfile @@ -16,6 +16,10 @@ gem "rake" gem "rspec" gem "rspec-retry" gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" gem "simplecov" gem "rails", "7.1.0" From 5b6ffee499efc28be95c94b3b25fb022f99f9315 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 6 Sep 2024 17:16:46 +0200 Subject: [PATCH 26/60] Fix Rubocop offenses --- Appraisals | 10 ++++------ Rakefile | 1 + lib/ajax-datatables-rails/base.rb | 2 +- lib/ajax-datatables-rails/orm/active_record.rb | 9 +++------ 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Appraisals b/Appraisals index 4d4315d..7536e56 100644 --- a/Appraisals +++ b/Appraisals @@ -2,7 +2,7 @@ require 'yaml' -rails_versions = YAML.safe_load(File.read('appraisal.yml')) +rails_versions = YAML.safe_load_file('appraisal.yml') rails_versions.each do |version, gems| appraise "rails_#{version}" do @@ -16,12 +16,10 @@ rails_versions.each do |version, gems| gem name, opts['version'] end end + elsif opts['version'].empty? + gem name else - if opts['version'].empty? - gem name - else - gem name, opts['version'] - end + gem name, opts['version'] end end end diff --git a/Rakefile b/Rakefile index 5ae0611..5de361c 100644 --- a/Rakefile +++ b/Rakefile @@ -6,6 +6,7 @@ require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) task default: :spec +desc 'Open a Ruby irb console with the gem loaded' task :console do require 'pry' require 'rails' diff --git a/lib/ajax-datatables-rails/base.rb b/lib/ajax-datatables-rails/base.rb index fba400c..059e698 100644 --- a/lib/ajax-datatables-rails/base.rb +++ b/lib/ajax-datatables-rails/base.rb @@ -102,7 +102,7 @@ def column_data(column) # helper methods def connected_columns - @connected_columns ||= view_columns.keys.map { |field_name| datatable.column_by(:data, field_name.to_s) }.compact + @connected_columns ||= view_columns.keys.filter_map { |field_name| datatable.column_by(:data, field_name.to_s) } end def searchable_columns diff --git a/lib/ajax-datatables-rails/orm/active_record.rb b/lib/ajax-datatables-rails/orm/active_record.rb index 0ae8248..6ed48a9 100644 --- a/lib/ajax-datatables-rails/orm/active_record.rb +++ b/lib/ajax-datatables-rails/orm/active_record.rb @@ -33,20 +33,17 @@ def build_conditions end end - # rubocop:disable Metrics/AbcSize def build_conditions_for_datatable columns = searchable_columns.reject(&:searched?) search_for.inject([]) do |crit, atom| - crit << columns.map do |simple_column| + crit << columns.filter_map do |simple_column| simple_column.search = Datatable::SimpleSearch.new(value: atom, regex: datatable.search.regexp?) simple_column.search_query - end.compact.reduce(:or) + end.reduce(:or) end.compact.reduce(:and) end - # rubocop:enable Metrics/AbcSize - def build_conditions_for_selected_columns - search_columns.map(&:search_query).compact.reduce(:and) + search_columns.filter_map(&:search_query).reduce(:and) end def search_for From 2fd1569b8f5ae56132d444457b0324912e5a2fa6 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 6 Sep 2024 17:23:31 +0200 Subject: [PATCH 27/60] Cleanup Rubocop config, fix offenses --- .rubocop.yml | 54 +++++++++---------- lib/ajax-datatables-rails/base.rb | 4 +- lib/ajax-datatables-rails/datatable/column.rb | 4 +- .../datatable/column/search.rb | 2 +- 4 files changed, 31 insertions(+), 33 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 209a163..c576291 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,54 +14,50 @@ AllCops: - gemfiles/* - spec/**/* -Gemspec/DevelopmentDependencies: - Enabled: false +######### +# STYLE # +######### Style/Documentation: Enabled: false -Layout/HashAlignment: - Enabled: false +Style/TrailingCommaInArrayLiteral: + EnforcedStyleForMultiline: comma -Layout/EmptyLines: - Enabled: false +Style/TrailingCommaInHashLiteral: + EnforcedStyleForMultiline: comma -Layout/EmptyLinesAroundClassBody: - Enabled: false +########## +# LAYOUT # +########## -Layout/EmptyLinesAroundBlockBody: - Enabled: false +Layout/LineLength: + Exclude: + - ajax-datatables-rails.gemspec -Layout/EmptyLinesAroundModuleBody: +Layout/EmptyLines: Enabled: false Layout/EmptyLineBetweenDefs: Enabled: false -Metrics/CyclomaticComplexity: - Max: 7 +Layout/EmptyLinesAroundClassBody: + Enabled: false -Metrics/LineLength: +Layout/EmptyLinesAroundBlockBody: Enabled: false -Metrics/BlockLength: - Max: 30 +Layout/EmptyLinesAroundModuleBody: + Enabled: false -Metrics/MethodLength: - Max: 15 +Layout/HashAlignment: + EnforcedColonStyle: table + EnforcedHashRocketStyle: table -Metrics/ClassLength: - Max: 130 - -Naming/AccessorMethodName: - Enabled: false +########## +# NAMING # +########## Naming/FileName: Exclude: - lib/ajax-datatables-rails.rb - -Style/TrailingCommaInArrayLiteral: - EnforcedStyleForMultiline: comma - -Style/TrailingCommaInHashLiteral: - EnforcedStyleForMultiline: comma diff --git a/lib/ajax-datatables-rails/base.rb b/lib/ajax-datatables-rails/base.rb index 059e698..4d52fee 100644 --- a/lib/ajax-datatables-rails/base.rb +++ b/lib/ajax-datatables-rails/base.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module AjaxDatatablesRails - class Base + class Base # rubocop:disable Metrics/ClassLength class << self def default_db_adapter @@ -40,7 +40,7 @@ def view_columns ERROR end - def get_raw_records + def get_raw_records # rubocop:disable Naming/AccessorMethodName raise(NotImplementedError, <<~ERROR) You should implement this method in your class and specify diff --git a/lib/ajax-datatables-rails/datatable/column.rb b/lib/ajax-datatables-rails/datatable/column.rb index 921c76c..2179a4d 100644 --- a/lib/ajax-datatables-rails/datatable/column.rb +++ b/lib/ajax-datatables-rails/datatable/column.rb @@ -11,7 +11,7 @@ class Column attr_reader :datatable, :index, :options, :column_name attr_writer :search - def initialize(datatable, index, options) + def initialize(datatable, index, options) # rubocop:disable Metrics/MethodLength @datatable = datatable @index = index @options = options @@ -99,11 +99,13 @@ def casted_column @casted_column ||= ::Arel::Nodes::NamedFunction.new('CAST', [table[field].as(type_cast)]) end + # rubocop:disable Layout/LineLength def validate_settings! raise AjaxDatatablesRails::Error::InvalidSearchColumn, 'Unknown column. Check that `data` field is filled on JS side with the column name' if column_name.empty? raise AjaxDatatablesRails::Error::InvalidSearchColumn, "Check that column '#{column_name}' exists in view_columns" unless valid_search_column?(column_name) raise AjaxDatatablesRails::Error::InvalidSearchCondition, cond unless valid_search_condition?(cond) end + # rubocop:enable Layout/LineLength def valid_search_column?(column_name) !datatable.view_columns[column_name].nil? diff --git a/lib/ajax-datatables-rails/datatable/column/search.rb b/lib/ajax-datatables-rails/datatable/column/search.rb index 581165f..735f8cc 100644 --- a/lib/ajax-datatables-rails/datatable/column/search.rb +++ b/lib/ajax-datatables-rails/datatable/column/search.rb @@ -48,7 +48,7 @@ def use_regex? # The solution is to bypass regex_search and use non_regex_search with :in operator def regex_search if use_regex? - ::Arel::Nodes::Regexp.new((custom_field? ? field : table[field]), ::Arel::Nodes.build_quoted(formatted_value)) + ::Arel::Nodes::Regexp.new((custom_field? ? field : table[field]), ::Arel::Nodes.build_quoted(formatted_value)) # rubocop:disable Layout/LineLength else non_regex_search end From 07f6fd177fa46723d454d697f2b5ef70232f811c Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 6 Sep 2024 17:26:05 +0200 Subject: [PATCH 28/60] Run Rubocop in CI --- .github/workflows/ci.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8961a08..02de24e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,24 @@ on: - cron: '0 4 1 * *' jobs: + rubocop: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + + - name: Bundler + run: bundle install + + - name: Rubocop + run: bin/rubocop + rspec: runs-on: ubuntu-latest @@ -108,4 +126,4 @@ jobs: DB_ADAPTER: ${{ matrix.adapter }} CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} with: - coverageCommand: bin/rake + coverageCommand: bin/rspec From ff83656f24460b38feb6e4d065521d9b5ed3097b Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 6 Sep 2024 17:27:13 +0200 Subject: [PATCH 29/60] Minor change --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index c576291..f31beda 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -10,9 +10,9 @@ AllCops: TargetRubyVersion: 3.0 Exclude: - bin/* - - lib/generators/**/*.rb - gemfiles/* - spec/**/* + - lib/generators/**/*.rb ######### # STYLE # From a8fab0ecf7cf67b21df4a4e16875e74c86caec4c Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 6 Sep 2024 17:27:36 +0200 Subject: [PATCH 30/60] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5a81fd5..228d318 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It's tested against : -* Rails: 6.1.7 / 7.0.4 / 7.1.0 +* Rails: 7.0.4 / 7.1.0 * Ruby: 3.0 / 3.1 / 3.2 / 3.3 * Databases: MySQL 8 / SQLite3 / Postgresql 16 / Oracle XE 11.2 (thanks to [travis-oracle](https://github.com/cbandy/travis-oracle)) * Adapters: sqlite / mysql2 / trilogy / postgres / postgis / oracle From 571dd9e785a1d823d4d7acf6467167ec503f4382 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 6 Sep 2024 17:33:57 +0200 Subject: [PATCH 31/60] Add support for Rails 7.2 --- .github/workflows/ci.yml | 5 +++++ README.md | 2 +- appraisal.yml | 21 ++++++++++++++++++ gemfiles/rails_7.2.0.gemfile | 42 ++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 gemfiles/rails_7.2.0.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02de24e..fb864ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,6 +77,7 @@ jobs: - '3.0' - 'head' rails: + - rails_7.2.0 - rails_7.1.0 - rails_7.0.8 adapter: @@ -87,6 +88,10 @@ jobs: - postgis # - trilogy exclude: + - rails: rails_7.2.0 + adapter: oracle_enhanced + - rails: rails_7.2.0 + ruby: '3.0' - rails: rails_7.1.0 adapter: oracle_enhanced diff --git a/README.md b/README.md index 228d318..0cef164 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It's tested against : -* Rails: 7.0.4 / 7.1.0 +* Rails: 7.0.4 / 7.1.0 / 7.2.0 * Ruby: 3.0 / 3.1 / 3.2 / 3.3 * Databases: MySQL 8 / SQLite3 / Postgresql 16 / Oracle XE 11.2 (thanks to [travis-oracle](https://github.com/cbandy/travis-oracle)) * Adapters: sqlite / mysql2 / trilogy / postgres / postgis / oracle diff --git a/appraisal.yml b/appraisal.yml index 0b1c73f..35e4f41 100644 --- a/appraisal.yml +++ b/appraisal.yml @@ -63,3 +63,24 @@ drb: version: '' install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' + + +7.2.0: + sqlite3: + version: ~> 1.5.0 + install_if: '-> { ENV["DB_ADAPTER"] == "sqlite3" }' + mysql2: + version: '' + install_if: '-> { ENV["DB_ADAPTER"] == "mysql2" }' + activerecord-trilogy-adapter: + version: '' + install_if: '-> { ENV["DB_ADAPTER"] == "trilogy" }' + # activerecord-oracle_enhanced-adapter: + # version: ~> 7.0.0 + # install_if: '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' + # ruby-oci8: + # version: '' + # install_if: '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' + activerecord-postgis-adapter: + version: '' + install_if: '-> { ENV["DB_ADAPTER"] == "postgis" }' diff --git a/gemfiles/rails_7.2.0.gemfile b/gemfiles/rails_7.2.0.gemfile new file mode 100644 index 0000000..652e461 --- /dev/null +++ b/gemfiles/rails_7.2.0.gemfile @@ -0,0 +1,42 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/n-rodriguez/appraisal.git", branch: "wip/combustion" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pg" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.2.0" + +install_if -> { ENV["DB_ADAPTER"] == "sqlite3" } do + gem "sqlite3", "~> 1.5.0" +end + +install_if -> { ENV["DB_ADAPTER"] == "mysql2" } do + gem "mysql2" +end + +install_if -> { ENV["DB_ADAPTER"] == "trilogy" } do + gem "activerecord-trilogy-adapter" +end + +install_if -> { ENV["DB_ADAPTER"] == "postgis" } do + gem "activerecord-postgis-adapter" +end + +gemspec path: "../" From 7c8025f5cebdf720f66a048699aa7d576412b023 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 6 Sep 2024 21:34:47 +0200 Subject: [PATCH 32/60] Cleanup Appraisals file --- .github/workflows/ci.yml | 17 ++- .rubocop.yml | 1 + Appraisals | 115 ++++++++++++++---- appraisal.yml | 86 ------------- gemfiles/rails_7.0.8.gemfile | 7 +- gemfiles/rails_7.1.0.gemfile | 13 +- gemfiles/rails_7.2.0.gemfile | 7 +- .../datatable/column/search.rb | 2 +- 8 files changed, 129 insertions(+), 119 deletions(-) delete mode 100644 appraisal.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb864ab..ab63d87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,10 +88,23 @@ jobs: - postgis # - trilogy exclude: - - rails: rails_7.2.0 - adapter: oracle_enhanced + # Rails 7.2 needs Ruby > 3.1 - rails: rails_7.2.0 ruby: '3.0' + + # Disabled for now because of build error: + # /opt/hostedtoolcache/Ruby/3.0.7/x64/lib/ruby/3.0.0/psych.rb:457:in + # `parse_stream': undefined method `parse' for #>, + # @external_encoding=0> (NoMethodError) + # from + # /home/runner/work/ajax-datatables-rails/ajax-datatables-rails/vendor/bundle/ruby/3.0.0/gems/ruby-oci8-2.2.14/ext/oci8/apiwrap.rb:64:in + # `create_apiwrap' + - rails: rails_7.2.0 + adapter: oracle_enhanced - rails: rails_7.1.0 adapter: oracle_enhanced diff --git a/.rubocop.yml b/.rubocop.yml index f31beda..40b6bdd 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -32,6 +32,7 @@ Style/TrailingCommaInHashLiteral: ########## Layout/LineLength: + Max: 125 Exclude: - ajax-datatables-rails.gemspec diff --git a/Appraisals b/Appraisals index 7536e56..53eb9ac 100644 --- a/Appraisals +++ b/Appraisals @@ -1,26 +1,97 @@ # frozen_string_literal: true -require 'yaml' - -rails_versions = YAML.safe_load_file('appraisal.yml') - -rails_versions.each do |version, gems| - appraise "rails_#{version}" do - gem 'rails', version - gems.each do |name, opts| - if opts['install_if'] - install_if opts['install_if'] do - if opts['version'].empty? - gem name - else - gem name, opts['version'] - end - end - elsif opts['version'].empty? - gem name - else - gem name, opts['version'] - end - end +appraise 'rails_7.0.8' do # rubocop:disable Metrics/BlockLength + gem 'rails', '7.0.8' + + install_if '-> { ENV["DB_ADAPTER"] == "sqlite3" }' do + gem 'sqlite3', '~> 1.5.0' + end + + install_if '-> { ENV["DB_ADAPTER"] == "mysql2" }' do + gem 'mysql2' + end + + install_if '-> { ENV["DB_ADAPTER"] == "trilogy" }' do + gem 'activerecord-trilogy-adapter' + end + + install_if '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' do + gem 'ruby-oci8' + gem 'activerecord-oracle_enhanced-adapter', '~> 7.0.0' + end + + install_if '-> { ENV["DB_ADAPTER"] == "postgis" }' do + gem 'activerecord-postgis-adapter' + end + + # Fix: + # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 + # Add logger to your Gemfile or gemspec. + install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do + gem 'base64' + gem 'bigdecimal' + gem 'benchmark' + gem 'drb' + gem 'logger' + gem 'mutex_m' + gem 'ostruct' + end +end + +appraise 'rails_7.1.0' do + gem 'rails', '7.1.0' + + install_if '-> { ENV["DB_ADAPTER"] == "sqlite3" }' do + gem 'sqlite3', '~> 1.5.0' + end + + install_if '-> { ENV["DB_ADAPTER"] == "mysql2" }' do + gem 'mysql2' + end + + install_if '-> { ENV["DB_ADAPTER"] == "trilogy" }' do + gem 'activerecord-trilogy-adapter' + end + + install_if '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' do + gem 'ruby-oci8' + gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git' + end + + install_if '-> { ENV["DB_ADAPTER"] == "postgis" }' do + gem 'activerecord-postgis-adapter' + end + + # Fix: + # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 + # Add logger to your Gemfile or gemspec. + install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.3.0") }' do + gem 'logger' + gem 'ostruct' + end +end + +appraise 'rails_7.2.0' do + gem 'rails', '7.2.0' + + install_if '-> { ENV["DB_ADAPTER"] == "sqlite3" }' do + gem 'sqlite3', '~> 1.5.0' + end + + install_if '-> { ENV["DB_ADAPTER"] == "mysql2" }' do + gem 'mysql2' + end + + install_if '-> { ENV["DB_ADAPTER"] == "trilogy" }' do + gem 'activerecord-trilogy-adapter' + end + + install_if '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' do + gem 'ruby-oci8' + gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git' + end + + install_if '-> { ENV["DB_ADAPTER"] == "postgis" }' do + gem 'activerecord-postgis-adapter', git: 'https://github.com/rgeo/activerecord-postgis-adapter.git' end end diff --git a/appraisal.yml b/appraisal.yml deleted file mode 100644 index 35e4f41..0000000 --- a/appraisal.yml +++ /dev/null @@ -1,86 +0,0 @@ ---- -7.0.8: - sqlite3: - version: ~> 1.5.0 - install_if: '-> { ENV["DB_ADAPTER"] == "sqlite3" }' - mysql2: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "mysql2" }' - activerecord-trilogy-adapter: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "trilogy" }' - activerecord-oracle_enhanced-adapter: - version: ~> 7.0.0 - install_if: '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' - ruby-oci8: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' - activerecord-postgis-adapter: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "postgis" }' - base64: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - bigdecimal: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - mutex_m: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - drb: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - - -7.1.0: - sqlite3: - version: ~> 1.5.0 - install_if: '-> { ENV["DB_ADAPTER"] == "sqlite3" }' - mysql2: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "mysql2" }' - activerecord-trilogy-adapter: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "trilogy" }' - # activerecord-oracle_enhanced-adapter: - # version: ~> 7.0.0 - # install_if: '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' - # ruby-oci8: - # version: '' - # install_if: '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' - activerecord-postgis-adapter: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "postgis" }' - base64: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - bigdecimal: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - mutex_m: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - drb: - version: '' - install_if: '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' - - -7.2.0: - sqlite3: - version: ~> 1.5.0 - install_if: '-> { ENV["DB_ADAPTER"] == "sqlite3" }' - mysql2: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "mysql2" }' - activerecord-trilogy-adapter: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "trilogy" }' - # activerecord-oracle_enhanced-adapter: - # version: ~> 7.0.0 - # install_if: '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' - # ruby-oci8: - # version: '' - # install_if: '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' - activerecord-postgis-adapter: - version: '' - install_if: '-> { ENV["DB_ADAPTER"] == "postgis" }' diff --git a/gemfiles/rails_7.0.8.gemfile b/gemfiles/rails_7.0.8.gemfile index f986146..1f491ef 100644 --- a/gemfiles/rails_7.0.8.gemfile +++ b/gemfiles/rails_7.0.8.gemfile @@ -36,8 +36,8 @@ install_if -> { ENV["DB_ADAPTER"] == "trilogy" } do end install_if -> { ENV["DB_ADAPTER"] == "oracle_enhanced" } do - gem "activerecord-oracle_enhanced-adapter", "~> 7.0.0" gem "ruby-oci8" + gem "activerecord-oracle_enhanced-adapter", "~> 7.0.0" end install_if -> { ENV["DB_ADAPTER"] == "postgis" } do @@ -47,8 +47,11 @@ end install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do gem "base64" gem "bigdecimal" - gem "mutex_m" + gem "benchmark" gem "drb" + gem "logger" + gem "mutex_m" + gem "ostruct" end gemspec path: "../" diff --git a/gemfiles/rails_7.1.0.gemfile b/gemfiles/rails_7.1.0.gemfile index 441f505..97ecb80 100644 --- a/gemfiles/rails_7.1.0.gemfile +++ b/gemfiles/rails_7.1.0.gemfile @@ -35,15 +35,18 @@ install_if -> { ENV["DB_ADAPTER"] == "trilogy" } do gem "activerecord-trilogy-adapter" end +install_if -> { ENV["DB_ADAPTER"] == "oracle_enhanced" } do + gem "ruby-oci8" + gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git" +end + install_if -> { ENV["DB_ADAPTER"] == "postgis" } do gem "activerecord-postgis-adapter" end -install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do - gem "base64" - gem "bigdecimal" - gem "mutex_m" - gem "drb" +install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.3.0") } do + gem "logger" + gem "ostruct" end gemspec path: "../" diff --git a/gemfiles/rails_7.2.0.gemfile b/gemfiles/rails_7.2.0.gemfile index 652e461..ee0697d 100644 --- a/gemfiles/rails_7.2.0.gemfile +++ b/gemfiles/rails_7.2.0.gemfile @@ -35,8 +35,13 @@ install_if -> { ENV["DB_ADAPTER"] == "trilogy" } do gem "activerecord-trilogy-adapter" end +install_if -> { ENV["DB_ADAPTER"] == "oracle_enhanced" } do + gem "ruby-oci8" + gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git" +end + install_if -> { ENV["DB_ADAPTER"] == "postgis" } do - gem "activerecord-postgis-adapter" + gem "activerecord-postgis-adapter", git: "https://github.com/rgeo/activerecord-postgis-adapter.git" end gemspec path: "../" diff --git a/lib/ajax-datatables-rails/datatable/column/search.rb b/lib/ajax-datatables-rails/datatable/column/search.rb index 735f8cc..581165f 100644 --- a/lib/ajax-datatables-rails/datatable/column/search.rb +++ b/lib/ajax-datatables-rails/datatable/column/search.rb @@ -48,7 +48,7 @@ def use_regex? # The solution is to bypass regex_search and use non_regex_search with :in operator def regex_search if use_regex? - ::Arel::Nodes::Regexp.new((custom_field? ? field : table[field]), ::Arel::Nodes.build_quoted(formatted_value)) # rubocop:disable Layout/LineLength + ::Arel::Nodes::Regexp.new((custom_field? ? field : table[field]), ::Arel::Nodes.build_quoted(formatted_value)) else non_regex_search end From a47cfef715f5726bc0090fbe6ada6c5227230f6c Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sat, 7 Sep 2024 00:54:33 +0200 Subject: [PATCH 33/60] Update Rubocop config, fix offenses --- .rubocop.yml | 26 +++++++- .../orm/active_record.rb | 1 + .../base_spec.rb | 26 ++++---- .../datatable/column_spec.rb | 59 +++++++++---------- .../datatable/datatable_spec.rb | 9 +-- .../datatable/simple_order_spec.rb | 4 +- .../datatable/simple_search_spec.rb | 2 +- .../orm/active_record_count_records_spec.rb | 9 ++- .../orm/active_record_filter_records_spec.rb | 50 ++++++++-------- .../active_record_paginate_records_spec.rb | 8 ++- .../orm/active_record_sort_records_spec.rb | 0 spec/spec_helper.rb | 2 +- spec/support/datatables/complex_datatable.rb | 4 +- .../datatables/datatable_cond_string.rb | 2 +- .../datatables/datatable_custom_column.rb | 2 +- .../datatables/grouped_datatable_array.rb | 2 +- spec/support/helpers/params.rb | 10 ++-- spec/support/models/user.rb | 4 +- 18 files changed, 125 insertions(+), 95 deletions(-) rename spec/{ajax-datatables-rails => ajax_datatables_rails}/base_spec.rb (91%) rename spec/{ajax-datatables-rails => ajax_datatables_rails}/datatable/column_spec.rb (74%) rename spec/{ajax-datatables-rails => ajax_datatables_rails}/datatable/datatable_spec.rb (94%) rename spec/{ajax-datatables-rails => ajax_datatables_rails}/datatable/simple_order_spec.rb (90%) rename spec/{ajax-datatables-rails => ajax_datatables_rails}/datatable/simple_search_spec.rb (83%) rename spec/{ajax-datatables-rails => ajax_datatables_rails}/orm/active_record_count_records_spec.rb (85%) rename spec/{ajax-datatables-rails => ajax_datatables_rails}/orm/active_record_filter_records_spec.rb (93%) rename spec/{ajax-datatables-rails => ajax_datatables_rails}/orm/active_record_paginate_records_spec.rb (83%) rename spec/{ajax-datatables-rails => ajax_datatables_rails}/orm/active_record_sort_records_spec.rb (100%) diff --git a/.rubocop.yml b/.rubocop.yml index 40b6bdd..f97f216 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -11,7 +11,7 @@ AllCops: Exclude: - bin/* - gemfiles/* - - spec/**/* + - spec/dummy/**/* - lib/generators/**/*.rb ######### @@ -27,12 +27,15 @@ Style/TrailingCommaInArrayLiteral: Style/TrailingCommaInHashLiteral: EnforcedStyleForMultiline: comma +Style/BlockDelimiters: + AllowedPatterns: ['expect'] + ########## # LAYOUT # ########## Layout/LineLength: - Max: 125 + Max: 150 Exclude: - ajax-datatables-rails.gemspec @@ -62,3 +65,22 @@ Layout/HashAlignment: Naming/FileName: Exclude: - lib/ajax-datatables-rails.rb + +######### +# RSPEC # +######### + +RSpec/MultipleExpectations: + Max: 7 + +RSpec/NestedGroups: + Max: 6 + +RSpec/ExampleLength: + Max: 9 + +RSpec/MultipleMemoizedHelpers: + Max: 6 + +RSpec/NotToNot: + EnforcedStyle: to_not diff --git a/lib/ajax-datatables-rails/orm/active_record.rb b/lib/ajax-datatables-rails/orm/active_record.rb index 6ed48a9..8da0895 100644 --- a/lib/ajax-datatables-rails/orm/active_record.rb +++ b/lib/ajax-datatables-rails/orm/active_record.rb @@ -42,6 +42,7 @@ def build_conditions_for_datatable end.reduce(:or) end.compact.reduce(:and) end + def build_conditions_for_selected_columns search_columns.filter_map(&:search_query).reduce(:and) end diff --git a/spec/ajax-datatables-rails/base_spec.rb b/spec/ajax_datatables_rails/base_spec.rb similarity index 91% rename from spec/ajax-datatables-rails/base_spec.rb rename to spec/ajax_datatables_rails/base_spec.rb index 1936ab7..2891579 100644 --- a/spec/ajax-datatables-rails/base_spec.rb +++ b/spec/ajax_datatables_rails/base_spec.rb @@ -30,7 +30,7 @@ end end - context 'child class implements view_columns' do + context 'when child class implements view_columns' do it 'expects a hash based defining columns' do datatable = ComplexDatatable.new(sample_params) expect(datatable.view_columns).to be_a(Hash) @@ -108,7 +108,7 @@ describe 'ORM API' do context 'when ORM is not implemented' do - let(:datatable) { AjaxDatatablesRails::Base.new(sample_params) } + let(:datatable) { described_class.new(sample_params) } describe '#fetch_records' do it 'raises an error if it does not include an ORM module' do @@ -139,16 +139,16 @@ describe 'it allows method override' do let(:datatable) do datatable = Class.new(ComplexDatatable) do - def filter_records(records) - raise NotImplementedError.new('FOO') + def filter_records(_records) + raise NotImplementedError, 'FOO' end - def sort_records(records) - raise NotImplementedError.new('FOO') + def sort_records(_records) + raise NotImplementedError, 'FOO' end - def paginate_records(records) - raise NotImplementedError.new('FOO') + def paginate_records(_records) + raise NotImplementedError, 'FOO' end end datatable.new(sample_params) @@ -156,12 +156,13 @@ def paginate_records(records) describe '#fetch_records' do it 'calls #get_raw_records' do - expect(datatable).to receive(:get_raw_records) { User.all } + allow(datatable).to receive(:get_raw_records) { User.all } datatable.fetch_records + expect(datatable).to have_received(:get_raw_records) end it 'returns a collection of records' do - expect(datatable).to receive(:get_raw_records) { User.all } + allow(datatable).to receive(:get_raw_records) { User.all } expect(datatable.fetch_records).to be_a(ActiveRecord::Relation) end end @@ -204,7 +205,7 @@ def paginate_records(records) context 'with additional_data' do it 'returns a hash' do create_list(:user, 5) - expect(datatable).to receive(:additional_data) { { foo: 'bar' } } + allow(datatable).to receive(:additional_data).and_return({ foo: 'bar' }) data = datatable.as_json expect(data[:recordsTotal]).to eq 5 expect(data[:recordsFiltered]).to eq 5 @@ -228,9 +229,10 @@ def paginate_records(records) end describe '#column_data' do - let(:datatable) { ComplexDatatable.new(sample_params) } before { datatable.params[:columns]['0'][:search][:value] = 'doe' } + let(:datatable) { ComplexDatatable.new(sample_params) } + it 'returns column data from params' do expect(datatable.column_data(:username)).to eq('doe') expect(datatable.column_data('username')).to eq('doe') diff --git a/spec/ajax-datatables-rails/datatable/column_spec.rb b/spec/ajax_datatables_rails/datatable/column_spec.rb similarity index 74% rename from spec/ajax-datatables-rails/datatable/column_spec.rb rename to spec/ajax_datatables_rails/datatable/column_spec.rb index 69738ab..21dc66f 100644 --- a/spec/ajax-datatables-rails/datatable/column_spec.rb +++ b/spec/ajax_datatables_rails/datatable/column_spec.rb @@ -13,19 +13,19 @@ before { datatable.params[:columns]['0'][:search][:value] = 'searchvalue' } it 'is orderable' do - expect(column.orderable?).to eq(true) + expect(column.orderable?).to be(true) end it 'sorts nulls last' do - expect(column.nulls_last?).to eq(false) + expect(column.nulls_last?).to be(false) end it 'is searchable' do - expect(column.searchable?).to eq(true) + expect(column.searchable?).to be(true) end it 'is searched' do - expect(column.searched?).to eq(true) + expect(column.searched?).to be(true) end it 'has connected to id column' do @@ -53,7 +53,7 @@ context 'with other ORM' do it 'returns the corresponding model' do - expect(User).to receive(:respond_to?).with(:arel_table).and_return(false) + allow(User).to receive(:respond_to?).with(:arel_table).and_return(false) expect(column.table).to eq User end end @@ -87,7 +87,7 @@ end it 'does not regex' do - expect(column.search.regexp?).to eq false + expect(column.search.regexp?).to be false end end @@ -97,12 +97,6 @@ end end - describe '#source' do - it 'is :like by default' do - expect(column.source).to eq('User.username') - end - end - describe '#search_query' do it 'bulds search query' do expect(column.search_query.to_sql).to include('%searchvalue%') @@ -129,10 +123,10 @@ end describe 'unsearchable column' do - let(:column) { datatable.datatable.columns.find{ |c| c.data == 'email_hash' } } + let(:column) { datatable.datatable.columns.find { |c| c.data == 'email_hash' } } it 'is not searchable' do - expect(column.searchable?).to eql(false) + expect(column.searchable?).to be(false) end end @@ -150,11 +144,12 @@ let(:column) { datatable.datatable.columns.find { |c| c.data == 'username' } } it 'is a proc' do - config = column.instance_variable_get('@view_column') + config = column.instance_variable_get(:@view_column) filter = config[:cond] expect(filter).to be_a(Proc) - expect(filter).to receive(:call).with(column, column.formatted_value) + allow(filter).to receive(:call).with(column, column.formatted_value) column.filter + expect(filter).to have_received(:call).with(column, column.formatted_value) end end @@ -162,62 +157,62 @@ let(:column) { datatable.datatable.columns.first } it 'returns VARCHAR if :db_adapter is :pg' do - expect(datatable).to receive(:db_adapter) { :pg } + allow(datatable).to receive(:db_adapter).and_return(:pg) expect(column.send(:type_cast)).to eq('VARCHAR') end it 'returns VARCHAR if :db_adapter is :postgre' do - expect(datatable).to receive(:db_adapter) { :postgre } + allow(datatable).to receive(:db_adapter).and_return(:postgre) expect(column.send(:type_cast)).to eq('VARCHAR') end it 'returns VARCHAR if :db_adapter is :postgresql' do - expect(datatable).to receive(:db_adapter) { :postgresql } + allow(datatable).to receive(:db_adapter).and_return(:postgresql) expect(column.send(:type_cast)).to eq('VARCHAR') end it 'returns VARCHAR if :db_adapter is :postgis' do - expect(datatable).to receive(:db_adapter) { :postgis } + allow(datatable).to receive(:db_adapter).and_return(:postgis) expect(column.send(:type_cast)).to eq('VARCHAR') end it 'returns VARCHAR2(4000) if :db_adapter is :oracle' do - expect(datatable).to receive(:db_adapter) { :oracle } + allow(datatable).to receive(:db_adapter).and_return(:oracle) expect(column.send(:type_cast)).to eq('VARCHAR2(4000)') end it 'returns VARCHAR2(4000) if :db_adapter is :oracleenhanced' do - expect(datatable).to receive(:db_adapter) { :oracleenhanced } + allow(datatable).to receive(:db_adapter).and_return(:oracleenhanced) expect(column.send(:type_cast)).to eq('VARCHAR2(4000)') end it 'returns CHAR if :db_adapter is :mysql2' do - expect(datatable).to receive(:db_adapter) { :mysql2 } + allow(datatable).to receive(:db_adapter).and_return(:mysql2) expect(column.send(:type_cast)).to eq('CHAR') end it 'returns CHAR if :db_adapter is :trilogy' do - expect(datatable).to receive(:db_adapter) { :trilogy } + allow(datatable).to receive(:db_adapter).and_return(:trilogy) expect(column.send(:type_cast)).to eq('CHAR') end it 'returns CHAR if :db_adapter is :mysql' do - expect(datatable).to receive(:db_adapter) { :mysql } + allow(datatable).to receive(:db_adapter).and_return(:mysql) expect(column.send(:type_cast)).to eq('CHAR') end it 'returns TEXT if :db_adapter is :sqlite' do - expect(datatable).to receive(:db_adapter) { :sqlite } + allow(datatable).to receive(:db_adapter).and_return(:sqlite) expect(column.send(:type_cast)).to eq('TEXT') end it 'returns TEXT if :db_adapter is :sqlite3' do - expect(datatable).to receive(:db_adapter) { :sqlite3 } + allow(datatable).to receive(:db_adapter).and_return(:sqlite3) expect(column.send(:type_cast)).to eq('TEXT') end it 'returns VARCHAR(4000) if :db_adapter is :sqlserver' do - expect(datatable).to receive(:db_adapter) { :sqlserver } + allow(datatable).to receive(:db_adapter).and_return(:sqlserver) expect(column.send(:type_cast)).to eq('VARCHAR(4000)') end end @@ -225,16 +220,20 @@ describe 'when empty column' do before { datatable.params[:columns]['0'][:data] = '' } + let(:message) { 'Unknown column. Check that `data` field is filled on JS side with the column name' } + it 'raises error' do - expect { datatable.to_json }.to raise_error(AjaxDatatablesRails::Error::InvalidSearchColumn).with_message('Unknown column. Check that `data` field is filled on JS side with the column name') + expect { datatable.to_json }.to raise_error(AjaxDatatablesRails::Error::InvalidSearchColumn).with_message(message) end end describe 'when unknown column' do before { datatable.params[:columns]['0'][:data] = 'foo' } + let(:message) { "Check that column 'foo' exists in view_columns" } + it 'raises error' do - expect { datatable.to_json }.to raise_error(AjaxDatatablesRails::Error::InvalidSearchColumn).with_message("Check that column 'foo' exists in view_columns") + expect { datatable.to_json }.to raise_error(AjaxDatatablesRails::Error::InvalidSearchColumn).with_message(message) end end end diff --git a/spec/ajax-datatables-rails/datatable/datatable_spec.rb b/spec/ajax_datatables_rails/datatable/datatable_spec.rb similarity index 94% rename from spec/ajax-datatables-rails/datatable/datatable_spec.rb rename to spec/ajax_datatables_rails/datatable/datatable_spec.rb index 7e8f977..fa12005 100644 --- a/spec/ajax-datatables-rails/datatable/datatable_spec.rb +++ b/spec/ajax_datatables_rails/datatable/datatable_spec.rb @@ -11,12 +11,12 @@ shared_examples 'order methods' do it 'is orderable' do - expect(datatable.orderable?).to eq(true) + expect(datatable.orderable?).to be(true) end it 'is not orderable' do datatable.options[:order] = nil - expect(datatable.orderable?).to eq(false) + expect(datatable.orderable?).to be(false) end it 'has 2 orderable columns' do @@ -57,6 +57,7 @@ describe 'with json params' do let(:order_option) { order_option_json } let(:datatable) { datatable_json } + it_behaves_like 'order methods' it_behaves_like 'columns methods' end @@ -64,12 +65,12 @@ describe 'search methods' do it 'is searchable' do datatable.options[:search][:value] = 'atom' - expect(datatable.searchable?).to eq(true) + expect(datatable.searchable?).to be(true) end it 'is not searchable' do datatable.options[:search][:value] = nil - expect(datatable.searchable?).to eq(false) + expect(datatable.searchable?).to be(false) end it 'child class' do diff --git a/spec/ajax-datatables-rails/datatable/simple_order_spec.rb b/spec/ajax_datatables_rails/datatable/simple_order_spec.rb similarity index 90% rename from spec/ajax-datatables-rails/datatable/simple_order_spec.rb rename to spec/ajax_datatables_rails/datatable/simple_order_spec.rb index 71de756..36d2260 100644 --- a/spec/ajax-datatables-rails/datatable/simple_order_spec.rb +++ b/spec/ajax_datatables_rails/datatable/simple_order_spec.rb @@ -7,7 +7,7 @@ let(:parent) { ComplexDatatable.new(sample_params) } let(:datatable) { parent.datatable } let(:options) { ActiveSupport::HashWithIndifferentAccess.new({ 'column' => '1', 'dir' => 'desc' }) } - let(:simple_order) { AjaxDatatablesRails::Datatable::SimpleOrder.new(datatable, options) } + let(:simple_order) { described_class.new(datatable, options) } describe 'option methods' do it 'sql query' do @@ -32,7 +32,7 @@ describe 'using column option' do let(:parent) { DatatableOrderNullsLast.new(sample_params) } let(:sorted_datatable) { parent.datatable } - let(:nulls_last_order) { AjaxDatatablesRails::Datatable::SimpleOrder.new(sorted_datatable, options) } + let(:nulls_last_order) { described_class.new(sorted_datatable, options) } context 'with postgres database adapter' do before { parent.db_adapter = :pg } diff --git a/spec/ajax-datatables-rails/datatable/simple_search_spec.rb b/spec/ajax_datatables_rails/datatable/simple_search_spec.rb similarity index 83% rename from spec/ajax-datatables-rails/datatable/simple_search_spec.rb rename to spec/ajax_datatables_rails/datatable/simple_search_spec.rb index fc81480..a13bed7 100644 --- a/spec/ajax-datatables-rails/datatable/simple_search_spec.rb +++ b/spec/ajax_datatables_rails/datatable/simple_search_spec.rb @@ -5,7 +5,7 @@ RSpec.describe AjaxDatatablesRails::Datatable::SimpleSearch do let(:options) { ActiveSupport::HashWithIndifferentAccess.new({ 'value' => 'search value', 'regex' => 'true' }) } - let(:simple_search) { AjaxDatatablesRails::Datatable::SimpleSearch.new(options) } + let(:simple_search) { described_class.new(options) } describe 'option methods' do it 'regexp?' do diff --git a/spec/ajax-datatables-rails/orm/active_record_count_records_spec.rb b/spec/ajax_datatables_rails/orm/active_record_count_records_spec.rb similarity index 85% rename from spec/ajax-datatables-rails/orm/active_record_count_records_spec.rb rename to spec/ajax_datatables_rails/orm/active_record_count_records_spec.rb index 4c5c2be..70c4de4 100644 --- a/spec/ajax-datatables-rails/orm/active_record_count_records_spec.rb +++ b/spec/ajax_datatables_rails/orm/active_record_count_records_spec.rb @@ -8,13 +8,13 @@ let(:records) { User.all } describe '#records_total_count' do - context 'ungrouped results' do + context 'when ungrouped results' do it 'returns the count' do expect(datatable.send(:records_total_count)).to eq records.count end end - context 'grouped results' do + context 'when grouped results' do let(:datatable) { GroupedDatatable.new(sample_params) } it 'returns the count' do @@ -23,15 +23,14 @@ end end - describe '#records_filtered_count' do - context 'ungrouped results' do + context 'when ungrouped results' do it 'returns the count' do expect(datatable.send(:records_filtered_count)).to eq records.count end end - context 'grouped results' do + context 'when grouped results' do let(:datatable) { GroupedDatatable.new(sample_params) } it 'returns the count' do diff --git a/spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb b/spec/ajax_datatables_rails/orm/active_record_filter_records_spec.rb similarity index 93% rename from spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb rename to spec/ajax_datatables_rails/orm/active_record_filter_records_spec.rb index 8f59020..2d6a4bb 100644 --- a/spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb +++ b/spec/ajax_datatables_rails/orm/active_record_filter_records_spec.rb @@ -18,21 +18,22 @@ end it 'performs a simple search first' do - expect(datatable).to receive(:build_conditions_for_datatable) + allow(datatable).to receive(:build_conditions_for_datatable) datatable.filter_records(records) + expect(datatable).to have_received(:build_conditions_for_datatable) end it 'does not search unsearchable fields' do criteria = datatable.filter_records(records) - expect(criteria.to_sql).not_to include('email_hash') + expect(criteria.to_sql).to_not include('email_hash') end end - it 'performs a composite search second' do datatable.params[:search] = { value: '' } - expect(datatable).to receive(:build_conditions_for_selected_columns) + allow(datatable).to receive(:build_conditions_for_selected_columns) datatable.filter_records(records) + expect(datatable).to have_received(:build_conditions_for_selected_columns) end end @@ -53,8 +54,8 @@ query = datatable.build_conditions results = records.where(query).map(&:username) expect(results).to include('msmith') - expect(results).not_to include('johndoe') - expect(results).not_to include('hsmith') + expect(results).to_not include('johndoe') + expect(results).to_not include('hsmith') end end end @@ -71,7 +72,7 @@ expect(result).to be_a(Arel::Nodes::Grouping) end - context 'no search query' do + context 'when no search query' do it 'returns empty query' do datatable.params[:search] = { value: '' } expect(datatable.build_conditions_for_datatable).to be_blank @@ -80,7 +81,7 @@ context 'when none of columns are connected' do before do - allow(datatable).to receive(:searchable_columns) { [] } + allow(datatable).to receive(:searchable_columns).and_return([]) end context 'when search value is a string' do @@ -95,7 +96,7 @@ it 'returns filtered results' do query = datatable.build_conditions_for_datatable results = records.where(query).map(&:username) - expect(results).to eq ['johndoe', 'msmith'] + expect(results).to eq %w[johndoe msmith] end end @@ -111,7 +112,7 @@ it 'returns filtered results' do query = datatable.build_conditions_for_datatable results = records.where(query).map(&:username) - expect(results).to eq ['johndoe', 'msmith'] + expect(results).to eq %w[johndoe msmith] end end end @@ -126,7 +127,7 @@ query = datatable.build_conditions_for_datatable results = records.where(query).map(&:username) expect(results).to include('johndoe') - expect(results).not_to include('msmith') + expect(results).to_not include('msmith') end end @@ -139,7 +140,7 @@ query = datatable.build_conditions_for_datatable results = records.where(query).map(&:username) expect(results).to eq ['johndoe'] - expect(results).not_to include('msmith') + expect(results).to_not include('msmith') end end @@ -152,7 +153,7 @@ end it 'does not raise error' do - allow_any_instance_of(AjaxDatatablesRails::Datatable::Column).to receive(:valid_search_condition?).and_return(true) + allow_any_instance_of(AjaxDatatablesRails::Datatable::Column).to receive(:valid_search_condition?).and_return(true) # rubocop:disable RSpec/AnyInstance expect { datatable.data.size @@ -168,7 +169,7 @@ create(:user, username: 'msmith', email: 'mary.smith@example.com') end - context 'columns include search query' do + context 'when columns include search query' do before do datatable.params[:columns]['0'][:search][:value] = 'doe' datatable.params[:columns]['1'][:search][:value] = 'example' @@ -204,7 +205,7 @@ end if RunningSpec.mysql? - context 'when db_adapter is mysql2' do + context 'when db_adapter is mysql2' do # rubocop:disable RSpec/RepeatedExampleGroupBody it 'can call #to_sql on returned object' do result = datatable.build_conditions_for_selected_columns expect(result).to respond_to(:to_sql) @@ -214,7 +215,7 @@ end end - context 'when db_adapter is trilogy' do + context 'when db_adapter is trilogy' do # rubocop:disable RSpec/RepeatedExampleGroupBody it 'can call #to_sql on returned object' do result = datatable.build_conditions_for_selected_columns expect(result).to respond_to(:to_sql) @@ -227,8 +228,9 @@ end it 'calls #build_conditions_for_selected_columns' do - expect(datatable).to receive(:build_conditions_for_selected_columns) + allow(datatable).to receive(:build_conditions_for_selected_columns) datatable.build_conditions + expect(datatable).to have_received(:build_conditions_for_selected_columns) end context 'with search values in columns' do @@ -240,13 +242,13 @@ query = datatable.build_conditions_for_selected_columns results = records.where(query).map(&:username) expect(results).to include('johndoe') - expect(results).not_to include('msmith') + expect(results).to_not include('msmith') end end end describe 'filter conditions' do - context 'date condition' do + context 'with date condition' do describe 'it can filter records with condition :date_range' do let(:datatable) { DatatableCondDate.new(sample_params) } @@ -329,7 +331,7 @@ end end - context 'numeric condition' do + context 'with numeric condition' do before do create(:user, first_name: 'john', post_id: 1) create(:user, first_name: 'mary', post_id: 2) @@ -448,7 +450,7 @@ end end - context 'proc condition' do + context 'with proc condition' do describe 'it can filter records with lambda/proc condition' do let(:datatable) { DatatableCondProc.new(sample_params) } @@ -467,7 +469,7 @@ end end - context 'string condition' do + context 'with string condition' do describe 'it can filter records with condition :start_with' do let(:datatable) { DatatableCondStartWith.new(sample_params) } @@ -605,7 +607,7 @@ end end - context 'unknown condition' do + context 'with unknown condition' do let(:datatable) { DatatableCondUnknown.new(sample_params) } before do @@ -619,7 +621,7 @@ end end - context 'custom column' do + context 'with custom column' do describe 'it can filter records with custom column' do let(:datatable) { DatatableCustomColumn.new(sample_params) } diff --git a/spec/ajax-datatables-rails/orm/active_record_paginate_records_spec.rb b/spec/ajax_datatables_rails/orm/active_record_paginate_records_spec.rb similarity index 83% rename from spec/ajax-datatables-rails/orm/active_record_paginate_records_spec.rb rename to spec/ajax_datatables_rails/orm/active_record_paginate_records_spec.rb index e715b2f..a33c834 100644 --- a/spec/ajax-datatables-rails/orm/active_record_paginate_records_spec.rb +++ b/spec/ajax_datatables_rails/orm/active_record_paginate_records_spec.rb @@ -17,7 +17,7 @@ expect { datatable.paginate_records }.to raise_error(ArgumentError) end - it 'paginates records properly' do + it 'paginates records properly' do # rubocop:disable RSpec/ExampleLength if RunningSpec.oracle? if Rails.version.in? %w[4.2.11] expect(datatable.paginate_records(records).to_sql).to include( @@ -54,13 +54,15 @@ end it 'depends on the value of #offset' do - expect(datatable.datatable).to receive(:offset) + allow(datatable.datatable).to receive(:offset) datatable.paginate_records(records) + expect(datatable.datatable).to have_received(:offset) end it 'depends on the value of #per_page' do - expect(datatable.datatable).to receive(:per_page).at_least(:once) { 10 } + allow(datatable.datatable).to receive(:per_page).at_least(:once).and_return(10) datatable.paginate_records(records) + expect(datatable.datatable).to have_received(:per_page).at_least(:once) end end diff --git a/spec/ajax-datatables-rails/orm/active_record_sort_records_spec.rb b/spec/ajax_datatables_rails/orm/active_record_sort_records_spec.rb similarity index 100% rename from spec/ajax-datatables-rails/orm/active_record_sort_records_spec.rb rename to spec/ajax_datatables_rails/orm/active_record_sort_records_spec.rb diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cd6970d..eb3641d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -85,4 +85,4 @@ def self.postgresql? require 'ajax-datatables-rails' # Load test helpers -Dir[File.dirname(__FILE__) + '/support/**/*.rb'].sort.each { |f| require f } +Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f } diff --git a/spec/support/datatables/complex_datatable.rb b/spec/support/datatables/complex_datatable.rb index ece7ee4..2999c46 100644 --- a/spec/support/datatables/complex_datatable.rb +++ b/spec/support/datatables/complex_datatable.rb @@ -14,7 +14,7 @@ def view_columns } end - def data + def data # rubocop:disable Metrics/MethodLength records.map do |record| { username: record.username, @@ -29,7 +29,7 @@ def data end end - def get_raw_records + def get_raw_records # rubocop:disable Naming/AccessorMethodName User.all end end diff --git a/spec/support/datatables/datatable_cond_string.rb b/spec/support/datatables/datatable_cond_string.rb index 42fb4ac..2cc78c1 100644 --- a/spec/support/datatables/datatable_cond_string.rb +++ b/spec/support/datatables/datatable_cond_string.rb @@ -38,6 +38,6 @@ def view_columns class DatatableWithFormater < ComplexDatatable def view_columns - super.deep_merge(last_name: { formatter: ->(o) { o.upcase } }) + super.deep_merge(last_name: { formatter: lambda(&:upcase) }) end end diff --git a/spec/support/datatables/datatable_custom_column.rb b/spec/support/datatables/datatable_custom_column.rb index 4740ade..2d8db39 100644 --- a/spec/support/datatables/datatable_custom_column.rb +++ b/spec/support/datatables/datatable_custom_column.rb @@ -5,7 +5,7 @@ def view_columns super.deep_merge(full_name: { cond: filter_full_name }) end - def get_raw_records + def get_raw_records # rubocop:disable Naming/AccessorMethodName User.select("*, CONCAT(first_name, ' ', last_name) as full_name") end diff --git a/spec/support/datatables/grouped_datatable_array.rb b/spec/support/datatables/grouped_datatable_array.rb index e4547ad..e23e012 100644 --- a/spec/support/datatables/grouped_datatable_array.rb +++ b/spec/support/datatables/grouped_datatable_array.rb @@ -2,7 +2,7 @@ class GroupedDatatable < ComplexDatatable - def get_raw_records + def get_raw_records # rubocop:disable Naming/AccessorMethodName User.all.group(:id) end end diff --git a/spec/support/helpers/params.rb b/spec/support/helpers/params.rb index dff2e79..0323ab5 100644 --- a/spec/support/helpers/params.rb +++ b/spec/support/helpers/params.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# rubocop:disable Metrics/MethodLength +# rubocop:disable Metrics/MethodLength, Layout/HashAlignment def sample_params ActionController::Parameters.new( { @@ -58,13 +58,16 @@ def sample_params 'order' => { '0' => { 'column' => '0', 'dir' => 'asc' }, }, - 'start' => '0', 'length' => '10', 'search' => { + 'start' => '0', + 'length' => '10', + 'search' => { 'value' => '', 'regex' => 'false' }, - '_' => '1423364387185' + '_' => '1423364387185', } ) end +# rubocop:enable Metrics/MethodLength, Layout/HashAlignment def sample_params_json hash_params = sample_params.to_unsafe_h @@ -72,7 +75,6 @@ def sample_params_json hash_params['order'] = hash_params['order'].values ActionController::Parameters.new(hash_params) end -# rubocop:enable Metrics/MethodLength def nulls_last_sql(datatable) case datatable.db_adapter diff --git a/spec/support/models/user.rb b/spec/support/models/user.rb index 887efd9..34d527e 100644 --- a/spec/support/models/user.rb +++ b/spec/support/models/user.rb @@ -8,8 +8,8 @@ def full_name end def email_hash - return nil if email.nil? + return nil if email.nil? - Digest::SHA256.hexdigest email + Digest::SHA256.hexdigest email end end From 53f86075ee95a5e5aefce8a7432dd2e771afcfdd Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 23 Sep 2024 21:25:57 +0200 Subject: [PATCH 34/60] Update appraisal gem --- Gemfile | 2 +- gemfiles/rails_7.0.8.gemfile | 2 +- gemfiles/rails_7.1.0.gemfile | 2 +- gemfiles/rails_7.2.0.gemfile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index f6dbad7..45eb77b 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source 'https://rubygems.org/' gemspec -gem 'appraisal', git: 'https://github.com/n-rodriguez/appraisal.git', branch: 'wip/combustion' +gem 'appraisal', git: 'https://github.com/thoughtbot/appraisal.git' # gem 'activerecord-oracle_enhanced-adapter' gem 'combustion' diff --git a/gemfiles/rails_7.0.8.gemfile b/gemfiles/rails_7.0.8.gemfile index 1f491ef..5e4c38b 100644 --- a/gemfiles/rails_7.0.8.gemfile +++ b/gemfiles/rails_7.0.8.gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org/" -gem "appraisal", git: "https://github.com/n-rodriguez/appraisal.git", branch: "wip/combustion" +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" gem "combustion" gem "database_cleaner" gem "factory_bot" diff --git a/gemfiles/rails_7.1.0.gemfile b/gemfiles/rails_7.1.0.gemfile index 97ecb80..77552bf 100644 --- a/gemfiles/rails_7.1.0.gemfile +++ b/gemfiles/rails_7.1.0.gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org/" -gem "appraisal", git: "https://github.com/n-rodriguez/appraisal.git", branch: "wip/combustion" +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" gem "combustion" gem "database_cleaner" gem "factory_bot" diff --git a/gemfiles/rails_7.2.0.gemfile b/gemfiles/rails_7.2.0.gemfile index ee0697d..2ed9ec3 100644 --- a/gemfiles/rails_7.2.0.gemfile +++ b/gemfiles/rails_7.2.0.gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org/" -gem "appraisal", git: "https://github.com/n-rodriguez/appraisal.git", branch: "wip/combustion" +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" gem "combustion" gem "database_cleaner" gem "factory_bot" From a21694e34e11810b8b46ad01a6f4144f13f7d117 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Tue, 24 Sep 2024 00:30:37 +0200 Subject: [PATCH 35/60] Bump to paambaati/codeclimate-action@v9 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab63d87..c112a18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -139,7 +139,7 @@ jobs: DB_ADAPTER: ${{ matrix.adapter }} - name: RSpec & publish code coverage - uses: paambaati/codeclimate-action@v8.0.0 + uses: paambaati/codeclimate-action@v9.0.0 env: DB_ADAPTER: ${{ matrix.adapter }} CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} From 9e9205c296c2b14952edd91c9a8f18201aa1aaa7 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Tue, 24 Sep 2024 17:12:33 +0200 Subject: [PATCH 36/60] Improve Appraisal config --- .github/workflows/ci.yml | 2 +- Appraisals | 192 +++++++++++++----- Gemfile | 6 +- gemfiles/rails_7.0.8_with_mysql2.gemfile | 36 ++++ .../rails_7.0.8_with_oracle_enhanced.gemfile | 37 ++++ ...mfile => rails_7.0.8_with_postgis.gemfile} | 24 +-- gemfiles/rails_7.0.8_with_postgresql.gemfile | 36 ++++ gemfiles/rails_7.0.8_with_sqlite3.gemfile | 36 ++++ gemfiles/rails_7.0.8_with_trilogy.gemfile | 36 ++++ gemfiles/rails_7.1.0.gemfile | 52 ----- gemfiles/rails_7.1.0_with_mysql2.gemfile | 26 +++ .../rails_7.1.0_with_oracle_enhanced.gemfile | 27 +++ gemfiles/rails_7.1.0_with_postgis.gemfile | 27 +++ gemfiles/rails_7.1.0_with_postgresql.gemfile | 26 +++ gemfiles/rails_7.1.0_with_sqlite3.gemfile | 26 +++ gemfiles/rails_7.1.0_with_trilogy.gemfile | 26 +++ gemfiles/rails_7.2.0.gemfile | 47 ----- gemfiles/rails_7.2.0_with_mysql2.gemfile | 26 +++ .../rails_7.2.0_with_oracle_enhanced.gemfile | 27 +++ gemfiles/rails_7.2.0_with_postgis.gemfile | 27 +++ gemfiles/rails_7.2.0_with_postgresql.gemfile | 26 +++ gemfiles/rails_7.2.0_with_sqlite3.gemfile | 26 +++ gemfiles/rails_7.2.0_with_trilogy.gemfile | 26 +++ 23 files changed, 645 insertions(+), 175 deletions(-) create mode 100644 gemfiles/rails_7.0.8_with_mysql2.gemfile create mode 100644 gemfiles/rails_7.0.8_with_oracle_enhanced.gemfile rename gemfiles/{rails_7.0.8.gemfile => rails_7.0.8_with_postgis.gemfile} (58%) create mode 100644 gemfiles/rails_7.0.8_with_postgresql.gemfile create mode 100644 gemfiles/rails_7.0.8_with_sqlite3.gemfile create mode 100644 gemfiles/rails_7.0.8_with_trilogy.gemfile delete mode 100644 gemfiles/rails_7.1.0.gemfile create mode 100644 gemfiles/rails_7.1.0_with_mysql2.gemfile create mode 100644 gemfiles/rails_7.1.0_with_oracle_enhanced.gemfile create mode 100644 gemfiles/rails_7.1.0_with_postgis.gemfile create mode 100644 gemfiles/rails_7.1.0_with_postgresql.gemfile create mode 100644 gemfiles/rails_7.1.0_with_sqlite3.gemfile create mode 100644 gemfiles/rails_7.1.0_with_trilogy.gemfile delete mode 100644 gemfiles/rails_7.2.0.gemfile create mode 100644 gemfiles/rails_7.2.0_with_mysql2.gemfile create mode 100644 gemfiles/rails_7.2.0_with_oracle_enhanced.gemfile create mode 100644 gemfiles/rails_7.2.0_with_postgis.gemfile create mode 100644 gemfiles/rails_7.2.0_with_postgresql.gemfile create mode 100644 gemfiles/rails_7.2.0_with_sqlite3.gemfile create mode 100644 gemfiles/rails_7.2.0_with_trilogy.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c112a18..58d43f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps - BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails }}.gemfile + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails }}_with_${{ matrix.adapter }}.gemfile ORACLE_COOKIE: sqldev ORACLE_FILE: oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip ORACLE_HOME: /u01/app/oracle/product/11.2.0/xe diff --git a/Appraisals b/Appraisals index 53eb9ac..41b0c37 100644 --- a/Appraisals +++ b/Appraisals @@ -1,28 +1,48 @@ # frozen_string_literal: true -appraise 'rails_7.0.8' do # rubocop:disable Metrics/BlockLength - gem 'rails', '7.0.8' +############### +# RAILS 7.0.8 # +############### - install_if '-> { ENV["DB_ADAPTER"] == "sqlite3" }' do - gem 'sqlite3', '~> 1.5.0' - end +appraise 'rails_7.0.8_with_postgresql' do + gem 'rails', '7.0.8' + gem 'pg' - install_if '-> { ENV["DB_ADAPTER"] == "mysql2" }' do - gem 'mysql2' + # Fix: + # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 + # Add logger to your Gemfile or gemspec. + install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do + gem 'base64' + gem 'bigdecimal' + gem 'benchmark' + gem 'drb' + gem 'logger' + gem 'mutex_m' + gem 'ostruct' end +end - install_if '-> { ENV["DB_ADAPTER"] == "trilogy" }' do - gem 'activerecord-trilogy-adapter' - end +appraise 'rails_7.0.8_with_sqlite3' do + gem 'rails', '7.0.8' + gem 'sqlite3', '~> 1.5.0' - install_if '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' do - gem 'ruby-oci8' - gem 'activerecord-oracle_enhanced-adapter', '~> 7.0.0' + # Fix: + # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 + # Add logger to your Gemfile or gemspec. + install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do + gem 'base64' + gem 'bigdecimal' + gem 'benchmark' + gem 'drb' + gem 'logger' + gem 'mutex_m' + gem 'ostruct' end +end - install_if '-> { ENV["DB_ADAPTER"] == "postgis" }' do - gem 'activerecord-postgis-adapter' - end +appraise 'rails_7.0.8_with_mysql2' do + gem 'rails', '7.0.8' + gem 'mysql2' # Fix: # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 @@ -38,60 +58,130 @@ appraise 'rails_7.0.8' do # rubocop:disable Metrics/BlockLength end end -appraise 'rails_7.1.0' do - gem 'rails', '7.1.0' - - install_if '-> { ENV["DB_ADAPTER"] == "sqlite3" }' do - gem 'sqlite3', '~> 1.5.0' - end +appraise 'rails_7.0.8_with_trilogy' do + gem 'rails', '7.0.8' + gem 'activerecord-trilogy-adapter' - install_if '-> { ENV["DB_ADAPTER"] == "mysql2" }' do - gem 'mysql2' + # Fix: + # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 + # Add logger to your Gemfile or gemspec. + install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do + gem 'base64' + gem 'bigdecimal' + gem 'benchmark' + gem 'drb' + gem 'logger' + gem 'mutex_m' + gem 'ostruct' end +end - install_if '-> { ENV["DB_ADAPTER"] == "trilogy" }' do - gem 'activerecord-trilogy-adapter' - end +appraise 'rails_7.0.8_with_oracle_enhanced' do + gem 'rails', '7.0.8' + gem 'ruby-oci8' + gem 'activerecord-oracle_enhanced-adapter', '~> 7.0.0' - install_if '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' do - gem 'ruby-oci8' - gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git' + # Fix: + # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 + # Add logger to your Gemfile or gemspec. + install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do + gem 'base64' + gem 'bigdecimal' + gem 'benchmark' + gem 'drb' + gem 'logger' + gem 'mutex_m' + gem 'ostruct' end +end - install_if '-> { ENV["DB_ADAPTER"] == "postgis" }' do - gem 'activerecord-postgis-adapter' - end +appraise 'rails_7.0.8_with_postgis' do + gem 'rails', '7.0.8' + gem 'pg' + gem 'activerecord-postgis-adapter' # Fix: # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 # Add logger to your Gemfile or gemspec. - install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.3.0") }' do + install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do + gem 'base64' + gem 'bigdecimal' + gem 'benchmark' + gem 'drb' gem 'logger' + gem 'mutex_m' gem 'ostruct' end end -appraise 'rails_7.2.0' do +############### +# RAILS 7.1.0 # +############### + +appraise 'rails_7.1.0_with_postgresql' do + gem 'rails', '7.1.0' + gem 'pg' +end + +appraise 'rails_7.1.0_with_sqlite3' do + gem 'rails', '7.1.0' + gem 'sqlite3', '~> 1.5.0' +end + +appraise 'rails_7.1.0_with_mysql2' do + gem 'rails', '7.1.0' + gem 'mysql2' +end + +appraise 'rails_7.1.0_with_trilogy' do + gem 'rails', '7.1.0' + gem 'activerecord-trilogy-adapter' +end + +appraise 'rails_7.1.0_with_oracle_enhanced' do + gem 'rails', '7.1.0' + gem 'ruby-oci8' + gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git' +end + +appraise 'rails_7.1.0_with_postgis' do + gem 'rails', '7.1.0' + gem 'pg' + gem 'activerecord-postgis-adapter' +end + +############### +# RAILS 7.2.0 # +############### + +appraise 'rails_7.2.0_with_postgresql' do gem 'rails', '7.2.0' + gem 'pg' +end - install_if '-> { ENV["DB_ADAPTER"] == "sqlite3" }' do - gem 'sqlite3', '~> 1.5.0' - end +appraise 'rails_7.2.0_with_sqlite3' do + gem 'rails', '7.2.0' + gem 'sqlite3', '~> 1.5.0' +end - install_if '-> { ENV["DB_ADAPTER"] == "mysql2" }' do - gem 'mysql2' - end +appraise 'rails_7.2.0_with_mysql2' do + gem 'rails', '7.2.0' + gem 'mysql2' +end - install_if '-> { ENV["DB_ADAPTER"] == "trilogy" }' do - gem 'activerecord-trilogy-adapter' - end +appraise 'rails_7.2.0_with_trilogy' do + gem 'rails', '7.2.0' + gem 'activerecord-trilogy-adapter' +end - install_if '-> { ENV["DB_ADAPTER"] == "oracle_enhanced" }' do - gem 'ruby-oci8' - gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git' - end +appraise 'rails_7.2.0_with_oracle_enhanced' do + gem 'rails', '7.2.0' + gem 'ruby-oci8' + gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git' +end - install_if '-> { ENV["DB_ADAPTER"] == "postgis" }' do - gem 'activerecord-postgis-adapter', git: 'https://github.com/rgeo/activerecord-postgis-adapter.git' - end +appraise 'rails_7.2.0_with_postgis' do + gem 'rails', '7.2.0' + gem 'pg' + gem 'activerecord-postgis-adapter', git: 'https://github.com/rgeo/activerecord-postgis-adapter.git' end diff --git a/Gemfile b/Gemfile index 45eb77b..f9de92e 100644 --- a/Gemfile +++ b/Gemfile @@ -6,14 +6,12 @@ gemspec gem 'appraisal', git: 'https://github.com/thoughtbot/appraisal.git' -# gem 'activerecord-oracle_enhanced-adapter' gem 'combustion' gem 'database_cleaner' gem 'factory_bot' gem 'faker' gem 'generator_spec' gem 'guard-rspec' -gem 'pg' gem 'pry' gem 'puma' gem 'rake' @@ -25,3 +23,7 @@ gem 'rubocop-performance' gem 'rubocop-rake' gem 'rubocop-rspec' gem 'simplecov' + +# Fallback to pg if DB_ADAPTER is not set (like in dev/local environment) +# so we can still call bin/rspec +gem 'pg' if $PROGRAM_NAME == 'bin/rspec' && ENV['DB_ADAPTER'].nil? diff --git a/gemfiles/rails_7.0.8_with_mysql2.gemfile b/gemfiles/rails_7.0.8_with_mysql2.gemfile new file mode 100644 index 0000000..90d9868 --- /dev/null +++ b/gemfiles/rails_7.0.8_with_mysql2.gemfile @@ -0,0 +1,36 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.0.8" +gem "mysql2" + +install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do + gem "base64" + gem "bigdecimal" + gem "benchmark" + gem "drb" + gem "logger" + gem "mutex_m" + gem "ostruct" +end + +gemspec path: "../" diff --git a/gemfiles/rails_7.0.8_with_oracle_enhanced.gemfile b/gemfiles/rails_7.0.8_with_oracle_enhanced.gemfile new file mode 100644 index 0000000..5abe305 --- /dev/null +++ b/gemfiles/rails_7.0.8_with_oracle_enhanced.gemfile @@ -0,0 +1,37 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.0.8" +gem "ruby-oci8" +gem "activerecord-oracle_enhanced-adapter", "~> 7.0.0" + +install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do + gem "base64" + gem "bigdecimal" + gem "benchmark" + gem "drb" + gem "logger" + gem "mutex_m" + gem "ostruct" +end + +gemspec path: "../" diff --git a/gemfiles/rails_7.0.8.gemfile b/gemfiles/rails_7.0.8_with_postgis.gemfile similarity index 58% rename from gemfiles/rails_7.0.8.gemfile rename to gemfiles/rails_7.0.8_with_postgis.gemfile index 5e4c38b..557dd80 100644 --- a/gemfiles/rails_7.0.8.gemfile +++ b/gemfiles/rails_7.0.8_with_postgis.gemfile @@ -9,7 +9,6 @@ gem "factory_bot" gem "faker" gem "generator_spec" gem "guard-rspec" -gem "pg" gem "pry" gem "puma" gem "rake" @@ -22,27 +21,8 @@ gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" gem "rails", "7.0.8" - -install_if -> { ENV["DB_ADAPTER"] == "sqlite3" } do - gem "sqlite3", "~> 1.5.0" -end - -install_if -> { ENV["DB_ADAPTER"] == "mysql2" } do - gem "mysql2" -end - -install_if -> { ENV["DB_ADAPTER"] == "trilogy" } do - gem "activerecord-trilogy-adapter" -end - -install_if -> { ENV["DB_ADAPTER"] == "oracle_enhanced" } do - gem "ruby-oci8" - gem "activerecord-oracle_enhanced-adapter", "~> 7.0.0" -end - -install_if -> { ENV["DB_ADAPTER"] == "postgis" } do - gem "activerecord-postgis-adapter" -end +gem "pg" +gem "activerecord-postgis-adapter" install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do gem "base64" diff --git a/gemfiles/rails_7.0.8_with_postgresql.gemfile b/gemfiles/rails_7.0.8_with_postgresql.gemfile new file mode 100644 index 0000000..c0b6fe6 --- /dev/null +++ b/gemfiles/rails_7.0.8_with_postgresql.gemfile @@ -0,0 +1,36 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.0.8" +gem "pg" + +install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do + gem "base64" + gem "bigdecimal" + gem "benchmark" + gem "drb" + gem "logger" + gem "mutex_m" + gem "ostruct" +end + +gemspec path: "../" diff --git a/gemfiles/rails_7.0.8_with_sqlite3.gemfile b/gemfiles/rails_7.0.8_with_sqlite3.gemfile new file mode 100644 index 0000000..1ac98dd --- /dev/null +++ b/gemfiles/rails_7.0.8_with_sqlite3.gemfile @@ -0,0 +1,36 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.0.8" +gem "sqlite3", "~> 1.5.0" + +install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do + gem "base64" + gem "bigdecimal" + gem "benchmark" + gem "drb" + gem "logger" + gem "mutex_m" + gem "ostruct" +end + +gemspec path: "../" diff --git a/gemfiles/rails_7.0.8_with_trilogy.gemfile b/gemfiles/rails_7.0.8_with_trilogy.gemfile new file mode 100644 index 0000000..eb10fc5 --- /dev/null +++ b/gemfiles/rails_7.0.8_with_trilogy.gemfile @@ -0,0 +1,36 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.0.8" +gem "activerecord-trilogy-adapter" + +install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do + gem "base64" + gem "bigdecimal" + gem "benchmark" + gem "drb" + gem "logger" + gem "mutex_m" + gem "ostruct" +end + +gemspec path: "../" diff --git a/gemfiles/rails_7.1.0.gemfile b/gemfiles/rails_7.1.0.gemfile deleted file mode 100644 index 77552bf..0000000 --- a/gemfiles/rails_7.1.0.gemfile +++ /dev/null @@ -1,52 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org/" - -gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" -gem "combustion" -gem "database_cleaner" -gem "factory_bot" -gem "faker" -gem "generator_spec" -gem "guard-rspec" -gem "pg" -gem "pry" -gem "puma" -gem "rake" -gem "rspec" -gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" -gem "simplecov" -gem "rails", "7.1.0" - -install_if -> { ENV["DB_ADAPTER"] == "sqlite3" } do - gem "sqlite3", "~> 1.5.0" -end - -install_if -> { ENV["DB_ADAPTER"] == "mysql2" } do - gem "mysql2" -end - -install_if -> { ENV["DB_ADAPTER"] == "trilogy" } do - gem "activerecord-trilogy-adapter" -end - -install_if -> { ENV["DB_ADAPTER"] == "oracle_enhanced" } do - gem "ruby-oci8" - gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git" -end - -install_if -> { ENV["DB_ADAPTER"] == "postgis" } do - gem "activerecord-postgis-adapter" -end - -install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.3.0") } do - gem "logger" - gem "ostruct" -end - -gemspec path: "../" diff --git a/gemfiles/rails_7.1.0_with_mysql2.gemfile b/gemfiles/rails_7.1.0_with_mysql2.gemfile new file mode 100644 index 0000000..00798ab --- /dev/null +++ b/gemfiles/rails_7.1.0_with_mysql2.gemfile @@ -0,0 +1,26 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.1.0" +gem "mysql2" + +gemspec path: "../" diff --git a/gemfiles/rails_7.1.0_with_oracle_enhanced.gemfile b/gemfiles/rails_7.1.0_with_oracle_enhanced.gemfile new file mode 100644 index 0000000..4b06936 --- /dev/null +++ b/gemfiles/rails_7.1.0_with_oracle_enhanced.gemfile @@ -0,0 +1,27 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.1.0" +gem "ruby-oci8" +gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git" + +gemspec path: "../" diff --git a/gemfiles/rails_7.1.0_with_postgis.gemfile b/gemfiles/rails_7.1.0_with_postgis.gemfile new file mode 100644 index 0000000..9f48bf3 --- /dev/null +++ b/gemfiles/rails_7.1.0_with_postgis.gemfile @@ -0,0 +1,27 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.1.0" +gem "pg" +gem "activerecord-postgis-adapter" + +gemspec path: "../" diff --git a/gemfiles/rails_7.1.0_with_postgresql.gemfile b/gemfiles/rails_7.1.0_with_postgresql.gemfile new file mode 100644 index 0000000..338df42 --- /dev/null +++ b/gemfiles/rails_7.1.0_with_postgresql.gemfile @@ -0,0 +1,26 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.1.0" +gem "pg" + +gemspec path: "../" diff --git a/gemfiles/rails_7.1.0_with_sqlite3.gemfile b/gemfiles/rails_7.1.0_with_sqlite3.gemfile new file mode 100644 index 0000000..ecceebf --- /dev/null +++ b/gemfiles/rails_7.1.0_with_sqlite3.gemfile @@ -0,0 +1,26 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.1.0" +gem "sqlite3", "~> 1.5.0" + +gemspec path: "../" diff --git a/gemfiles/rails_7.1.0_with_trilogy.gemfile b/gemfiles/rails_7.1.0_with_trilogy.gemfile new file mode 100644 index 0000000..9ac220c --- /dev/null +++ b/gemfiles/rails_7.1.0_with_trilogy.gemfile @@ -0,0 +1,26 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.1.0" +gem "activerecord-trilogy-adapter" + +gemspec path: "../" diff --git a/gemfiles/rails_7.2.0.gemfile b/gemfiles/rails_7.2.0.gemfile deleted file mode 100644 index 2ed9ec3..0000000 --- a/gemfiles/rails_7.2.0.gemfile +++ /dev/null @@ -1,47 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org/" - -gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" -gem "combustion" -gem "database_cleaner" -gem "factory_bot" -gem "faker" -gem "generator_spec" -gem "guard-rspec" -gem "pg" -gem "pry" -gem "puma" -gem "rake" -gem "rspec" -gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" -gem "simplecov" -gem "rails", "7.2.0" - -install_if -> { ENV["DB_ADAPTER"] == "sqlite3" } do - gem "sqlite3", "~> 1.5.0" -end - -install_if -> { ENV["DB_ADAPTER"] == "mysql2" } do - gem "mysql2" -end - -install_if -> { ENV["DB_ADAPTER"] == "trilogy" } do - gem "activerecord-trilogy-adapter" -end - -install_if -> { ENV["DB_ADAPTER"] == "oracle_enhanced" } do - gem "ruby-oci8" - gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git" -end - -install_if -> { ENV["DB_ADAPTER"] == "postgis" } do - gem "activerecord-postgis-adapter", git: "https://github.com/rgeo/activerecord-postgis-adapter.git" -end - -gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_mysql2.gemfile b/gemfiles/rails_7.2.0_with_mysql2.gemfile new file mode 100644 index 0000000..9deebff --- /dev/null +++ b/gemfiles/rails_7.2.0_with_mysql2.gemfile @@ -0,0 +1,26 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.2.0" +gem "mysql2" + +gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_oracle_enhanced.gemfile b/gemfiles/rails_7.2.0_with_oracle_enhanced.gemfile new file mode 100644 index 0000000..17cf98a --- /dev/null +++ b/gemfiles/rails_7.2.0_with_oracle_enhanced.gemfile @@ -0,0 +1,27 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.2.0" +gem "ruby-oci8" +gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git" + +gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_postgis.gemfile b/gemfiles/rails_7.2.0_with_postgis.gemfile new file mode 100644 index 0000000..ae61696 --- /dev/null +++ b/gemfiles/rails_7.2.0_with_postgis.gemfile @@ -0,0 +1,27 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.2.0" +gem "pg" +gem "activerecord-postgis-adapter", git: "https://github.com/rgeo/activerecord-postgis-adapter.git" + +gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_postgresql.gemfile b/gemfiles/rails_7.2.0_with_postgresql.gemfile new file mode 100644 index 0000000..f8fb186 --- /dev/null +++ b/gemfiles/rails_7.2.0_with_postgresql.gemfile @@ -0,0 +1,26 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.2.0" +gem "pg" + +gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_sqlite3.gemfile b/gemfiles/rails_7.2.0_with_sqlite3.gemfile new file mode 100644 index 0000000..3ba3ec0 --- /dev/null +++ b/gemfiles/rails_7.2.0_with_sqlite3.gemfile @@ -0,0 +1,26 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.2.0" +gem "sqlite3", "~> 1.5.0" + +gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_trilogy.gemfile b/gemfiles/rails_7.2.0_with_trilogy.gemfile new file mode 100644 index 0000000..3a148a9 --- /dev/null +++ b/gemfiles/rails_7.2.0_with_trilogy.gemfile @@ -0,0 +1,26 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "guard-rspec" +gem "pry" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "rubocop" +gem "rubocop-factory_bot" +gem "rubocop-performance" +gem "rubocop-rake" +gem "rubocop-rspec" +gem "simplecov" +gem "rails", "7.2.0" +gem "activerecord-trilogy-adapter" + +gemspec path: "../" From ed2d71ec78632f43dbcf4903dc109886dec32783 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Tue, 24 Sep 2024 17:47:42 +0200 Subject: [PATCH 37/60] Add comments to explain why trilogy adapter is disabled in CI --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58d43f3..21ea447 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,6 +86,10 @@ jobs: - mysql2 - oracle_enhanced - postgis + # Disabled for now: + # Rails 7.0: trilogy_auth_recv: caching_sha2_password requires either TCP with TLS or a unix socket: TRILOGY_UNSUPPORTED + # Rails 7.1: unknown keyword: :uses_transaction + # Rails 7.2: NotImplementedError # - trilogy exclude: # Rails 7.2 needs Ruby > 3.1 From cf90db435f7016d9bc1d12df3b8be743aff9b355 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sat, 28 Sep 2024 17:53:25 +0200 Subject: [PATCH 38/60] Improve Appraisal config --- Appraisals | 12 ++++++++++++ Gemfile | 5 ++--- gemfiles/rails_7.0.8_with_postgis.gemfile | 2 +- gemfiles/rails_7.0.8_with_postgresql.gemfile | 2 +- gemfiles/rails_7.1.0_with_postgis.gemfile | 2 +- gemfiles/rails_7.1.0_with_postgresql.gemfile | 2 +- gemfiles/rails_7.2.0_with_postgis.gemfile | 2 +- gemfiles/rails_7.2.0_with_postgresql.gemfile | 2 +- 8 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Appraisals b/Appraisals index 41b0c37..ab74f6e 100644 --- a/Appraisals +++ b/Appraisals @@ -25,6 +25,7 @@ end appraise 'rails_7.0.8_with_sqlite3' do gem 'rails', '7.0.8' gem 'sqlite3', '~> 1.5.0' + remove_gem 'pg' # Fix: # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 @@ -43,6 +44,7 @@ end appraise 'rails_7.0.8_with_mysql2' do gem 'rails', '7.0.8' gem 'mysql2' + remove_gem 'pg' # Fix: # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 @@ -61,6 +63,7 @@ end appraise 'rails_7.0.8_with_trilogy' do gem 'rails', '7.0.8' gem 'activerecord-trilogy-adapter' + remove_gem 'pg' # Fix: # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 @@ -80,6 +83,7 @@ appraise 'rails_7.0.8_with_oracle_enhanced' do gem 'rails', '7.0.8' gem 'ruby-oci8' gem 'activerecord-oracle_enhanced-adapter', '~> 7.0.0' + remove_gem 'pg' # Fix: # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 @@ -126,22 +130,26 @@ end appraise 'rails_7.1.0_with_sqlite3' do gem 'rails', '7.1.0' gem 'sqlite3', '~> 1.5.0' + remove_gem 'pg' end appraise 'rails_7.1.0_with_mysql2' do gem 'rails', '7.1.0' gem 'mysql2' + remove_gem 'pg' end appraise 'rails_7.1.0_with_trilogy' do gem 'rails', '7.1.0' gem 'activerecord-trilogy-adapter' + remove_gem 'pg' end appraise 'rails_7.1.0_with_oracle_enhanced' do gem 'rails', '7.1.0' gem 'ruby-oci8' gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git' + remove_gem 'pg' end appraise 'rails_7.1.0_with_postgis' do @@ -162,22 +170,26 @@ end appraise 'rails_7.2.0_with_sqlite3' do gem 'rails', '7.2.0' gem 'sqlite3', '~> 1.5.0' + remove_gem 'pg' end appraise 'rails_7.2.0_with_mysql2' do gem 'rails', '7.2.0' gem 'mysql2' + remove_gem 'pg' end appraise 'rails_7.2.0_with_trilogy' do gem 'rails', '7.2.0' gem 'activerecord-trilogy-adapter' + remove_gem 'pg' end appraise 'rails_7.2.0_with_oracle_enhanced' do gem 'rails', '7.2.0' gem 'ruby-oci8' gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git' + remove_gem 'pg' end appraise 'rails_7.2.0_with_postgis' do diff --git a/Gemfile b/Gemfile index f9de92e..e37e11d 100644 --- a/Gemfile +++ b/Gemfile @@ -24,6 +24,5 @@ gem 'rubocop-rake' gem 'rubocop-rspec' gem 'simplecov' -# Fallback to pg if DB_ADAPTER is not set (like in dev/local environment) -# so we can still call bin/rspec -gem 'pg' if $PROGRAM_NAME == 'bin/rspec' && ENV['DB_ADAPTER'].nil? +# Fallback to pg in dev/local environment +gem 'pg' diff --git a/gemfiles/rails_7.0.8_with_postgis.gemfile b/gemfiles/rails_7.0.8_with_postgis.gemfile index 557dd80..0f907b2 100644 --- a/gemfiles/rails_7.0.8_with_postgis.gemfile +++ b/gemfiles/rails_7.0.8_with_postgis.gemfile @@ -20,8 +20,8 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.0.8" gem "pg" +gem "rails", "7.0.8" gem "activerecord-postgis-adapter" install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do diff --git a/gemfiles/rails_7.0.8_with_postgresql.gemfile b/gemfiles/rails_7.0.8_with_postgresql.gemfile index c0b6fe6..b220290 100644 --- a/gemfiles/rails_7.0.8_with_postgresql.gemfile +++ b/gemfiles/rails_7.0.8_with_postgresql.gemfile @@ -20,8 +20,8 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.0.8" gem "pg" +gem "rails", "7.0.8" install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do gem "base64" diff --git a/gemfiles/rails_7.1.0_with_postgis.gemfile b/gemfiles/rails_7.1.0_with_postgis.gemfile index 9f48bf3..c7a8276 100644 --- a/gemfiles/rails_7.1.0_with_postgis.gemfile +++ b/gemfiles/rails_7.1.0_with_postgis.gemfile @@ -20,8 +20,8 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.1.0" gem "pg" +gem "rails", "7.1.0" gem "activerecord-postgis-adapter" gemspec path: "../" diff --git a/gemfiles/rails_7.1.0_with_postgresql.gemfile b/gemfiles/rails_7.1.0_with_postgresql.gemfile index 338df42..02ad001 100644 --- a/gemfiles/rails_7.1.0_with_postgresql.gemfile +++ b/gemfiles/rails_7.1.0_with_postgresql.gemfile @@ -20,7 +20,7 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.1.0" gem "pg" +gem "rails", "7.1.0" gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_postgis.gemfile b/gemfiles/rails_7.2.0_with_postgis.gemfile index ae61696..81dbb10 100644 --- a/gemfiles/rails_7.2.0_with_postgis.gemfile +++ b/gemfiles/rails_7.2.0_with_postgis.gemfile @@ -20,8 +20,8 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.2.0" gem "pg" +gem "rails", "7.2.0" gem "activerecord-postgis-adapter", git: "https://github.com/rgeo/activerecord-postgis-adapter.git" gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_postgresql.gemfile b/gemfiles/rails_7.2.0_with_postgresql.gemfile index f8fb186..1c9c96f 100644 --- a/gemfiles/rails_7.2.0_with_postgresql.gemfile +++ b/gemfiles/rails_7.2.0_with_postgresql.gemfile @@ -20,7 +20,7 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.2.0" gem "pg" +gem "rails", "7.2.0" gemspec path: "../" From 3f53a49ff0a9a050712caeadb8645f236a5b38a8 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sat, 28 Sep 2024 17:59:18 +0200 Subject: [PATCH 39/60] oracle-enhanced v7.1.x is out \o/ --- Appraisals | 4 +--- gemfiles/rails_7.1.0_with_oracle_enhanced.gemfile | 3 +-- gemfiles/rails_7.2.0_with_oracle_enhanced.gemfile | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Appraisals b/Appraisals index ab74f6e..9560257 100644 --- a/Appraisals +++ b/Appraisals @@ -147,8 +147,7 @@ end appraise 'rails_7.1.0_with_oracle_enhanced' do gem 'rails', '7.1.0' - gem 'ruby-oci8' - gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git' + gem 'activerecord-oracle_enhanced-adapter', '~> 7.1.0' remove_gem 'pg' end @@ -187,7 +186,6 @@ end appraise 'rails_7.2.0_with_oracle_enhanced' do gem 'rails', '7.2.0' - gem 'ruby-oci8' gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git' remove_gem 'pg' end diff --git a/gemfiles/rails_7.1.0_with_oracle_enhanced.gemfile b/gemfiles/rails_7.1.0_with_oracle_enhanced.gemfile index 4b06936..2ce152c 100644 --- a/gemfiles/rails_7.1.0_with_oracle_enhanced.gemfile +++ b/gemfiles/rails_7.1.0_with_oracle_enhanced.gemfile @@ -21,7 +21,6 @@ gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" gem "rails", "7.1.0" -gem "ruby-oci8" -gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git" +gem "activerecord-oracle_enhanced-adapter", "~> 7.1.0" gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_oracle_enhanced.gemfile b/gemfiles/rails_7.2.0_with_oracle_enhanced.gemfile index 17cf98a..ec1368b 100644 --- a/gemfiles/rails_7.2.0_with_oracle_enhanced.gemfile +++ b/gemfiles/rails_7.2.0_with_oracle_enhanced.gemfile @@ -21,7 +21,6 @@ gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" gem "rails", "7.2.0" -gem "ruby-oci8" gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git" gemspec path: "../" From e94fc295f9af0b87b683fcdc276e41dcf2430def Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sat, 28 Sep 2024 18:01:07 +0200 Subject: [PATCH 40/60] Re-enable CI for oracle_enhanced with Rails 7.1 --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21ea447..7892ab5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,8 +109,6 @@ jobs: # `create_apiwrap' - rails: rails_7.2.0 adapter: oracle_enhanced - - rails: rails_7.1.0 - adapter: oracle_enhanced steps: - name: Checkout From 3dd685b79bc4fde13875894ac04c2bd8b9e90ac7 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Mon, 30 Sep 2024 02:33:10 +0200 Subject: [PATCH 41/60] Coding style --- .rubocop.yml | 1 - lib/ajax-datatables-rails.rb | 19 +++++++++++-------- lib/generators/rails/datatable_generator.rb | 2 +- .../{datatable.rb => datatable.rb.erb} | 0 4 files changed, 12 insertions(+), 10 deletions(-) rename lib/generators/rails/templates/{datatable.rb => datatable.rb.erb} (100%) diff --git a/.rubocop.yml b/.rubocop.yml index f97f216..912f20f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,7 +12,6 @@ AllCops: - bin/* - gemfiles/* - spec/dummy/**/* - - lib/generators/**/*.rb ######### # STYLE # diff --git a/lib/ajax-datatables-rails.rb b/lib/ajax-datatables-rails.rb index 05d6fff..cb9f515 100644 --- a/lib/ajax-datatables-rails.rb +++ b/lib/ajax-datatables-rails.rb @@ -1,14 +1,17 @@ # frozen_string_literal: true +# require external dependencies require 'zeitwerk' -loader = Zeitwerk::Loader.for_gem -generators = "#{__dir__}/generators" -loader.ignore(generators) -loader.inflector.inflect( - 'orm' => 'ORM', - 'ajax-datatables-rails' => 'AjaxDatatablesRails' -) -loader.setup + +# load zeitwerk +Zeitwerk::Loader.for_gem.tap do |loader| + loader.ignore("#{__dir__}/generators") + loader.inflector.inflect( + 'orm' => 'ORM', + 'ajax-datatables-rails' => 'AjaxDatatablesRails' + ) + loader.setup +end module AjaxDatatablesRails end diff --git a/lib/generators/rails/datatable_generator.rb b/lib/generators/rails/datatable_generator.rb index 5ef5afd..8e582bc 100644 --- a/lib/generators/rails/datatable_generator.rb +++ b/lib/generators/rails/datatable_generator.rb @@ -10,7 +10,7 @@ class DatatableGenerator < ::Rails::Generators::Base argument :name, type: :string def generate_datatable - template 'datatable.rb', File.join('app', 'datatables', "#{datatable_path}.rb") + template 'datatable.rb.erb', File.join('app', 'datatables', "#{datatable_path}.rb") end def datatable_name diff --git a/lib/generators/rails/templates/datatable.rb b/lib/generators/rails/templates/datatable.rb.erb similarity index 100% rename from lib/generators/rails/templates/datatable.rb rename to lib/generators/rails/templates/datatable.rb.erb From 885c581085fed3310e245a6488ea407b9e4b6167 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sat, 12 Oct 2024 17:47:21 +0200 Subject: [PATCH 42/60] Make gem smaller --- ajax-datatables-rails.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ajax-datatables-rails.gemspec b/ajax-datatables-rails.gemspec index 1c2ddb1..6bf0f39 100644 --- a/ajax-datatables-rails.gemspec +++ b/ajax-datatables-rails.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 3.0.0' - s.files = `git ls-files`.split("\n") + s.files = Dir['README.md', 'CHANGELOG.md', 'LICENSE', 'lib/**/*.rb', 'lib/**/*.erb'] s.add_dependency 'rails', '>= 7.0' s.add_dependency 'zeitwerk' From ab1b7d3e7ed04e3737dc59fee61a8fa676927e5a Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 8 Nov 2024 00:44:53 +0100 Subject: [PATCH 43/60] Improve Appraisal config --- .github/workflows/ci.yml | 10 +-- Appraisals | 74 +++++++++---------- ....gemfile => rails_7.0_with_mysql2.gemfile} | 2 +- ...=> rails_7.0_with_oracle_enhanced.gemfile} | 2 +- ...gemfile => rails_7.0_with_postgis.gemfile} | 2 +- ...file => rails_7.0_with_postgresql.gemfile} | 2 +- ...gemfile => rails_7.0_with_sqlite3.gemfile} | 2 +- ...gemfile => rails_7.0_with_trilogy.gemfile} | 2 +- ....gemfile => rails_7.1_with_mysql2.gemfile} | 2 +- ...=> rails_7.1_with_oracle_enhanced.gemfile} | 2 +- ...gemfile => rails_7.1_with_postgis.gemfile} | 2 +- ...file => rails_7.1_with_postgresql.gemfile} | 2 +- ...gemfile => rails_7.1_with_sqlite3.gemfile} | 2 +- ...gemfile => rails_7.1_with_trilogy.gemfile} | 2 +- ....gemfile => rails_7.2_with_mysql2.gemfile} | 2 +- ...=> rails_7.2_with_oracle_enhanced.gemfile} | 2 +- ...gemfile => rails_7.2_with_postgis.gemfile} | 2 +- ...file => rails_7.2_with_postgresql.gemfile} | 2 +- ...gemfile => rails_7.2_with_sqlite3.gemfile} | 2 +- ...gemfile => rails_7.2_with_trilogy.gemfile} | 2 +- 20 files changed, 60 insertions(+), 60 deletions(-) rename gemfiles/{rails_7.0.8_with_mysql2.gemfile => rails_7.0_with_mysql2.gemfile} (96%) rename gemfiles/{rails_7.0.8_with_oracle_enhanced.gemfile => rails_7.0_with_oracle_enhanced.gemfile} (96%) rename gemfiles/{rails_7.0.8_with_postgis.gemfile => rails_7.0_with_postgis.gemfile} (96%) rename gemfiles/{rails_7.0.8_with_postgresql.gemfile => rails_7.0_with_postgresql.gemfile} (96%) rename gemfiles/{rails_7.0.8_with_sqlite3.gemfile => rails_7.0_with_sqlite3.gemfile} (96%) rename gemfiles/{rails_7.0.8_with_trilogy.gemfile => rails_7.0_with_trilogy.gemfile} (96%) rename gemfiles/{rails_7.1.0_with_mysql2.gemfile => rails_7.1_with_mysql2.gemfile} (95%) rename gemfiles/{rails_7.1.0_with_oracle_enhanced.gemfile => rails_7.1_with_oracle_enhanced.gemfile} (95%) rename gemfiles/{rails_7.1.0_with_postgis.gemfile => rails_7.1_with_postgis.gemfile} (95%) rename gemfiles/{rails_7.2.0_with_postgresql.gemfile => rails_7.1_with_postgresql.gemfile} (95%) rename gemfiles/{rails_7.1.0_with_sqlite3.gemfile => rails_7.1_with_sqlite3.gemfile} (95%) rename gemfiles/{rails_7.2.0_with_trilogy.gemfile => rails_7.1_with_trilogy.gemfile} (95%) rename gemfiles/{rails_7.2.0_with_mysql2.gemfile => rails_7.2_with_mysql2.gemfile} (95%) rename gemfiles/{rails_7.2.0_with_oracle_enhanced.gemfile => rails_7.2_with_oracle_enhanced.gemfile} (95%) rename gemfiles/{rails_7.2.0_with_postgis.gemfile => rails_7.2_with_postgis.gemfile} (95%) rename gemfiles/{rails_7.1.0_with_postgresql.gemfile => rails_7.2_with_postgresql.gemfile} (95%) rename gemfiles/{rails_7.2.0_with_sqlite3.gemfile => rails_7.2_with_sqlite3.gemfile} (95%) rename gemfiles/{rails_7.1.0_with_trilogy.gemfile => rails_7.2_with_trilogy.gemfile} (95%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7892ab5..f82f61e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,9 +77,9 @@ jobs: - '3.0' - 'head' rails: - - rails_7.2.0 - - rails_7.1.0 - - rails_7.0.8 + - rails_7.2 + - rails_7.1 + - rails_7.0 adapter: - sqlite3 - postgresql @@ -93,7 +93,7 @@ jobs: # - trilogy exclude: # Rails 7.2 needs Ruby > 3.1 - - rails: rails_7.2.0 + - rails: rails_7.2 ruby: '3.0' # Disabled for now because of build error: @@ -107,7 +107,7 @@ jobs: # from # /home/runner/work/ajax-datatables-rails/ajax-datatables-rails/vendor/bundle/ruby/3.0.0/gems/ruby-oci8-2.2.14/ext/oci8/apiwrap.rb:64:in # `create_apiwrap' - - rails: rails_7.2.0 + - rails: rails_7.2 adapter: oracle_enhanced steps: diff --git a/Appraisals b/Appraisals index 9560257..6eeece2 100644 --- a/Appraisals +++ b/Appraisals @@ -1,11 +1,11 @@ # frozen_string_literal: true ############### -# RAILS 7.0.8 # +# RAILS 7.0 # ############### -appraise 'rails_7.0.8_with_postgresql' do - gem 'rails', '7.0.8' +appraise 'rails_7.0_with_postgresql' do + gem 'rails', '~> 7.0.0' gem 'pg' # Fix: @@ -22,8 +22,8 @@ appraise 'rails_7.0.8_with_postgresql' do end end -appraise 'rails_7.0.8_with_sqlite3' do - gem 'rails', '7.0.8' +appraise 'rails_7.0_with_sqlite3' do + gem 'rails', '~> 7.0.0' gem 'sqlite3', '~> 1.5.0' remove_gem 'pg' @@ -41,8 +41,8 @@ appraise 'rails_7.0.8_with_sqlite3' do end end -appraise 'rails_7.0.8_with_mysql2' do - gem 'rails', '7.0.8' +appraise 'rails_7.0_with_mysql2' do + gem 'rails', '~> 7.0.0' gem 'mysql2' remove_gem 'pg' @@ -60,8 +60,8 @@ appraise 'rails_7.0.8_with_mysql2' do end end -appraise 'rails_7.0.8_with_trilogy' do - gem 'rails', '7.0.8' +appraise 'rails_7.0_with_trilogy' do + gem 'rails', '~> 7.0.0' gem 'activerecord-trilogy-adapter' remove_gem 'pg' @@ -79,8 +79,8 @@ appraise 'rails_7.0.8_with_trilogy' do end end -appraise 'rails_7.0.8_with_oracle_enhanced' do - gem 'rails', '7.0.8' +appraise 'rails_7.0_with_oracle_enhanced' do + gem 'rails', '~> 7.0.0' gem 'ruby-oci8' gem 'activerecord-oracle_enhanced-adapter', '~> 7.0.0' remove_gem 'pg' @@ -99,8 +99,8 @@ appraise 'rails_7.0.8_with_oracle_enhanced' do end end -appraise 'rails_7.0.8_with_postgis' do - gem 'rails', '7.0.8' +appraise 'rails_7.0_with_postgis' do + gem 'rails', '~> 7.0.0' gem 'pg' gem 'activerecord-postgis-adapter' @@ -122,37 +122,37 @@ end # RAILS 7.1.0 # ############### -appraise 'rails_7.1.0_with_postgresql' do - gem 'rails', '7.1.0' +appraise 'rails_7.1_with_postgresql' do + gem 'rails', '~> 7.1.0' gem 'pg' end -appraise 'rails_7.1.0_with_sqlite3' do - gem 'rails', '7.1.0' +appraise 'rails_7.1_with_sqlite3' do + gem 'rails', '~> 7.1.0' gem 'sqlite3', '~> 1.5.0' remove_gem 'pg' end -appraise 'rails_7.1.0_with_mysql2' do - gem 'rails', '7.1.0' +appraise 'rails_7.1_with_mysql2' do + gem 'rails', '~> 7.1.0' gem 'mysql2' remove_gem 'pg' end -appraise 'rails_7.1.0_with_trilogy' do - gem 'rails', '7.1.0' +appraise 'rails_7.1_with_trilogy' do + gem 'rails', '~> 7.1.0' gem 'activerecord-trilogy-adapter' remove_gem 'pg' end -appraise 'rails_7.1.0_with_oracle_enhanced' do - gem 'rails', '7.1.0' +appraise 'rails_7.1_with_oracle_enhanced' do + gem 'rails', '~> 7.1.0' gem 'activerecord-oracle_enhanced-adapter', '~> 7.1.0' remove_gem 'pg' end -appraise 'rails_7.1.0_with_postgis' do - gem 'rails', '7.1.0' +appraise 'rails_7.1_with_postgis' do + gem 'rails', '~> 7.1.0' gem 'pg' gem 'activerecord-postgis-adapter' end @@ -161,37 +161,37 @@ end # RAILS 7.2.0 # ############### -appraise 'rails_7.2.0_with_postgresql' do - gem 'rails', '7.2.0' +appraise 'rails_7.2_with_postgresql' do + gem 'rails', '~> 7.2.0' gem 'pg' end -appraise 'rails_7.2.0_with_sqlite3' do - gem 'rails', '7.2.0' +appraise 'rails_7.2_with_sqlite3' do + gem 'rails', '~> 7.2.0' gem 'sqlite3', '~> 1.5.0' remove_gem 'pg' end -appraise 'rails_7.2.0_with_mysql2' do - gem 'rails', '7.2.0' +appraise 'rails_7.2_with_mysql2' do + gem 'rails', '~> 7.2.0' gem 'mysql2' remove_gem 'pg' end -appraise 'rails_7.2.0_with_trilogy' do - gem 'rails', '7.2.0' +appraise 'rails_7.2_with_trilogy' do + gem 'rails', '~> 7.2.0' gem 'activerecord-trilogy-adapter' remove_gem 'pg' end -appraise 'rails_7.2.0_with_oracle_enhanced' do - gem 'rails', '7.2.0' +appraise 'rails_7.2_with_oracle_enhanced' do + gem 'rails', '~> 7.2.0' gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git' remove_gem 'pg' end -appraise 'rails_7.2.0_with_postgis' do - gem 'rails', '7.2.0' +appraise 'rails_7.2_with_postgis' do + gem 'rails', '~> 7.2.0' gem 'pg' gem 'activerecord-postgis-adapter', git: 'https://github.com/rgeo/activerecord-postgis-adapter.git' end diff --git a/gemfiles/rails_7.0.8_with_mysql2.gemfile b/gemfiles/rails_7.0_with_mysql2.gemfile similarity index 96% rename from gemfiles/rails_7.0.8_with_mysql2.gemfile rename to gemfiles/rails_7.0_with_mysql2.gemfile index 90d9868..d3000d8 100644 --- a/gemfiles/rails_7.0.8_with_mysql2.gemfile +++ b/gemfiles/rails_7.0_with_mysql2.gemfile @@ -20,7 +20,7 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.0.8" +gem "rails", "~> 7.0.0" gem "mysql2" install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do diff --git a/gemfiles/rails_7.0.8_with_oracle_enhanced.gemfile b/gemfiles/rails_7.0_with_oracle_enhanced.gemfile similarity index 96% rename from gemfiles/rails_7.0.8_with_oracle_enhanced.gemfile rename to gemfiles/rails_7.0_with_oracle_enhanced.gemfile index 5abe305..215fc37 100644 --- a/gemfiles/rails_7.0.8_with_oracle_enhanced.gemfile +++ b/gemfiles/rails_7.0_with_oracle_enhanced.gemfile @@ -20,7 +20,7 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.0.8" +gem "rails", "~> 7.0.0" gem "ruby-oci8" gem "activerecord-oracle_enhanced-adapter", "~> 7.0.0" diff --git a/gemfiles/rails_7.0.8_with_postgis.gemfile b/gemfiles/rails_7.0_with_postgis.gemfile similarity index 96% rename from gemfiles/rails_7.0.8_with_postgis.gemfile rename to gemfiles/rails_7.0_with_postgis.gemfile index 0f907b2..ace2ccc 100644 --- a/gemfiles/rails_7.0.8_with_postgis.gemfile +++ b/gemfiles/rails_7.0_with_postgis.gemfile @@ -21,7 +21,7 @@ gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" gem "pg" -gem "rails", "7.0.8" +gem "rails", "~> 7.0.0" gem "activerecord-postgis-adapter" install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do diff --git a/gemfiles/rails_7.0.8_with_postgresql.gemfile b/gemfiles/rails_7.0_with_postgresql.gemfile similarity index 96% rename from gemfiles/rails_7.0.8_with_postgresql.gemfile rename to gemfiles/rails_7.0_with_postgresql.gemfile index b220290..a6ec465 100644 --- a/gemfiles/rails_7.0.8_with_postgresql.gemfile +++ b/gemfiles/rails_7.0_with_postgresql.gemfile @@ -21,7 +21,7 @@ gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" gem "pg" -gem "rails", "7.0.8" +gem "rails", "~> 7.0.0" install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do gem "base64" diff --git a/gemfiles/rails_7.0.8_with_sqlite3.gemfile b/gemfiles/rails_7.0_with_sqlite3.gemfile similarity index 96% rename from gemfiles/rails_7.0.8_with_sqlite3.gemfile rename to gemfiles/rails_7.0_with_sqlite3.gemfile index 1ac98dd..fe0c4ad 100644 --- a/gemfiles/rails_7.0.8_with_sqlite3.gemfile +++ b/gemfiles/rails_7.0_with_sqlite3.gemfile @@ -20,7 +20,7 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.0.8" +gem "rails", "~> 7.0.0" gem "sqlite3", "~> 1.5.0" install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do diff --git a/gemfiles/rails_7.0.8_with_trilogy.gemfile b/gemfiles/rails_7.0_with_trilogy.gemfile similarity index 96% rename from gemfiles/rails_7.0.8_with_trilogy.gemfile rename to gemfiles/rails_7.0_with_trilogy.gemfile index eb10fc5..fb6fe0e 100644 --- a/gemfiles/rails_7.0.8_with_trilogy.gemfile +++ b/gemfiles/rails_7.0_with_trilogy.gemfile @@ -20,7 +20,7 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.0.8" +gem "rails", "~> 7.0.0" gem "activerecord-trilogy-adapter" install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do diff --git a/gemfiles/rails_7.1.0_with_mysql2.gemfile b/gemfiles/rails_7.1_with_mysql2.gemfile similarity index 95% rename from gemfiles/rails_7.1.0_with_mysql2.gemfile rename to gemfiles/rails_7.1_with_mysql2.gemfile index 00798ab..370e17e 100644 --- a/gemfiles/rails_7.1.0_with_mysql2.gemfile +++ b/gemfiles/rails_7.1_with_mysql2.gemfile @@ -20,7 +20,7 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.1.0" +gem "rails", "~> 7.1.0" gem "mysql2" gemspec path: "../" diff --git a/gemfiles/rails_7.1.0_with_oracle_enhanced.gemfile b/gemfiles/rails_7.1_with_oracle_enhanced.gemfile similarity index 95% rename from gemfiles/rails_7.1.0_with_oracle_enhanced.gemfile rename to gemfiles/rails_7.1_with_oracle_enhanced.gemfile index 2ce152c..4899d07 100644 --- a/gemfiles/rails_7.1.0_with_oracle_enhanced.gemfile +++ b/gemfiles/rails_7.1_with_oracle_enhanced.gemfile @@ -20,7 +20,7 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.1.0" +gem "rails", "~> 7.1.0" gem "activerecord-oracle_enhanced-adapter", "~> 7.1.0" gemspec path: "../" diff --git a/gemfiles/rails_7.1.0_with_postgis.gemfile b/gemfiles/rails_7.1_with_postgis.gemfile similarity index 95% rename from gemfiles/rails_7.1.0_with_postgis.gemfile rename to gemfiles/rails_7.1_with_postgis.gemfile index c7a8276..63bfc47 100644 --- a/gemfiles/rails_7.1.0_with_postgis.gemfile +++ b/gemfiles/rails_7.1_with_postgis.gemfile @@ -21,7 +21,7 @@ gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" gem "pg" -gem "rails", "7.1.0" +gem "rails", "~> 7.1.0" gem "activerecord-postgis-adapter" gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_postgresql.gemfile b/gemfiles/rails_7.1_with_postgresql.gemfile similarity index 95% rename from gemfiles/rails_7.2.0_with_postgresql.gemfile rename to gemfiles/rails_7.1_with_postgresql.gemfile index 1c9c96f..0e7c95f 100644 --- a/gemfiles/rails_7.2.0_with_postgresql.gemfile +++ b/gemfiles/rails_7.1_with_postgresql.gemfile @@ -21,6 +21,6 @@ gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" gem "pg" -gem "rails", "7.2.0" +gem "rails", "~> 7.1.0" gemspec path: "../" diff --git a/gemfiles/rails_7.1.0_with_sqlite3.gemfile b/gemfiles/rails_7.1_with_sqlite3.gemfile similarity index 95% rename from gemfiles/rails_7.1.0_with_sqlite3.gemfile rename to gemfiles/rails_7.1_with_sqlite3.gemfile index ecceebf..949d3aa 100644 --- a/gemfiles/rails_7.1.0_with_sqlite3.gemfile +++ b/gemfiles/rails_7.1_with_sqlite3.gemfile @@ -20,7 +20,7 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.1.0" +gem "rails", "~> 7.1.0" gem "sqlite3", "~> 1.5.0" gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_trilogy.gemfile b/gemfiles/rails_7.1_with_trilogy.gemfile similarity index 95% rename from gemfiles/rails_7.2.0_with_trilogy.gemfile rename to gemfiles/rails_7.1_with_trilogy.gemfile index 3a148a9..4b2832e 100644 --- a/gemfiles/rails_7.2.0_with_trilogy.gemfile +++ b/gemfiles/rails_7.1_with_trilogy.gemfile @@ -20,7 +20,7 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.2.0" +gem "rails", "~> 7.1.0" gem "activerecord-trilogy-adapter" gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_mysql2.gemfile b/gemfiles/rails_7.2_with_mysql2.gemfile similarity index 95% rename from gemfiles/rails_7.2.0_with_mysql2.gemfile rename to gemfiles/rails_7.2_with_mysql2.gemfile index 9deebff..f86bff3 100644 --- a/gemfiles/rails_7.2.0_with_mysql2.gemfile +++ b/gemfiles/rails_7.2_with_mysql2.gemfile @@ -20,7 +20,7 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.2.0" +gem "rails", "~> 7.2.0" gem "mysql2" gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_oracle_enhanced.gemfile b/gemfiles/rails_7.2_with_oracle_enhanced.gemfile similarity index 95% rename from gemfiles/rails_7.2.0_with_oracle_enhanced.gemfile rename to gemfiles/rails_7.2_with_oracle_enhanced.gemfile index ec1368b..88d00c4 100644 --- a/gemfiles/rails_7.2.0_with_oracle_enhanced.gemfile +++ b/gemfiles/rails_7.2_with_oracle_enhanced.gemfile @@ -20,7 +20,7 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.2.0" +gem "rails", "~> 7.2.0" gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git" gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_postgis.gemfile b/gemfiles/rails_7.2_with_postgis.gemfile similarity index 95% rename from gemfiles/rails_7.2.0_with_postgis.gemfile rename to gemfiles/rails_7.2_with_postgis.gemfile index 81dbb10..3868fa9 100644 --- a/gemfiles/rails_7.2.0_with_postgis.gemfile +++ b/gemfiles/rails_7.2_with_postgis.gemfile @@ -21,7 +21,7 @@ gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" gem "pg" -gem "rails", "7.2.0" +gem "rails", "~> 7.2.0" gem "activerecord-postgis-adapter", git: "https://github.com/rgeo/activerecord-postgis-adapter.git" gemspec path: "../" diff --git a/gemfiles/rails_7.1.0_with_postgresql.gemfile b/gemfiles/rails_7.2_with_postgresql.gemfile similarity index 95% rename from gemfiles/rails_7.1.0_with_postgresql.gemfile rename to gemfiles/rails_7.2_with_postgresql.gemfile index 02ad001..69e9ac7 100644 --- a/gemfiles/rails_7.1.0_with_postgresql.gemfile +++ b/gemfiles/rails_7.2_with_postgresql.gemfile @@ -21,6 +21,6 @@ gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" gem "pg" -gem "rails", "7.1.0" +gem "rails", "~> 7.2.0" gemspec path: "../" diff --git a/gemfiles/rails_7.2.0_with_sqlite3.gemfile b/gemfiles/rails_7.2_with_sqlite3.gemfile similarity index 95% rename from gemfiles/rails_7.2.0_with_sqlite3.gemfile rename to gemfiles/rails_7.2_with_sqlite3.gemfile index 3ba3ec0..4642fb5 100644 --- a/gemfiles/rails_7.2.0_with_sqlite3.gemfile +++ b/gemfiles/rails_7.2_with_sqlite3.gemfile @@ -20,7 +20,7 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.2.0" +gem "rails", "~> 7.2.0" gem "sqlite3", "~> 1.5.0" gemspec path: "../" diff --git a/gemfiles/rails_7.1.0_with_trilogy.gemfile b/gemfiles/rails_7.2_with_trilogy.gemfile similarity index 95% rename from gemfiles/rails_7.1.0_with_trilogy.gemfile rename to gemfiles/rails_7.2_with_trilogy.gemfile index 9ac220c..0e8bbcc 100644 --- a/gemfiles/rails_7.1.0_with_trilogy.gemfile +++ b/gemfiles/rails_7.2_with_trilogy.gemfile @@ -20,7 +20,7 @@ gem "rubocop-performance" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" -gem "rails", "7.1.0" +gem "rails", "~> 7.2.0" gem "activerecord-trilogy-adapter" gemspec path: "../" From 53e732598be9061eaad99ad34d089b2f215b7438 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Tue, 12 Nov 2024 00:21:15 +0100 Subject: [PATCH 44/60] Enable RSpec warnings --- .rspec | 1 + 1 file changed, 1 insertion(+) create mode 100644 .rspec diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..372b5ac --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--warnings From b94235bb9541102d4936d51061ac1bf2aa1b75a1 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sun, 15 Dec 2024 01:40:22 +0100 Subject: [PATCH 45/60] Improve Gemfile --- Gemfile | 17 +++++++++-------- Rakefile | 10 ---------- gemfiles/rails_7.0_with_mysql2.gemfile | 13 ++++++------- gemfiles/rails_7.0_with_oracle_enhanced.gemfile | 13 ++++++------- gemfiles/rails_7.0_with_postgis.gemfile | 13 ++++++------- gemfiles/rails_7.0_with_postgresql.gemfile | 13 ++++++------- gemfiles/rails_7.0_with_sqlite3.gemfile | 13 ++++++------- gemfiles/rails_7.0_with_trilogy.gemfile | 13 ++++++------- gemfiles/rails_7.1_with_mysql2.gemfile | 13 ++++++------- gemfiles/rails_7.1_with_oracle_enhanced.gemfile | 13 ++++++------- gemfiles/rails_7.1_with_postgis.gemfile | 13 ++++++------- gemfiles/rails_7.1_with_postgresql.gemfile | 13 ++++++------- gemfiles/rails_7.1_with_sqlite3.gemfile | 13 ++++++------- gemfiles/rails_7.1_with_trilogy.gemfile | 13 ++++++------- gemfiles/rails_7.2_with_mysql2.gemfile | 13 ++++++------- gemfiles/rails_7.2_with_oracle_enhanced.gemfile | 13 ++++++------- gemfiles/rails_7.2_with_postgis.gemfile | 13 ++++++------- gemfiles/rails_7.2_with_postgresql.gemfile | 13 ++++++------- gemfiles/rails_7.2_with_sqlite3.gemfile | 13 ++++++------- gemfiles/rails_7.2_with_trilogy.gemfile | 13 ++++++------- 20 files changed, 117 insertions(+), 144 deletions(-) diff --git a/Gemfile b/Gemfile index e37e11d..47a4647 100644 --- a/Gemfile +++ b/Gemfile @@ -4,25 +4,26 @@ source 'https://rubygems.org/' gemspec +# Dev libs gem 'appraisal', git: 'https://github.com/thoughtbot/appraisal.git' - gem 'combustion' gem 'database_cleaner' gem 'factory_bot' gem 'faker' gem 'generator_spec' -gem 'guard-rspec' -gem 'pry' gem 'puma' gem 'rake' gem 'rspec' gem 'rspec-retry' -gem 'rubocop' -gem 'rubocop-factory_bot' -gem 'rubocop-performance' -gem 'rubocop-rake' -gem 'rubocop-rspec' gem 'simplecov' # Fallback to pg in dev/local environment gem 'pg' + +# Dev tools / linter +gem 'guard-rspec', require: false +gem 'rubocop', require: false +gem 'rubocop-factory_bot', require: false +gem 'rubocop-performance', require: false +gem 'rubocop-rake', require: false +gem 'rubocop-rspec', require: false diff --git a/Rakefile b/Rakefile index 5de361c..ad26ae7 100644 --- a/Rakefile +++ b/Rakefile @@ -5,13 +5,3 @@ require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) task default: :spec - -desc 'Open a Ruby irb console with the gem loaded' -task :console do - require 'pry' - require 'rails' - require 'ajax-datatables-rails' - puts 'Loaded AjaxDatatablesRails' - ARGV.clear - Pry.start -end diff --git a/gemfiles/rails_7.0_with_mysql2.gemfile b/gemfiles/rails_7.0_with_mysql2.gemfile index d3000d8..792ae85 100644 --- a/gemfiles/rails_7.0_with_mysql2.gemfile +++ b/gemfiles/rails_7.0_with_mysql2.gemfile @@ -8,18 +8,17 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.0.0" gem "mysql2" diff --git a/gemfiles/rails_7.0_with_oracle_enhanced.gemfile b/gemfiles/rails_7.0_with_oracle_enhanced.gemfile index 215fc37..b5e1c60 100644 --- a/gemfiles/rails_7.0_with_oracle_enhanced.gemfile +++ b/gemfiles/rails_7.0_with_oracle_enhanced.gemfile @@ -8,18 +8,17 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.0.0" gem "ruby-oci8" gem "activerecord-oracle_enhanced-adapter", "~> 7.0.0" diff --git a/gemfiles/rails_7.0_with_postgis.gemfile b/gemfiles/rails_7.0_with_postgis.gemfile index ace2ccc..38d6553 100644 --- a/gemfiles/rails_7.0_with_postgis.gemfile +++ b/gemfiles/rails_7.0_with_postgis.gemfile @@ -8,19 +8,18 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" gem "pg" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.0.0" gem "activerecord-postgis-adapter" diff --git a/gemfiles/rails_7.0_with_postgresql.gemfile b/gemfiles/rails_7.0_with_postgresql.gemfile index a6ec465..35a89b6 100644 --- a/gemfiles/rails_7.0_with_postgresql.gemfile +++ b/gemfiles/rails_7.0_with_postgresql.gemfile @@ -8,19 +8,18 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" gem "pg" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.0.0" install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do diff --git a/gemfiles/rails_7.0_with_sqlite3.gemfile b/gemfiles/rails_7.0_with_sqlite3.gemfile index fe0c4ad..832b048 100644 --- a/gemfiles/rails_7.0_with_sqlite3.gemfile +++ b/gemfiles/rails_7.0_with_sqlite3.gemfile @@ -8,18 +8,17 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.0.0" gem "sqlite3", "~> 1.5.0" diff --git a/gemfiles/rails_7.0_with_trilogy.gemfile b/gemfiles/rails_7.0_with_trilogy.gemfile index fb6fe0e..65364f2 100644 --- a/gemfiles/rails_7.0_with_trilogy.gemfile +++ b/gemfiles/rails_7.0_with_trilogy.gemfile @@ -8,18 +8,17 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.0.0" gem "activerecord-trilogy-adapter" diff --git a/gemfiles/rails_7.1_with_mysql2.gemfile b/gemfiles/rails_7.1_with_mysql2.gemfile index 370e17e..8be9ba3 100644 --- a/gemfiles/rails_7.1_with_mysql2.gemfile +++ b/gemfiles/rails_7.1_with_mysql2.gemfile @@ -8,18 +8,17 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.1.0" gem "mysql2" diff --git a/gemfiles/rails_7.1_with_oracle_enhanced.gemfile b/gemfiles/rails_7.1_with_oracle_enhanced.gemfile index 4899d07..0141031 100644 --- a/gemfiles/rails_7.1_with_oracle_enhanced.gemfile +++ b/gemfiles/rails_7.1_with_oracle_enhanced.gemfile @@ -8,18 +8,17 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.1.0" gem "activerecord-oracle_enhanced-adapter", "~> 7.1.0" diff --git a/gemfiles/rails_7.1_with_postgis.gemfile b/gemfiles/rails_7.1_with_postgis.gemfile index 63bfc47..ffaad7d 100644 --- a/gemfiles/rails_7.1_with_postgis.gemfile +++ b/gemfiles/rails_7.1_with_postgis.gemfile @@ -8,19 +8,18 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" gem "pg" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.1.0" gem "activerecord-postgis-adapter" diff --git a/gemfiles/rails_7.1_with_postgresql.gemfile b/gemfiles/rails_7.1_with_postgresql.gemfile index 0e7c95f..042ce7a 100644 --- a/gemfiles/rails_7.1_with_postgresql.gemfile +++ b/gemfiles/rails_7.1_with_postgresql.gemfile @@ -8,19 +8,18 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" gem "pg" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.1.0" gemspec path: "../" diff --git a/gemfiles/rails_7.1_with_sqlite3.gemfile b/gemfiles/rails_7.1_with_sqlite3.gemfile index 949d3aa..d23c158 100644 --- a/gemfiles/rails_7.1_with_sqlite3.gemfile +++ b/gemfiles/rails_7.1_with_sqlite3.gemfile @@ -8,18 +8,17 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.1.0" gem "sqlite3", "~> 1.5.0" diff --git a/gemfiles/rails_7.1_with_trilogy.gemfile b/gemfiles/rails_7.1_with_trilogy.gemfile index 4b2832e..2500f36 100644 --- a/gemfiles/rails_7.1_with_trilogy.gemfile +++ b/gemfiles/rails_7.1_with_trilogy.gemfile @@ -8,18 +8,17 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.1.0" gem "activerecord-trilogy-adapter" diff --git a/gemfiles/rails_7.2_with_mysql2.gemfile b/gemfiles/rails_7.2_with_mysql2.gemfile index f86bff3..3d8cc0e 100644 --- a/gemfiles/rails_7.2_with_mysql2.gemfile +++ b/gemfiles/rails_7.2_with_mysql2.gemfile @@ -8,18 +8,17 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.2.0" gem "mysql2" diff --git a/gemfiles/rails_7.2_with_oracle_enhanced.gemfile b/gemfiles/rails_7.2_with_oracle_enhanced.gemfile index 88d00c4..17280e0 100644 --- a/gemfiles/rails_7.2_with_oracle_enhanced.gemfile +++ b/gemfiles/rails_7.2_with_oracle_enhanced.gemfile @@ -8,18 +8,17 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.2.0" gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git" diff --git a/gemfiles/rails_7.2_with_postgis.gemfile b/gemfiles/rails_7.2_with_postgis.gemfile index 3868fa9..7f0a4e1 100644 --- a/gemfiles/rails_7.2_with_postgis.gemfile +++ b/gemfiles/rails_7.2_with_postgis.gemfile @@ -8,19 +8,18 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" gem "pg" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.2.0" gem "activerecord-postgis-adapter", git: "https://github.com/rgeo/activerecord-postgis-adapter.git" diff --git a/gemfiles/rails_7.2_with_postgresql.gemfile b/gemfiles/rails_7.2_with_postgresql.gemfile index 69e9ac7..ee0c0c1 100644 --- a/gemfiles/rails_7.2_with_postgresql.gemfile +++ b/gemfiles/rails_7.2_with_postgresql.gemfile @@ -8,19 +8,18 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" gem "pg" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.2.0" gemspec path: "../" diff --git a/gemfiles/rails_7.2_with_sqlite3.gemfile b/gemfiles/rails_7.2_with_sqlite3.gemfile index 4642fb5..8ce650f 100644 --- a/gemfiles/rails_7.2_with_sqlite3.gemfile +++ b/gemfiles/rails_7.2_with_sqlite3.gemfile @@ -8,18 +8,17 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.2.0" gem "sqlite3", "~> 1.5.0" diff --git a/gemfiles/rails_7.2_with_trilogy.gemfile b/gemfiles/rails_7.2_with_trilogy.gemfile index 0e8bbcc..fcdf669 100644 --- a/gemfiles/rails_7.2_with_trilogy.gemfile +++ b/gemfiles/rails_7.2_with_trilogy.gemfile @@ -8,18 +8,17 @@ gem "database_cleaner" gem "factory_bot" gem "faker" gem "generator_spec" -gem "guard-rspec" -gem "pry" gem "puma" gem "rake" gem "rspec" gem "rspec-retry" -gem "rubocop" -gem "rubocop-factory_bot" -gem "rubocop-performance" -gem "rubocop-rake" -gem "rubocop-rspec" gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false gem "rails", "~> 7.2.0" gem "activerecord-trilogy-adapter" From cea41cfdc1b51e2a346f765fea9607f49b879b74 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sun, 15 Dec 2024 01:43:28 +0100 Subject: [PATCH 46/60] Add support for Rails 8.0 --- .github/workflows/ci.yml | 10 ++++- Appraisals | 39 +++++++++++++++++++ gemfiles/rails_8.0_with_mysql2.gemfile | 25 ++++++++++++ .../rails_8.0_with_oracle_enhanced.gemfile | 25 ++++++++++++ gemfiles/rails_8.0_with_postgis.gemfile | 26 +++++++++++++ gemfiles/rails_8.0_with_postgresql.gemfile | 25 ++++++++++++ gemfiles/rails_8.0_with_sqlite3.gemfile | 25 ++++++++++++ gemfiles/rails_8.0_with_trilogy.gemfile | 25 ++++++++++++ 8 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 gemfiles/rails_8.0_with_mysql2.gemfile create mode 100644 gemfiles/rails_8.0_with_oracle_enhanced.gemfile create mode 100644 gemfiles/rails_8.0_with_postgis.gemfile create mode 100644 gemfiles/rails_8.0_with_postgresql.gemfile create mode 100644 gemfiles/rails_8.0_with_sqlite3.gemfile create mode 100644 gemfiles/rails_8.0_with_trilogy.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f82f61e..19c0e24 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,6 +77,7 @@ jobs: - '3.0' - 'head' rails: + - rails_8.0 - rails_7.2 - rails_7.1 - rails_7.0 @@ -93,9 +94,16 @@ jobs: # - trilogy exclude: # Rails 7.2 needs Ruby > 3.1 - - rails: rails_7.2 + - rails: 'rails_7.2' + ruby: '3.0' + + # Rails 8.0 needs Ruby > 3.2 + - rails: 'rails_8.0' ruby: '3.0' + - rails: 'rails_8.0' + ruby: '3.1' + # Disabled for now because of build error: # /opt/hostedtoolcache/Ruby/3.0.7/x64/lib/ruby/3.0.0/psych.rb:457:in # `parse_stream': undefined method `parse' for # 8.0.0' + gem 'pg' +end + +appraise 'rails_8.0_with_sqlite3' do + gem 'rails', '~> 8.0.0' + gem 'sqlite3' + remove_gem 'pg' +end + +appraise 'rails_8.0_with_mysql2' do + gem 'rails', '~> 8.0.0' + gem 'mysql2' + remove_gem 'pg' +end + +appraise 'rails_8.0_with_trilogy' do + gem 'rails', '~> 8.0.0' + gem 'activerecord-trilogy-adapter' + remove_gem 'pg' +end + +appraise 'rails_8.0_with_oracle_enhanced' do + gem 'rails', '~> 8.0.0' + gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git' + remove_gem 'pg' +end + +appraise 'rails_8.0_with_postgis' do + gem 'rails', '~> 8.0.0' + gem 'pg' + gem 'activerecord-postgis-adapter', git: 'https://github.com/rgeo/activerecord-postgis-adapter.git' +end diff --git a/gemfiles/rails_8.0_with_mysql2.gemfile b/gemfiles/rails_8.0_with_mysql2.gemfile new file mode 100644 index 0000000..023c71d --- /dev/null +++ b/gemfiles/rails_8.0_with_mysql2.gemfile @@ -0,0 +1,25 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false +gem "rails", "~> 8.0.0" +gem "mysql2" + +gemspec path: "../" diff --git a/gemfiles/rails_8.0_with_oracle_enhanced.gemfile b/gemfiles/rails_8.0_with_oracle_enhanced.gemfile new file mode 100644 index 0000000..563ac16 --- /dev/null +++ b/gemfiles/rails_8.0_with_oracle_enhanced.gemfile @@ -0,0 +1,25 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false +gem "rails", "~> 8.0.0" +gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git" + +gemspec path: "../" diff --git a/gemfiles/rails_8.0_with_postgis.gemfile b/gemfiles/rails_8.0_with_postgis.gemfile new file mode 100644 index 0000000..c2498b5 --- /dev/null +++ b/gemfiles/rails_8.0_with_postgis.gemfile @@ -0,0 +1,26 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "simplecov" +gem "pg" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false +gem "rails", "~> 8.0.0" +gem "activerecord-postgis-adapter", git: "https://github.com/rgeo/activerecord-postgis-adapter.git" + +gemspec path: "../" diff --git a/gemfiles/rails_8.0_with_postgresql.gemfile b/gemfiles/rails_8.0_with_postgresql.gemfile new file mode 100644 index 0000000..164f2e0 --- /dev/null +++ b/gemfiles/rails_8.0_with_postgresql.gemfile @@ -0,0 +1,25 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "simplecov" +gem "pg" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false +gem "rails", "~> 8.0.0" + +gemspec path: "../" diff --git a/gemfiles/rails_8.0_with_sqlite3.gemfile b/gemfiles/rails_8.0_with_sqlite3.gemfile new file mode 100644 index 0000000..62bfdd8 --- /dev/null +++ b/gemfiles/rails_8.0_with_sqlite3.gemfile @@ -0,0 +1,25 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false +gem "rails", "~> 8.0.0" +gem "sqlite3" + +gemspec path: "../" diff --git a/gemfiles/rails_8.0_with_trilogy.gemfile b/gemfiles/rails_8.0_with_trilogy.gemfile new file mode 100644 index 0000000..f80123d --- /dev/null +++ b/gemfiles/rails_8.0_with_trilogy.gemfile @@ -0,0 +1,25 @@ +# This file was generated by Appraisal + +source "https://rubygems.org/" + +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" +gem "combustion" +gem "database_cleaner" +gem "factory_bot" +gem "faker" +gem "generator_spec" +gem "puma" +gem "rake" +gem "rspec" +gem "rspec-retry" +gem "simplecov" +gem "guard-rspec", require: false +gem "rubocop", require: false +gem "rubocop-factory_bot", require: false +gem "rubocop-performance", require: false +gem "rubocop-rake", require: false +gem "rubocop-rspec", require: false +gem "rails", "~> 8.0.0" +gem "activerecord-trilogy-adapter" + +gemspec path: "../" From 9d91a5c549f39d6935b30336c6a9c310ab2fd73b Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sun, 15 Dec 2024 01:58:38 +0100 Subject: [PATCH 47/60] Run Rubocop with Ruby 3.0 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19c0e24..30deca6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '3.3' + ruby-version: '3.0' - name: Bundler run: bundle install From dc123b56d8a1fc94fb78096676a2a6a92f8a5116 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sun, 15 Dec 2024 01:59:58 +0100 Subject: [PATCH 48/60] Test with Ruby 3.4 (rc1) --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30deca6..ca6d840 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,6 +71,7 @@ jobs: fail-fast: false matrix: ruby: + - '3.4' - '3.3' - '3.2' - '3.1' From 3c74e8ac22204973b82c7056a43ade3a6099e926 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sun, 15 Dec 2024 02:01:14 +0100 Subject: [PATCH 49/60] Update bundler binstubs --- bin/_guard-core | 8 +++----- bin/appraisal | 8 +++----- bin/bundle | 29 ++++++++++++----------------- bin/guard | 8 +++----- bin/rackup | 4 ++-- bin/rake | 8 +++----- bin/rspec | 8 +++----- bin/rubocop | 8 +++----- 8 files changed, 32 insertions(+), 49 deletions(-) diff --git a/bin/_guard-core b/bin/_guard-core index cd565c3..9105b28 100755 --- a/bin/_guard-core +++ b/bin/_guard-core @@ -8,14 +8,12 @@ # this file is here to facilitate running it. # -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) -bundle_binstub = File.expand_path("../bundle", __FILE__) +bundle_binstub = File.expand_path("bundle", __dir__) if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") load(bundle_binstub) else abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. diff --git a/bin/appraisal b/bin/appraisal index 0e7ba65..5038ce5 100755 --- a/bin/appraisal +++ b/bin/appraisal @@ -8,14 +8,12 @@ # this file is here to facilitate running it. # -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) -bundle_binstub = File.expand_path("../bundle", __FILE__) +bundle_binstub = File.expand_path("bundle", __dir__) if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") load(bundle_binstub) else abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. diff --git a/bin/bundle b/bin/bundle index a71368e..50da5fd 100755 --- a/bin/bundle +++ b/bin/bundle @@ -27,7 +27,7 @@ m = Module.new do bundler_version = nil update_index = nil ARGV.each_with_index do |a, i| - if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN + if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN) bundler_version = a end next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ @@ -41,13 +41,13 @@ m = Module.new do gemfile = ENV["BUNDLE_GEMFILE"] return gemfile if gemfile && !gemfile.empty? - File.expand_path("../../Gemfile", __FILE__) + File.expand_path("../Gemfile", __dir__) end def lockfile lockfile = case File.basename(gemfile) - when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) + when "gems.rb" then gemfile.sub(/\.rb$/, ".locked") else "#{gemfile}.lock" end File.expand_path(lockfile) @@ -60,24 +60,19 @@ m = Module.new do Regexp.last_match(1) end - def bundler_version - @bundler_version ||= - env_var_version || cli_arg_version || - lockfile_version - end - def bundler_requirement - return "#{Gem::Requirement.default}.a" unless bundler_version - - bundler_gem_version = Gem::Version.new(bundler_version) - - requirement = bundler_gem_version.approximate_recommendation + @bundler_requirement ||= + env_var_version || + cli_arg_version || + bundler_requirement_for(lockfile_version) + end - return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0") + def bundler_requirement_for(version) + return "#{Gem::Requirement.default}.a" unless version - requirement += ".a" if bundler_gem_version.prerelease? + bundler_gem_version = Gem::Version.new(version) - requirement + bundler_gem_version.approximate_recommendation end def load_bundler! diff --git a/bin/guard b/bin/guard index bcb966f..ff444e0 100755 --- a/bin/guard +++ b/bin/guard @@ -8,14 +8,12 @@ # this file is here to facilitate running it. # -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) -bundle_binstub = File.expand_path("../bundle", __FILE__) +bundle_binstub = File.expand_path("bundle", __dir__) if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") load(bundle_binstub) else abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. diff --git a/bin/rackup b/bin/rackup index 7023745..6408c79 100755 --- a/bin/rackup +++ b/bin/rackup @@ -13,7 +13,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) bundle_binstub = File.expand_path("bundle", __dir__) if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") load(bundle_binstub) else abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. @@ -24,4 +24,4 @@ end require "rubygems" require "bundler/setup" -load Gem.bin_path("rack", "rackup") +load Gem.bin_path("rackup", "rackup") diff --git a/bin/rake b/bin/rake index 9275675..4eb7d7b 100755 --- a/bin/rake +++ b/bin/rake @@ -8,14 +8,12 @@ # this file is here to facilitate running it. # -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) -bundle_binstub = File.expand_path("../bundle", __FILE__) +bundle_binstub = File.expand_path("bundle", __dir__) if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") load(bundle_binstub) else abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. diff --git a/bin/rspec b/bin/rspec index a6c7852..cb53ebe 100755 --- a/bin/rspec +++ b/bin/rspec @@ -8,14 +8,12 @@ # this file is here to facilitate running it. # -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) -bundle_binstub = File.expand_path("../bundle", __FILE__) +bundle_binstub = File.expand_path("bundle", __dir__) if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") load(bundle_binstub) else abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. diff --git a/bin/rubocop b/bin/rubocop index d0c4882..369a05b 100755 --- a/bin/rubocop +++ b/bin/rubocop @@ -8,14 +8,12 @@ # this file is here to facilitate running it. # -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) -bundle_binstub = File.expand_path("../bundle", __FILE__) +bundle_binstub = File.expand_path("bundle", __dir__) if File.file?(bundle_binstub) - if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") load(bundle_binstub) else abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. From 641628761b4fdb31b37723e750899abf753922f4 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Tue, 28 Jan 2025 23:36:34 +0100 Subject: [PATCH 50/60] Trigger CI jobs manually --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca6d840..f6e9901 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,8 @@ on: - '**' schedule: - cron: '0 4 1 * *' + # Run workflow manually + workflow_dispatch: jobs: rubocop: From 16aacc693b6e542b09a24fc4ca77c8b6c072fa81 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 29 Jan 2025 01:42:04 +0100 Subject: [PATCH 51/60] Update CHANGELOG --- CHANGELOG.md | 17 +++++++++++++++-- README.md | 4 ++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca0e88a..9d03e7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,28 @@ # CHANGELOG +## 1.6.0 (2025-??-??) + +* Remove dead code * Implementing `searchable: false` tests +* Improve objects shape +* Fix Rubocop offenses +* Make gem smaller +* Drop support of Rails 6.0 +* Drop support of Rails 6.1 +* Drop support of Ruby 2.7 +* Add support for Rails 7.2 +* Add support for Rails 8.0 +* Add support for Ruby 3.4 ## 1.5.0 (2024-04-08) -* Drop support of Rails 5.2 * Add support for grouped results (merge: [#419](https://github.com/jbox-web/ajax-datatables-rails/pull/419)) * Fix server-side out of order ajax responses (merge: [#418](https://github.com/jbox-web/ajax-datatables-rails/pull/418)) * Add support for postgis adapter (merge: [#417](https://github.com/jbox-web/ajax-datatables-rails/pull/417)) * Add support for trilogy adapter (merge: [#423](https://github.com/jbox-web/ajax-datatables-rails/pull/423)) +* Drop support of Rails 5.2 * Add support for Rails 7.1 +* Add support for Ruby 3.2 * Add support for Ruby 3.3 This is the last version to support Rails 6.0.x and Ruby 2.7.x. @@ -21,7 +34,7 @@ This is the last version to support Rails 6.0.x and Ruby 2.7.x. * Drop support of Ruby 2.5 * Drop support of Ruby 2.6 * Add support of Ruby 3.1 -* Add support of Rails 7 +* Add support of Rails 7.0 * Fix: prevent establishing ActiveRecord connection on startup ## 1.3.1 (2021-02-09) diff --git a/README.md b/README.md index 0cef164..85b8931 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ It's tested against : -* Rails: 7.0.4 / 7.1.0 / 7.2.0 -* Ruby: 3.0 / 3.1 / 3.2 / 3.3 +* Rails: 7.0 / 7.1 / 7.2 / 8.0 +* Ruby: 3.0 / 3.1 / 3.2 / 3.3 / 3.4 * Databases: MySQL 8 / SQLite3 / Postgresql 16 / Oracle XE 11.2 (thanks to [travis-oracle](https://github.com/cbandy/travis-oracle)) * Adapters: sqlite / mysql2 / trilogy / postgres / postgis / oracle From 6f6d2f0b46a068cfe4051c53d0b7fc688c8d715b Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 29 Jan 2025 01:46:09 +0100 Subject: [PATCH 52/60] Drop support for Rails 7.0 --- .github/workflows/ci.yml | 1 - Appraisals | 118 ------------------ CHANGELOG.md | 1 + README.md | 2 +- ajax-datatables-rails.gemspec | 2 +- gemfiles/rails_7.0_with_mysql2.gemfile | 35 ------ .../rails_7.0_with_oracle_enhanced.gemfile | 36 ------ gemfiles/rails_7.0_with_postgis.gemfile | 36 ------ gemfiles/rails_7.0_with_postgresql.gemfile | 35 ------ gemfiles/rails_7.0_with_sqlite3.gemfile | 35 ------ gemfiles/rails_7.0_with_trilogy.gemfile | 35 ------ 11 files changed, 3 insertions(+), 333 deletions(-) delete mode 100644 gemfiles/rails_7.0_with_mysql2.gemfile delete mode 100644 gemfiles/rails_7.0_with_oracle_enhanced.gemfile delete mode 100644 gemfiles/rails_7.0_with_postgis.gemfile delete mode 100644 gemfiles/rails_7.0_with_postgresql.gemfile delete mode 100644 gemfiles/rails_7.0_with_sqlite3.gemfile delete mode 100644 gemfiles/rails_7.0_with_trilogy.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6e9901..cabe982 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,6 @@ jobs: - rails_8.0 - rails_7.2 - rails_7.1 - - rails_7.0 adapter: - sqlite3 - postgresql diff --git a/Appraisals b/Appraisals index f53cd17..dc6bea8 100644 --- a/Appraisals +++ b/Appraisals @@ -1,123 +1,5 @@ # frozen_string_literal: true -############### -# RAILS 7.0 # -############### - -appraise 'rails_7.0_with_postgresql' do - gem 'rails', '~> 7.0.0' - gem 'pg' - - # Fix: - # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 - # Add logger to your Gemfile or gemspec. - install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do - gem 'base64' - gem 'bigdecimal' - gem 'benchmark' - gem 'drb' - gem 'logger' - gem 'mutex_m' - gem 'ostruct' - end -end - -appraise 'rails_7.0_with_sqlite3' do - gem 'rails', '~> 7.0.0' - gem 'sqlite3', '~> 1.5.0' - remove_gem 'pg' - - # Fix: - # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 - # Add logger to your Gemfile or gemspec. - install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do - gem 'base64' - gem 'bigdecimal' - gem 'benchmark' - gem 'drb' - gem 'logger' - gem 'mutex_m' - gem 'ostruct' - end -end - -appraise 'rails_7.0_with_mysql2' do - gem 'rails', '~> 7.0.0' - gem 'mysql2' - remove_gem 'pg' - - # Fix: - # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 - # Add logger to your Gemfile or gemspec. - install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do - gem 'base64' - gem 'bigdecimal' - gem 'benchmark' - gem 'drb' - gem 'logger' - gem 'mutex_m' - gem 'ostruct' - end -end - -appraise 'rails_7.0_with_trilogy' do - gem 'rails', '~> 7.0.0' - gem 'activerecord-trilogy-adapter' - remove_gem 'pg' - - # Fix: - # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 - # Add logger to your Gemfile or gemspec. - install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do - gem 'base64' - gem 'bigdecimal' - gem 'benchmark' - gem 'drb' - gem 'logger' - gem 'mutex_m' - gem 'ostruct' - end -end - -appraise 'rails_7.0_with_oracle_enhanced' do - gem 'rails', '~> 7.0.0' - gem 'ruby-oci8' - gem 'activerecord-oracle_enhanced-adapter', '~> 7.0.0' - remove_gem 'pg' - - # Fix: - # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 - # Add logger to your Gemfile or gemspec. - install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do - gem 'base64' - gem 'bigdecimal' - gem 'benchmark' - gem 'drb' - gem 'logger' - gem 'mutex_m' - gem 'ostruct' - end -end - -appraise 'rails_7.0_with_postgis' do - gem 'rails', '~> 7.0.0' - gem 'pg' - gem 'activerecord-postgis-adapter' - - # Fix: - # warning: logger was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0 - # Add logger to your Gemfile or gemspec. - install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do - gem 'base64' - gem 'bigdecimal' - gem 'benchmark' - gem 'drb' - gem 'logger' - gem 'mutex_m' - gem 'ostruct' - end -end - ############### # RAILS 7.1.0 # ############### diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d03e7b..7718ecc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Make gem smaller * Drop support of Rails 6.0 * Drop support of Rails 6.1 +* Drop support of Rails 7.0 * Drop support of Ruby 2.7 * Add support for Rails 7.2 * Add support for Rails 8.0 diff --git a/README.md b/README.md index 85b8931..33c67a1 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It's tested against : -* Rails: 7.0 / 7.1 / 7.2 / 8.0 +* Rails: 7.1 / 7.2 / 8.0 * Ruby: 3.0 / 3.1 / 3.2 / 3.3 / 3.4 * Databases: MySQL 8 / SQLite3 / Postgresql 16 / Oracle XE 11.2 (thanks to [travis-oracle](https://github.com/cbandy/travis-oracle)) * Adapters: sqlite / mysql2 / trilogy / postgres / postgis / oracle diff --git a/ajax-datatables-rails.gemspec b/ajax-datatables-rails.gemspec index 6bf0f39..42bf915 100644 --- a/ajax-datatables-rails.gemspec +++ b/ajax-datatables-rails.gemspec @@ -24,6 +24,6 @@ Gem::Specification.new do |s| s.files = Dir['README.md', 'CHANGELOG.md', 'LICENSE', 'lib/**/*.rb', 'lib/**/*.erb'] - s.add_dependency 'rails', '>= 7.0' + s.add_dependency 'rails', '>= 7.1' s.add_dependency 'zeitwerk' end diff --git a/gemfiles/rails_7.0_with_mysql2.gemfile b/gemfiles/rails_7.0_with_mysql2.gemfile deleted file mode 100644 index 792ae85..0000000 --- a/gemfiles/rails_7.0_with_mysql2.gemfile +++ /dev/null @@ -1,35 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org/" - -gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" -gem "combustion" -gem "database_cleaner" -gem "factory_bot" -gem "faker" -gem "generator_spec" -gem "puma" -gem "rake" -gem "rspec" -gem "rspec-retry" -gem "simplecov" -gem "guard-rspec", require: false -gem "rubocop", require: false -gem "rubocop-factory_bot", require: false -gem "rubocop-performance", require: false -gem "rubocop-rake", require: false -gem "rubocop-rspec", require: false -gem "rails", "~> 7.0.0" -gem "mysql2" - -install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do - gem "base64" - gem "bigdecimal" - gem "benchmark" - gem "drb" - gem "logger" - gem "mutex_m" - gem "ostruct" -end - -gemspec path: "../" diff --git a/gemfiles/rails_7.0_with_oracle_enhanced.gemfile b/gemfiles/rails_7.0_with_oracle_enhanced.gemfile deleted file mode 100644 index b5e1c60..0000000 --- a/gemfiles/rails_7.0_with_oracle_enhanced.gemfile +++ /dev/null @@ -1,36 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org/" - -gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" -gem "combustion" -gem "database_cleaner" -gem "factory_bot" -gem "faker" -gem "generator_spec" -gem "puma" -gem "rake" -gem "rspec" -gem "rspec-retry" -gem "simplecov" -gem "guard-rspec", require: false -gem "rubocop", require: false -gem "rubocop-factory_bot", require: false -gem "rubocop-performance", require: false -gem "rubocop-rake", require: false -gem "rubocop-rspec", require: false -gem "rails", "~> 7.0.0" -gem "ruby-oci8" -gem "activerecord-oracle_enhanced-adapter", "~> 7.0.0" - -install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do - gem "base64" - gem "bigdecimal" - gem "benchmark" - gem "drb" - gem "logger" - gem "mutex_m" - gem "ostruct" -end - -gemspec path: "../" diff --git a/gemfiles/rails_7.0_with_postgis.gemfile b/gemfiles/rails_7.0_with_postgis.gemfile deleted file mode 100644 index 38d6553..0000000 --- a/gemfiles/rails_7.0_with_postgis.gemfile +++ /dev/null @@ -1,36 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org/" - -gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" -gem "combustion" -gem "database_cleaner" -gem "factory_bot" -gem "faker" -gem "generator_spec" -gem "puma" -gem "rake" -gem "rspec" -gem "rspec-retry" -gem "simplecov" -gem "pg" -gem "guard-rspec", require: false -gem "rubocop", require: false -gem "rubocop-factory_bot", require: false -gem "rubocop-performance", require: false -gem "rubocop-rake", require: false -gem "rubocop-rspec", require: false -gem "rails", "~> 7.0.0" -gem "activerecord-postgis-adapter" - -install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do - gem "base64" - gem "bigdecimal" - gem "benchmark" - gem "drb" - gem "logger" - gem "mutex_m" - gem "ostruct" -end - -gemspec path: "../" diff --git a/gemfiles/rails_7.0_with_postgresql.gemfile b/gemfiles/rails_7.0_with_postgresql.gemfile deleted file mode 100644 index 35a89b6..0000000 --- a/gemfiles/rails_7.0_with_postgresql.gemfile +++ /dev/null @@ -1,35 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org/" - -gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" -gem "combustion" -gem "database_cleaner" -gem "factory_bot" -gem "faker" -gem "generator_spec" -gem "puma" -gem "rake" -gem "rspec" -gem "rspec-retry" -gem "simplecov" -gem "pg" -gem "guard-rspec", require: false -gem "rubocop", require: false -gem "rubocop-factory_bot", require: false -gem "rubocop-performance", require: false -gem "rubocop-rake", require: false -gem "rubocop-rspec", require: false -gem "rails", "~> 7.0.0" - -install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do - gem "base64" - gem "bigdecimal" - gem "benchmark" - gem "drb" - gem "logger" - gem "mutex_m" - gem "ostruct" -end - -gemspec path: "../" diff --git a/gemfiles/rails_7.0_with_sqlite3.gemfile b/gemfiles/rails_7.0_with_sqlite3.gemfile deleted file mode 100644 index 832b048..0000000 --- a/gemfiles/rails_7.0_with_sqlite3.gemfile +++ /dev/null @@ -1,35 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org/" - -gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" -gem "combustion" -gem "database_cleaner" -gem "factory_bot" -gem "faker" -gem "generator_spec" -gem "puma" -gem "rake" -gem "rspec" -gem "rspec-retry" -gem "simplecov" -gem "guard-rspec", require: false -gem "rubocop", require: false -gem "rubocop-factory_bot", require: false -gem "rubocop-performance", require: false -gem "rubocop-rake", require: false -gem "rubocop-rspec", require: false -gem "rails", "~> 7.0.0" -gem "sqlite3", "~> 1.5.0" - -install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do - gem "base64" - gem "bigdecimal" - gem "benchmark" - gem "drb" - gem "logger" - gem "mutex_m" - gem "ostruct" -end - -gemspec path: "../" diff --git a/gemfiles/rails_7.0_with_trilogy.gemfile b/gemfiles/rails_7.0_with_trilogy.gemfile deleted file mode 100644 index 65364f2..0000000 --- a/gemfiles/rails_7.0_with_trilogy.gemfile +++ /dev/null @@ -1,35 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org/" - -gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git" -gem "combustion" -gem "database_cleaner" -gem "factory_bot" -gem "faker" -gem "generator_spec" -gem "puma" -gem "rake" -gem "rspec" -gem "rspec-retry" -gem "simplecov" -gem "guard-rspec", require: false -gem "rubocop", require: false -gem "rubocop-factory_bot", require: false -gem "rubocop-performance", require: false -gem "rubocop-rake", require: false -gem "rubocop-rspec", require: false -gem "rails", "~> 7.0.0" -gem "activerecord-trilogy-adapter" - -install_if -> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") } do - gem "base64" - gem "bigdecimal" - gem "benchmark" - gem "drb" - gem "logger" - gem "mutex_m" - gem "ostruct" -end - -gemspec path: "../" From 3f3d2f488f7c98d8e179fa0699994977515efc8f Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 29 Jan 2025 01:50:56 +0100 Subject: [PATCH 53/60] Drop support of Ruby 3.0 --- .github/workflows/ci.yml | 14 +++----------- .rubocop.yml | 2 +- CHANGELOG.md | 1 + README.md | 2 +- ajax-datatables-rails.gemspec | 2 +- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cabe982..1b22f5e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '3.0' + ruby-version: '3.1' - name: Bundler run: bundle install @@ -77,7 +77,6 @@ jobs: - '3.3' - '3.2' - '3.1' - - '3.0' - 'head' rails: - rails_8.0 @@ -95,14 +94,7 @@ jobs: # Rails 7.2: NotImplementedError # - trilogy exclude: - # Rails 7.2 needs Ruby > 3.1 - - rails: 'rails_7.2' - ruby: '3.0' - # Rails 8.0 needs Ruby > 3.2 - - rails: 'rails_8.0' - ruby: '3.0' - - rails: 'rails_8.0' ruby: '3.1' @@ -117,8 +109,8 @@ jobs: # from # /home/runner/work/ajax-datatables-rails/ajax-datatables-rails/vendor/bundle/ruby/3.0.0/gems/ruby-oci8-2.2.14/ext/oci8/apiwrap.rb:64:in # `create_apiwrap' - - rails: rails_7.2 - adapter: oracle_enhanced + - rails: 'rails_7.2' + adapter: 'oracle_enhanced' steps: - name: Checkout diff --git a/.rubocop.yml b/.rubocop.yml index 912f20f..3f8009a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -7,7 +7,7 @@ require: AllCops: NewCops: enable - TargetRubyVersion: 3.0 + TargetRubyVersion: 3.1 Exclude: - bin/* - gemfiles/* diff --git a/CHANGELOG.md b/CHANGELOG.md index 7718ecc..1040792 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * Drop support of Rails 6.1 * Drop support of Rails 7.0 * Drop support of Ruby 2.7 +* Drop support of Ruby 3.0 * Add support for Rails 7.2 * Add support for Rails 8.0 * Add support for Ruby 3.4 diff --git a/README.md b/README.md index 33c67a1..62fd2b2 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ It's tested against : * Rails: 7.1 / 7.2 / 8.0 -* Ruby: 3.0 / 3.1 / 3.2 / 3.3 / 3.4 +* Ruby: 3.1 / 3.2 / 3.3 / 3.4 * Databases: MySQL 8 / SQLite3 / Postgresql 16 / Oracle XE 11.2 (thanks to [travis-oracle](https://github.com/cbandy/travis-oracle)) * Adapters: sqlite / mysql2 / trilogy / postgres / postgis / oracle diff --git a/ajax-datatables-rails.gemspec b/ajax-datatables-rails.gemspec index 42bf915..69e22ea 100644 --- a/ajax-datatables-rails.gemspec +++ b/ajax-datatables-rails.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| 'rubygems_mfa_required' => 'true', } - s.required_ruby_version = '>= 3.0.0' + s.required_ruby_version = '>= 3.1.0' s.files = Dir['README.md', 'CHANGELOG.md', 'LICENSE', 'lib/**/*.rb', 'lib/**/*.erb'] From dd2dad5426f93cdda51017f4fc880d0181df5cbe Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 29 Jan 2025 01:51:16 +0100 Subject: [PATCH 54/60] Fix Rubocop offenses --- spec/spec_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index eb3641d..86ed53d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -73,11 +73,11 @@ def self.oracle? end def self.mysql? - ENV['DB_ADAPTER'] == 'mysql2' || ENV['DB_ADAPTER'] == 'trilogy' + %w[mysql2 trilogy].include?(ENV.fetch('https://github.com/DB_ADAPTER', nil)) end def self.postgresql? - ENV['DB_ADAPTER'] == 'postgresql' || ENV['DB_ADAPTER'] == 'postgis' + %w[postgresql postgis].include?(ENV.fetch('https://github.com/DB_ADAPTER', nil)) end end From cce00219bf6bbcc00e2c48d8fd4723ec266f9324 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 2 Jul 2025 00:51:38 +0200 Subject: [PATCH 55/60] Switch to qlty --- .github/workflows/ci.yml | 11 +++++++---- .qlty/qlty.toml | 35 +++++++++++++++++++++++++++++++++++ spec/spec_helper.rb | 2 ++ 3 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 .qlty/qlty.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b22f5e..6ce48f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -142,10 +142,13 @@ jobs: env: DB_ADAPTER: ${{ matrix.adapter }} - - name: RSpec & publish code coverage - uses: paambaati/codeclimate-action@v9.0.0 + - name: Run RSpec env: DB_ADAPTER: ${{ matrix.adapter }} - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + run: bin/rspec + + - name: Publish code coverage + uses: qltysh/qlty-action/coverage@v1 with: - coverageCommand: bin/rspec + token: ${{ secrets.QLTY_COVERAGE_TOKEN }} + files: coverage/coverage.json diff --git a/.qlty/qlty.toml b/.qlty/qlty.toml new file mode 100644 index 0000000..75811a4 --- /dev/null +++ b/.qlty/qlty.toml @@ -0,0 +1,35 @@ +config_version = "0" + +[[source]] +name = "default" +default = true + +[[plugin]] +name = "actionlint" + +[[plugin]] +name = "checkov" +version = "3.2.49" + +[[plugin]] +name = "markdownlint" +version = "0.31.1" + +[[plugin]] +name = "osv-scanner" + +[[plugin]] +name = "prettier" +version = "2.8.4" + +[[plugin]] +name = "ripgrep" + +[[plugin]] +name = "trivy" + +[[plugin]] +name = "trufflehog" + +[[plugin]] +name = "yamllint" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 86ed53d..822b8c5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,6 +6,7 @@ Combustion.initialize! :active_record, :action_controller require 'simplecov' +require 'simplecov_json_formatter' require 'rspec' require 'rspec/retry' require 'database_cleaner' @@ -15,6 +16,7 @@ # Start Simplecov SimpleCov.start do + formatter SimpleCov::Formatter::JSONFormatter add_filter 'spec/' end From 8e60fbf88a43b54ef6bfbb8210587915768b8ad7 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 2 Jul 2025 05:26:33 +0200 Subject: [PATCH 56/60] Fix postgis CI --- Appraisals | 6 +++--- gemfiles/rails_7.1_with_postgis.gemfile | 2 +- gemfiles/rails_7.2_with_postgis.gemfile | 2 +- gemfiles/rails_8.0_with_postgis.gemfile | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Appraisals b/Appraisals index dc6bea8..51c1c70 100644 --- a/Appraisals +++ b/Appraisals @@ -36,7 +36,7 @@ end appraise 'rails_7.1_with_postgis' do gem 'rails', '~> 7.1.0' gem 'pg' - gem 'activerecord-postgis-adapter' + gem 'activerecord-postgis-adapter', '~> 9.0.0' end ############### @@ -75,7 +75,7 @@ end appraise 'rails_7.2_with_postgis' do gem 'rails', '~> 7.2.0' gem 'pg' - gem 'activerecord-postgis-adapter', git: 'https://github.com/rgeo/activerecord-postgis-adapter.git' + gem 'activerecord-postgis-adapter', '~> 10.0.0' end ############### @@ -114,5 +114,5 @@ end appraise 'rails_8.0_with_postgis' do gem 'rails', '~> 8.0.0' gem 'pg' - gem 'activerecord-postgis-adapter', git: 'https://github.com/rgeo/activerecord-postgis-adapter.git' + gem 'activerecord-postgis-adapter', '~> 11.0.0' end diff --git a/gemfiles/rails_7.1_with_postgis.gemfile b/gemfiles/rails_7.1_with_postgis.gemfile index ffaad7d..189ab40 100644 --- a/gemfiles/rails_7.1_with_postgis.gemfile +++ b/gemfiles/rails_7.1_with_postgis.gemfile @@ -21,6 +21,6 @@ gem "rubocop-performance", require: false gem "rubocop-rake", require: false gem "rubocop-rspec", require: false gem "rails", "~> 7.1.0" -gem "activerecord-postgis-adapter" +gem "activerecord-postgis-adapter", "~> 9.0.0" gemspec path: "../" diff --git a/gemfiles/rails_7.2_with_postgis.gemfile b/gemfiles/rails_7.2_with_postgis.gemfile index 7f0a4e1..7ce4286 100644 --- a/gemfiles/rails_7.2_with_postgis.gemfile +++ b/gemfiles/rails_7.2_with_postgis.gemfile @@ -21,6 +21,6 @@ gem "rubocop-performance", require: false gem "rubocop-rake", require: false gem "rubocop-rspec", require: false gem "rails", "~> 7.2.0" -gem "activerecord-postgis-adapter", git: "https://github.com/rgeo/activerecord-postgis-adapter.git" +gem "activerecord-postgis-adapter", "~> 10.0.0" gemspec path: "../" diff --git a/gemfiles/rails_8.0_with_postgis.gemfile b/gemfiles/rails_8.0_with_postgis.gemfile index c2498b5..3af883b 100644 --- a/gemfiles/rails_8.0_with_postgis.gemfile +++ b/gemfiles/rails_8.0_with_postgis.gemfile @@ -21,6 +21,6 @@ gem "rubocop-performance", require: false gem "rubocop-rake", require: false gem "rubocop-rspec", require: false gem "rails", "~> 8.0.0" -gem "activerecord-postgis-adapter", git: "https://github.com/rgeo/activerecord-postgis-adapter.git" +gem "activerecord-postgis-adapter", "~> 11.0.0" gemspec path: "../" From 2e6315a9a716ba0efd7bd87b549f41065407c5f7 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Wed, 2 Jul 2025 05:26:52 +0200 Subject: [PATCH 57/60] Disable oracle CI for now --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ce48f8..5705459 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,7 +86,7 @@ jobs: - sqlite3 - postgresql - mysql2 - - oracle_enhanced + # - oracle_enhanced - postgis # Disabled for now: # Rails 7.0: trilogy_auth_recv: caching_sha2_password requires either TCP with TLS or a unix socket: TRILOGY_UNSUPPORTED From 169fd461d5ad608a95dbb917a8b18e5da0dbf5e0 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Tue, 8 Jul 2025 01:15:14 +0200 Subject: [PATCH 58/60] Update Oracle CI --- .github/workflows/ci.yml | 26 ----- .github/workflows/ci_oracle.yml | 104 ++++++++++++++++++ Appraisals | 4 +- ci/network/admin/tnsnames.ora | 15 +++ ci/setup_accounts.sh | 8 ++ .../rails_7.2_with_oracle_enhanced.gemfile | 2 +- .../rails_8.0_with_oracle_enhanced.gemfile | 2 +- .../orm/active_record_filter_records_spec.rb | 2 +- spec/dummy/config/database.yml | 8 +- spec/install_oracle.sh | 18 --- spec/support/create_oracle_enhanced_users.sql | 7 ++ 11 files changed, 143 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/ci_oracle.yml create mode 100644 ci/network/admin/tnsnames.ora create mode 100755 ci/setup_accounts.sh delete mode 100755 spec/install_oracle.sh create mode 100644 spec/support/create_oracle_enhanced_users.sql diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5705459..9d1a58d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,10 +37,6 @@ jobs: env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails }}_with_${{ matrix.adapter }}.gemfile - ORACLE_COOKIE: sqldev - ORACLE_FILE: oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip - ORACLE_HOME: /u01/app/oracle/product/11.2.0/xe - ORACLE_SID: XE services: postgres: @@ -86,7 +82,6 @@ jobs: - sqlite3 - postgresql - mysql2 - # - oracle_enhanced - postgis # Disabled for now: # Rails 7.0: trilogy_auth_recv: caching_sha2_password requires either TCP with TLS or a unix socket: TRILOGY_UNSUPPORTED @@ -98,20 +93,6 @@ jobs: - rails: 'rails_8.0' ruby: '3.1' - # Disabled for now because of build error: - # /opt/hostedtoolcache/Ruby/3.0.7/x64/lib/ruby/3.0.0/psych.rb:457:in - # `parse_stream': undefined method `parse' for #>, - # @external_encoding=0> (NoMethodError) - # from - # /home/runner/work/ajax-datatables-rails/ajax-datatables-rails/vendor/bundle/ruby/3.0.0/gems/ruby-oci8-2.2.14/ext/oci8/apiwrap.rb:64:in - # `create_apiwrap' - - rails: 'rails_7.2' - adapter: 'oracle_enhanced' - steps: - name: Checkout uses: actions/checkout@v4 @@ -119,7 +100,6 @@ jobs: - name: Set DB Adapter env: DB_ADAPTER: ${{ matrix.adapter }} - CUSTOM_ORACLE_FILE: ${{ secrets.CUSTOM_ORACLE_FILE }} # See: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#mysql run: | @@ -128,12 +108,6 @@ jobs: mysql -u root -proot -e 'create database ajax_datatables_rails;' fi - if [[ "${DB_ADAPTER}" == "oracle_enhanced" ]]; then - ./spec/install_oracle.sh - # Fix error : libnnz11.so: cannot open shared object file: No such file or directory - sudo ln -s ${ORACLE_HOME}/lib/libnnz11.so /usr/lib/libnnz11.so - fi - - name: Setup Ruby uses: ruby/setup-ruby@v1 with: diff --git a/.github/workflows/ci_oracle.yml b/.github/workflows/ci_oracle.yml new file mode 100644 index 0000000..7df46eb --- /dev/null +++ b/.github/workflows/ci_oracle.yml @@ -0,0 +1,104 @@ +--- +name: CI Oracle + +on: + push: + branches: + - '**' + pull_request: + branches: + - '**' + schedule: + - cron: '0 4 1 * *' + # Run workflow manually + workflow_dispatch: + +jobs: + rspec: + runs-on: ubuntu-latest + + env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails }}_with_${{ matrix.adapter }}.gemfile + ORACLE_HOME: /opt/oracle/instantclient_23_8 + LD_LIBRARY_PATH: /opt/oracle/instantclient_23_8 + TNS_ADMIN: ./ci/network/admin + DATABASE_SYS_PASSWORD: Oracle18 + DATABASE_NAME: FREEPDB1 + + services: + oracle: + image: gvenzl/oracle-free:latest + ports: + - 1521:1521 + env: + TZ: Europe/Paris + ORACLE_PASSWORD: Oracle18 + options: >- + --health-cmd healthcheck.sh + --health-interval 10s + --health-timeout 5s + --health-retries 10 + + strategy: + fail-fast: false + matrix: + ruby: + - '3.4' + - '3.3' + - '3.2' + - '3.1' + - 'head' + rails: + - rails_8.0 + - rails_7.2 + - rails_7.1 + adapter: + - oracle_enhanced + exclude: + - rails: 'rails_8.0' + ruby: '3.1' + adapter: 'oracle_enhanced' + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Create symbolic link for libaio library compatibility + run: | + sudo ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1 + + - name: Download Oracle instant client + run: | + wget -q https://download.oracle.com/otn_software/linux/instantclient/2380000/instantclient-basic-linux.x64-23.8.0.25.04.zip + wget -q https://download.oracle.com/otn_software/linux/instantclient/2380000/instantclient-sdk-linux.x64-23.8.0.25.04.zip + wget -q https://download.oracle.com/otn_software/linux/instantclient/2380000/instantclient-sqlplus-linux.x64-23.8.0.25.04.zip + + - name: Install Oracle instant client + run: | + sudo unzip instantclient-basic-linux.x64-23.8.0.25.04.zip -d /opt/oracle/ + sudo unzip -o instantclient-sdk-linux.x64-23.8.0.25.04.zip -d /opt/oracle/ + sudo unzip -o instantclient-sqlplus-linux.x64-23.8.0.25.04.zip -d /opt/oracle/ + echo "/opt/oracle/instantclient_23_8" >> $GITHUB_PATH + + - name: Create database user + run: | + ./ci/setup_accounts.sh + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + env: + DB_ADAPTER: ${{ matrix.adapter }} + + - name: Run RSpec + env: + DB_ADAPTER: ${{ matrix.adapter }} + run: bin/rspec + + - name: Publish code coverage + uses: qltysh/qlty-action/coverage@v1 + with: + token: ${{ secrets.QLTY_COVERAGE_TOKEN }} + files: coverage/coverage.json diff --git a/Appraisals b/Appraisals index 51c1c70..d39912b 100644 --- a/Appraisals +++ b/Appraisals @@ -68,7 +68,7 @@ end appraise 'rails_7.2_with_oracle_enhanced' do gem 'rails', '~> 7.2.0' - gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git' + gem 'activerecord-oracle_enhanced-adapter', '~> 7.2.0' remove_gem 'pg' end @@ -107,7 +107,7 @@ end appraise 'rails_8.0_with_oracle_enhanced' do gem 'rails', '~> 8.0.0' - gem 'activerecord-oracle_enhanced-adapter', git: 'https://github.com/rsim/oracle-enhanced.git' + gem 'activerecord-oracle_enhanced-adapter', '~> 8.0.0' remove_gem 'pg' end diff --git a/ci/network/admin/tnsnames.ora b/ci/network/admin/tnsnames.ora new file mode 100644 index 0000000..d1ba818 --- /dev/null +++ b/ci/network/admin/tnsnames.ora @@ -0,0 +1,15 @@ +FREEPDB1 = + (DESCRIPTION = + (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) + (CONNECT_DATA = + (SERVICE_NAME = FREEPDB1) + ) + ) + +XE = + (DESCRIPTION = + (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) + (CONNECT_DATA = + (SERVICE_NAME = XE) + ) + ) diff --git a/ci/setup_accounts.sh b/ci/setup_accounts.sh new file mode 100755 index 0000000..3ed4d2f --- /dev/null +++ b/ci/setup_accounts.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -ev + +sqlplus sys/${DATABASE_SYS_PASSWORD}@${DATABASE_NAME} as sysdba< 7.2.0" -gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git" +gem "activerecord-oracle_enhanced-adapter", "~> 7.2.0" gemspec path: "../" diff --git a/gemfiles/rails_8.0_with_oracle_enhanced.gemfile b/gemfiles/rails_8.0_with_oracle_enhanced.gemfile index 563ac16..a18d301 100644 --- a/gemfiles/rails_8.0_with_oracle_enhanced.gemfile +++ b/gemfiles/rails_8.0_with_oracle_enhanced.gemfile @@ -20,6 +20,6 @@ gem "rubocop-performance", require: false gem "rubocop-rake", require: false gem "rubocop-rspec", require: false gem "rails", "~> 8.0.0" -gem "activerecord-oracle_enhanced-adapter", git: "https://github.com/rsim/oracle-enhanced.git" +gem "activerecord-oracle_enhanced-adapter", "~> 8.0.0" gemspec path: "../" diff --git a/spec/ajax_datatables_rails/orm/active_record_filter_records_spec.rb b/spec/ajax_datatables_rails/orm/active_record_filter_records_spec.rb index 2d6a4bb..4bcbd54 100644 --- a/spec/ajax_datatables_rails/orm/active_record_filter_records_spec.rb +++ b/spec/ajax_datatables_rails/orm/active_record_filter_records_spec.rb @@ -198,7 +198,7 @@ result = datatable.build_conditions_for_selected_columns expect(result).to respond_to(:to_sql) expect(result.to_sql).to eq( - "CAST(\"USERS\".\"USERNAME\" AS VARCHAR2(4000)) LIKE '%doe%' AND CAST(\"USERS\".\"EMAIL\" AS VARCHAR2(4000)) LIKE '%example%'" + "UPPER(CAST(\"USERS\".\"USERNAME\" AS VARCHAR2(4000))) LIKE UPPER('%doe%') AND UPPER(CAST(\"USERS\".\"EMAIL\" AS VARCHAR2(4000))) LIKE UPPER('%example%')" # rubocop:disable Layout/LineLength ) end end diff --git a/spec/dummy/config/database.yml b/spec/dummy/config/database.yml index 7f6a675..a9de41f 100644 --- a/spec/dummy/config/database.yml +++ b/spec/dummy/config/database.yml @@ -15,10 +15,10 @@ test: username: 'root' password: 'root' <% elsif adapter == 'oracle_enhanced' %> - host: '127.0.0.1/xe' - username: <%= ENV.fetch('https://github.com/USER') %> - password: <%= ENV.fetch('https://github.com/USER') %> - database: 'xe' + host: '127.0.0.1' + username: 'oracle_enhanced' + password: 'oracle_enhanced' + database: 'FREEPDB1' <% elsif adapter == 'sqlite3' %> # database: ':memory:' database: db/ajax_datatables_rails.sqlite3 diff --git a/spec/install_oracle.sh b/spec/install_oracle.sh deleted file mode 100755 index 07537f7..0000000 --- a/spec/install_oracle.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -wget 'https://github.com/cbandy/travis-oracle/archive/v2.0.3.tar.gz' -mkdir -p ~/.travis/oracle -tar xz --strip-components 1 -C ~/.travis/oracle -f v2.0.3.tar.gz - -if [ -n ${CUSTOM_ORACLE_FILE} ]; then - wget -q ${CUSTOM_ORACLE_FILE} -O ~/.travis/oracle/oracle-xe-11.2.0-1.0.x86_64.rpm.zip -else - ~/.travis/oracle/download.sh -fi - -~/.travis/oracle/install.sh - -# in dev env: sqlplus system/password@localhost/XE -"${ORACLE_HOME}/bin/sqlplus" -L -S / AS SYSDBA < Date: Sun, 24 Aug 2025 00:34:48 +0200 Subject: [PATCH 59/60] Fix rubocop warnings --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 3f8009a..6307481 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,5 @@ --- -require: +plugins: - rubocop-factory_bot - rubocop-performance - rubocop-rake From fdd7d0660269910b7aa656bdc0e16462e7bae1fb Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sun, 24 Aug 2025 00:38:44 +0200 Subject: [PATCH 60/60] Use SimpleCov::Formatter::MultiFormatter --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 822b8c5..c7bfe75 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -16,7 +16,7 @@ # Start Simplecov SimpleCov.start do - formatter SimpleCov::Formatter::JSONFormatter + formatter SimpleCov::Formatter::MultiFormatter.new([SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::JSONFormatter]) add_filter 'spec/' end