From 8218d2e18c634fe1b0ffbda8a4e32e6b7d1c8cf1 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 7 Jan 2026 15:00:36 +0100 Subject: [PATCH] Drop EOL dependencies --- .github/workflows/ruby.yml | 22 ++-------------- .rubocop.yml | 4 +-- Appraisals | 15 ----------- CHANGELOG.md | 7 ++--- README.md | 6 ++--- client_side_validations.gemspec | 8 +++--- dist/client-side-validations.esm.js | 2 +- dist/client-side-validations.js | 2 +- gemfiles/rails_6.1.gemfile | 26 ------------------- gemfiles/rails_7.0.gemfile | 25 ------------------ gemfiles/rails_7.1.gemfile | 25 ------------------ .../action_view/form_helper.rb | 11 +++----- package.json | 4 +-- .../cases/test_form_with_helpers.rb | 22 +++++++--------- .../cases/test_legacy_form_with_helpers.rb | 20 +++++++------- test/javascript/server.rb | 2 +- .../assets/javascripts/rails.validations.js | 2 +- 17 files changed, 43 insertions(+), 160 deletions(-) delete mode 100644 gemfiles/rails_6.1.gemfile delete mode 100644 gemfiles/rails_7.0.gemfile delete mode 100644 gemfiles/rails_7.1.gemfile diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 12aff53a..b2c1c642 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -15,8 +15,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['3.1', '3.2', '3.3', '3.4', '4.0'] - gemfile: [rails_6.1, rails_7.0, rails_7.1, rails_7.2, rails_8.0, rails_8.1] + ruby-version: ['3.2', '3.3', '3.4', '4.0'] + gemfile: [rails_7.2, rails_8.0, rails_8.1] channel: ['stable'] include: @@ -40,24 +40,6 @@ jobs: channel: 'experimental' exclude: - - ruby-version: '3.1' - gemfile: rails_8.0 - - ruby-version: '3.1' - gemfile: rails_8.1 - - ruby-version: '3.2' - gemfile: rails_6.1 - - ruby-version: '3.3' - gemfile: rails_6.1 - - ruby-version: '3.4' - gemfile: rails_6.1 - - ruby-version: '3.4' - gemfile: rails_7.0 - - ruby-version: '4.0' - gemfile: rails_6.1 - - ruby-version: '4.0' - gemfile: rails_7.0 - - ruby-version: '4.0' - gemfile: rails_7.1 - ruby-version: '4.0' gemfile: rails_7.2 diff --git a/.rubocop.yml b/.rubocop.yml index 9c749412..fe4ab0fa 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,8 +6,8 @@ plugins: - rubocop-rake AllCops: - TargetRailsVersion: 6.1 - TargetRubyVersion: 3.1 + TargetRailsVersion: 7.2 + TargetRubyVersion: 3.2 NewCops: enable DisplayStyleGuide: true ExtraDetails: true diff --git a/Appraisals b/Appraisals index e100912a..803463f8 100644 --- a/Appraisals +++ b/Appraisals @@ -1,20 +1,5 @@ # frozen_string_literal: true -appraise 'rails-6.1' do - gem 'rails', '~> 6.1.0' - gem 'sqlite3', '~> 1.7' - gem 'concurrent-ruby', '< 1.3.5' # Ref: rails/rails#54260 -end - -appraise 'rails-7.0' do - gem 'rails', '~> 7.0.0' - gem 'sqlite3', '~> 1.7' -end - -appraise 'rails-7.1' do - gem 'rails', '~> 7.1.0' -end - appraise 'rails-7.2' do gem 'rails', '~> 7.2.0' end diff --git a/CHANGELOG.md b/CHANGELOG.md index 7784b964..48064c71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,11 +8,12 @@ - `data-validate` => `data-csv-validate` * [FEATURE] Use data attributes instead of `jQuery.data()` * [FEATURE] Drop Internet Explorer and other older browsers support -* [FEATURE] Drop Ruby < 3.1 +* [FEATURE] Drop Ruby < 3.2 +* [FEATURE] Drop Rails < 7.2 * [FEATURE] Drop jQuery < 3.7.1 Compatibility * [BUGFIX] Allow `proc` values in length validator options -* [ENHANCEMENT] Update QUnit to 2.24.3 -* [ENHANCEMENT] Test against Ruby 3.4 +* [ENHANCEMENT] Update QUnit to 2.25.0 +* [ENHANCEMENT] Test against Ruby 3.4 and 4.0 ## 22.3.1 / 2025-01-29 diff --git a/README.md b/README.md index 3f2c1780..fea72b22 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Coverage Status](https://coveralls.io/repos/github/DavyJonesLocker/client_side_validations/badge.svg?branch=main)](https://coveralls.io/github/DavyJonesLocker/client_side_validations?branch=main) -`ClientSideValidations` made easy for your Rails 6.1, 7.x, and 8.0 applications! +`ClientSideValidations` made easy for your Rails 7.2 and 8.x applications! ## Project Goals ## @@ -56,7 +56,7 @@ config/initializers/client_side_validations.rb Instructions depend on your technology stack. -Please note that CSV depends on jQuery >= 1.12.4 (jQuery slim is fine). +Please note that CSV depends on jQuery >= 3.7.1 (jQuery slim is fine). #### When using Webpacker #### @@ -99,7 +99,7 @@ Make sure that `jquery-rails` is part of your bundled gems and `application.js`, otherwise add: ```ruby -gem 'jquery-rails', '~> 4.3' +gem 'jquery-rails' ``` to your `Gemfile`, run `bundle`, and add diff --git a/client_side_validations.gemspec b/client_side_validations.gemspec index 7f71cfc5..bde6608c 100644 --- a/client_side_validations.gemspec +++ b/client_side_validations.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |spec| spec.email = ['tagliala.dev@gmail.com', 'bcardarella@gmail.com'] spec.summary = 'Client Side Validations' - spec.description = 'Client Side Validations made easy for your Rails 6.1, 7.x, and 8.0 applications' + spec.description = 'Client Side Validations made easy for your Rails 7.2 and 8.x applications' spec.homepage = 'https://github.com/DavyJonesLocker/client_side_validations' spec.license = 'MIT' @@ -25,8 +25,8 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] spec.platform = Gem::Platform::RUBY - spec.required_ruby_version = '>= 3.1' + spec.required_ruby_version = '>= 3.2' - spec.add_dependency 'js_regex', '~> 3.7' - spec.add_dependency 'rails', '>= 6.1' + spec.add_dependency 'js_regex', '>= 3.14' + spec.add_dependency 'rails', '>= 7.2' end diff --git a/dist/client-side-validations.esm.js b/dist/client-side-validations.esm.js index 701ac6e0..309453e9 100644 --- a/dist/client-side-validations.esm.js +++ b/dist/client-side-validations.esm.js @@ -1,6 +1,6 @@ /*! * Client Side Validations JS - v0.5.0 (https://github.com/DavyJonesLocker/client_side_validations) - * Copyright (c) 2025 Geremia Taglialatela, Brian Cardarella + * Copyright (c) 2026 Geremia Taglialatela, Brian Cardarella * Licensed under MIT (https://opensource.org/licenses/mit-license.php) */ diff --git a/dist/client-side-validations.js b/dist/client-side-validations.js index 92362d87..aa185c7c 100644 --- a/dist/client-side-validations.js +++ b/dist/client-side-validations.js @@ -1,6 +1,6 @@ /*! * Client Side Validations JS - v0.5.0 (https://github.com/DavyJonesLocker/client_side_validations) - * Copyright (c) 2025 Geremia Taglialatela, Brian Cardarella + * Copyright (c) 2026 Geremia Taglialatela, Brian Cardarella * Licensed under MIT (https://opensource.org/licenses/mit-license.php) */ diff --git a/gemfiles/rails_6.1.gemfile b/gemfiles/rails_6.1.gemfile deleted file mode 100644 index 7e801de6..00000000 --- a/gemfiles/rails_6.1.gemfile +++ /dev/null @@ -1,26 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "appraisal" -gem "byebug" -gem "m" -gem "minitest", "~> 5.27" -gem "mocha" -gem "rake" -gem "rubocop" -gem "rubocop-minitest" -gem "rubocop-packaging" -gem "rubocop-performance" -gem "rubocop-rails" -gem "rubocop-rake" -gem "shotgun" -gem "simplecov" -gem "simplecov-lcov" -gem "sinatra" -gem "sqlite3", "~> 1.7" -gem "webrick" -gem "rails", "~> 6.1.0" -gem "concurrent-ruby", "< 1.3.5" - -gemspec path: "../" diff --git a/gemfiles/rails_7.0.gemfile b/gemfiles/rails_7.0.gemfile deleted file mode 100644 index 553156aa..00000000 --- a/gemfiles/rails_7.0.gemfile +++ /dev/null @@ -1,25 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "appraisal" -gem "byebug" -gem "m" -gem "minitest", "~> 5.27" -gem "mocha" -gem "rake" -gem "rubocop" -gem "rubocop-minitest" -gem "rubocop-packaging" -gem "rubocop-performance" -gem "rubocop-rails" -gem "rubocop-rake" -gem "shotgun" -gem "simplecov" -gem "simplecov-lcov" -gem "sinatra" -gem "sqlite3", "~> 1.7" -gem "webrick" -gem "rails", "~> 7.0.0" - -gemspec path: "../" diff --git a/gemfiles/rails_7.1.gemfile b/gemfiles/rails_7.1.gemfile deleted file mode 100644 index 29a6a9cc..00000000 --- a/gemfiles/rails_7.1.gemfile +++ /dev/null @@ -1,25 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "appraisal" -gem "byebug" -gem "m" -gem "minitest", "~> 5.27" -gem "mocha" -gem "rake" -gem "rubocop" -gem "rubocop-minitest" -gem "rubocop-packaging" -gem "rubocop-performance" -gem "rubocop-rails" -gem "rubocop-rake" -gem "shotgun" -gem "simplecov" -gem "simplecov-lcov" -gem "sinatra" -gem "sqlite3" -gem "webrick" -gem "rails", "~> 7.1.0" - -gemspec path: "../" diff --git a/lib/client_side_validations/action_view/form_helper.rb b/lib/client_side_validations/action_view/form_helper.rb index 9c79f567..c26e970d 100644 --- a/lib/client_side_validations/action_view/form_helper.rb +++ b/lib/client_side_validations/action_view/form_helper.rb @@ -36,16 +36,11 @@ def form_for(record, options = {}, &block) form_with(**options, &block) end - def apply_csv_form_for_options!(record, object, options) + def apply_csv_form_for_options!(object, options) options[:html][:validate] = true if options[:validate] options[:html][:method] ||= options[:method] - # TODO: remove else branch when minimum compatible version when dropping 6.1 support - if method(:apply_form_for_options!).arity == 2 - apply_form_for_options! object, options - else - apply_form_for_options! record, object, options - end + apply_form_for_options! object, options end def fields_for(record_name, record_object = nil, options = {}, &) @@ -69,7 +64,7 @@ def check_record(record, options) raise ArgumentError, 'First argument in form cannot contain nil or be empty' unless object object_name = options[:as] || model_name_from_record_or_class(object).param_key - apply_csv_form_for_options!(record, object, options) + apply_csv_form_for_options!(object, options) end [record, object_name] diff --git a/package.json b/package.json index c3018d85..a96ef407 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@client-side-validations/client-side-validations", - "description": "Client Side Validations made easy for your Rails 6.1, 7.x, and 8.0 applications", + "description": "Client Side Validations made easy for your Rails 7.2 and 8.x applications", "repository": { "type": "git", "url": "git+https://github.com/DavyJonesLocker/client_side_validations.git" @@ -31,7 +31,7 @@ "eslint-plugin-compat": "^6.0.2", "neostandard": "^0.12.2", "puppeteer-core": "^24.34.0", - "rollup": "^4.54.0", + "rollup": "^4.55.1", "rollup-plugin-copy": "^3.5.0" }, "peerDependencies": { diff --git a/test/action_view/cases/test_form_with_helpers.rb b/test/action_view/cases/test_form_with_helpers.rb index c0f9a245..cfafbd98 100644 --- a/test/action_view/cases/test_form_with_helpers.rb +++ b/test/action_view/cases/test_form_with_helpers.rb @@ -131,20 +131,18 @@ def test_form_with_file_field assert_dom_equal expected, output_buffer end - if Rails.version >= '7.0' - def test_form_with_file_multiple_include_hidden - form_with(model: @post, validate: true) do |f| - concat f.file_field(:cost, multiple: true, include_hidden: true) - end - - validators = { 'post[cost][]' => { presence: [{ message: I18n.t('errors.messages.blank') }] } } - expected = whole_form_with('/posts', validators: validators, file: true) do - hidden_input('post[cost][]') + - form_field('input', id: 'post_cost', name: 'post[cost][]', type: 'file', multiple: 'multiple') - end + def test_form_with_file_multiple_include_hidden + form_with(model: @post, validate: true) do |f| + concat f.file_field(:cost, multiple: true, include_hidden: true) + end - assert_dom_equal expected, output_buffer + validators = { 'post[cost][]' => { presence: [{ message: I18n.t('errors.messages.blank') }] } } + expected = whole_form_with('/posts', validators: validators, file: true) do + hidden_input('post[cost][]') + + form_field('input', id: 'post_cost', name: 'post[cost][]', type: 'file', multiple: 'multiple') end + + assert_dom_equal expected, output_buffer end def test_form_with_check_box diff --git a/test/action_view/cases/test_legacy_form_with_helpers.rb b/test/action_view/cases/test_legacy_form_with_helpers.rb index ed2b610e..7817f6fd 100644 --- a/test/action_view/cases/test_legacy_form_with_helpers.rb +++ b/test/action_view/cases/test_legacy_form_with_helpers.rb @@ -59,19 +59,17 @@ def test_form_with_file_field assert_dom_equal expected, output_buffer end - if Rails.version >= '7.0' - def test_form_with_file_multiple_include_hidden - form_with(model: @post) do |f| - concat f.file_field(:cost, multiple: true, include_hidden: true) - end - - expected = whole_form_with('/posts', file: true) do - hidden_input('post[cost][]') + - form_field('input', id: 'post_cost', name: 'post[cost][]', type: 'file', multiple: 'multiple') - end + def test_form_with_file_multiple_include_hidden + form_with(model: @post) do |f| + concat f.file_field(:cost, multiple: true, include_hidden: true) + end - assert_dom_equal expected, output_buffer + expected = whole_form_with('/posts', file: true) do + hidden_input('post[cost][]') + + form_field('input', id: 'post_cost', name: 'post[cost][]', type: 'file', multiple: 'multiple') end + + assert_dom_equal expected, output_buffer end def test_form_with_check_box diff --git a/test/javascript/server.rb b/test/javascript/server.rb index b0f67c74..e6d498f8 100644 --- a/test/javascript/server.rb +++ b/test/javascript/server.rb @@ -30,7 +30,7 @@ def call(env) use AssetPath, urls: ['/vendor/assets/javascripts'], root: File.expand_path('../', $LOAD_PATH.find { |p| p.include?('jquery-rails') }) DEFAULT_JQUERY_VERSION = '3.7.1' -QUNIT_VERSION = '2.24.3' +QUNIT_VERSION = '2.25.0' helpers do def jquery_version diff --git a/vendor/assets/javascripts/rails.validations.js b/vendor/assets/javascripts/rails.validations.js index 92362d87..aa185c7c 100644 --- a/vendor/assets/javascripts/rails.validations.js +++ b/vendor/assets/javascripts/rails.validations.js @@ -1,6 +1,6 @@ /*! * Client Side Validations JS - v0.5.0 (https://github.com/DavyJonesLocker/client_side_validations) - * Copyright (c) 2025 Geremia Taglialatela, Brian Cardarella + * Copyright (c) 2026 Geremia Taglialatela, Brian Cardarella * Licensed under MIT (https://opensource.org/licenses/mit-license.php) */