Skip to content

Commit

Permalink
Drop EOL Ruby versions (< 3.1) (#970)
Browse files Browse the repository at this point in the history
  • Loading branch information
tagliala authored Dec 22, 2024
1 parent 6045632 commit c9f0548
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '22'
- name: Install node dependencies
run: pnpm install
- name: Run JavaScript linter
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '22'
- name: Install node dependencies
run: pnpm install
- name: Run tests
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3']
ruby-version: ['3.1', '3.2', '3.3']
gemfile: [rails_6.1, rails_7.0, rails_7.1, rails_7.2, rails_8.0]
channel: ['stable']

Expand All @@ -40,14 +40,6 @@ jobs:
channel: 'experimental'

exclude:
- ruby-version: '2.7'
gemfile: rails_7.2
- ruby-version: '2.7'
gemfile: rails_8.0
- ruby-version: '3.0'
gemfile: rails_7.2
- ruby-version: '3.0'
gemfile: rails_8.0
- ruby-version: '3.1'
gemfile: rails_8.0
- ruby-version: '3.2'
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require:

AllCops:
TargetRailsVersion: 6.1
TargetRubyVersion: 2.7
TargetRubyVersion: 3.1
NewCops: enable
DisplayStyleGuide: true
ExtraDetails: true
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- `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
* [ENHANCEMENT] Update QUnit to 2.23.0

## 22.3.0 / 2024-11-12
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace :test do
desc %(Test Ruby code)
Rake::TestTask.new(:ruby) do |test|
test.libs << 'lib' << 'test'
test.test_files = Dir.glob("#{__dir__}/test/**/test_*.rb").sort
test.test_files = Dir.glob("#{__dir__}/test/**/test_*.rb")
test.warning = false
end

Expand Down
2 changes: 1 addition & 1 deletion client_side_validations.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ['lib']

spec.platform = Gem::Platform::RUBY
spec.required_ruby_version = '>= 2.7'
spec.required_ruby_version = '>= 3.1'

spec.add_dependency 'js_regex', '~> 3.7'
spec.add_dependency 'rails', '>= 6.1'
Expand Down
4 changes: 2 additions & 2 deletions lib/client_side_validations/action_view/form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def collection_select(method, collection, value_method, text_method, options = {
super
end

def fields_for(record_name, record_object = nil, fields_options = {}, &block)
def fields_for(record_name, record_object = nil, fields_options = {}, &)
if record_object.is_a?(Hash) && record_object.extractable_options?
fields_options = record_object
record_object = nil
Expand Down Expand Up @@ -106,7 +106,7 @@ def radio_button(method, tag_value, options = {})
super
end

def select(method, choices = nil, options = {}, html_options = {}, &block)
def select(method, choices = nil, options = {}, html_options = {}, &)
build_validation_options(method, html_options.merge(name: options[:name]))
html_options.delete(:validate)
super
Expand Down
4 changes: 2 additions & 2 deletions lib/client_side_validations/action_view/form_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ def apply_csv_form_for_options!(record, object, options)
end
end

def fields_for(record_name, record_object = nil, options = {}, &block)
def fields_for(record_name, record_object = nil, options = {}, &)
# Order matters here. Rails mutates the `options` object
builder = instantiate_builder(record_name, record_object, options)
output = capture(builder, &block)
output = capture(builder, &)

build_bound_validators! options

Expand Down
4 changes: 2 additions & 2 deletions lib/client_side_validations/action_view/form_with_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ def check_model(url, model, format, scope)
[url, model, scope]
end

def form_tag_with_validators(scope, model, options, url, &block)
def form_tag_with_validators(scope, model, options, url, &)
@validators = {}

builder = instantiate_builder(scope, model, options)
output = capture(builder, &block)
output = capture(builder, &)
options[:multipart] ||= builder.multipart?

build_bound_validators! options
Expand Down
6 changes: 3 additions & 3 deletions test/action_view/cases/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def snowman(method = nil)
end

def form_field(tag, id: nil, name: nil, type: nil, value: nil, multiple: false, tag_content: nil, custom_name: nil)
txt = +%(<#{tag})
txt = %(<#{tag})

txt << %( name="#{custom_name}") if custom_name
txt << %( type="#{type}") if type
Expand All @@ -167,7 +167,7 @@ def form_field(tag, id: nil, name: nil, type: nil, value: nil, multiple: false,
end

def form_for_text(action = 'http://www.example.com', id = nil, html_class = nil, remote = nil, validators = nil, file = nil)
txt = +%(<form action="#{action}" accept-charset="UTF-8" method="post")
txt = %(<form action="#{action}" accept-charset="UTF-8" method="post")

if validators
txt << %( data-client-side-validations="#{CGI.escapeHTML(csv_data_attribute(validators))}")
Expand Down Expand Up @@ -196,7 +196,7 @@ def whole_form_for(action = 'http://www.example.com', id = nil, html_class = nil
end

def form_with_text(action = 'http://www.example.com', id = nil, html_class = nil, local = nil, validators = nil, file = nil)
txt = +%(<form action="#{action}" accept-charset="UTF-8" method="post")
txt = %(<form action="#{action}" accept-charset="UTF-8" method="post")

if validators
txt << %( data-client-side-validations="#{CGI.escapeHTML(csv_data_attribute(validators))}")
Expand Down

0 comments on commit c9f0548

Please sign in to comment.