Skip to content

Commit 79f7cce

Browse files
committed
Drop Support for [email protected]
Commit to requiring `[email protected]` Remove `[email protected]`, `[email protected]`, `[email protected]`, `[email protected]`, and `[email protected]` from the CI matrix, along with any `RUBY_VERSION < "3"` conditionals. The implementation changes include replace older syntaxes with newer variants. For example, utilize `...` in place of `*args, &block`, rely on `**`-ing attribute `Hash` arguments, etc.
1 parent 43fb79d commit 79f7cce

File tree

11 files changed

+21
-43
lines changed

11 files changed

+21
-43
lines changed

.github/workflows/ci.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ jobs:
55
strategy:
66
fail-fast: false
77
matrix:
8-
rails: [ "6.1", "7.0", "7.1", "7.2" ]
9-
ruby: [ "2.7", "3.0", "3.1", "3.2", "3.3" ]
8+
rails: [ "7.1", "7.2", "8.0" ]
9+
ruby: [ "3.1", "3.2", "3.3", "3.4" ]
1010
allow-fail: [ false ]
1111
include:
12-
- { ruby: "2.6", rails: "6.1" }
1312
- { ruby: "3.3", rails: "main", allow-fail: true }
1413
- { ruby: "3.2", rails: "main", allow-fail: true }
1514
- { ruby: "head", rails: "main", allow-fail: true }
1615
exclude:
17-
- { ruby: "2.7", rails: "7.2" }
18-
- { ruby: "3.0", rails: "7.2" }
16+
- { ruby: "3.1", rails: "8.0" }
1917

2018
env:
2119
FERRUM_PROCESS_TIMEOUT: 25
@@ -37,7 +35,6 @@ jobs:
3735

3836
- name: Run Bug Template Tests
3937
run: ruby bug_report_template.rb || ruby bug_report_template.rb
40-
continue-on-error: ${{ startsWith(matrix.ruby, '2') || false }}
4138

4239
- name: Run tests
4340
id: test

Gemfile

+3-13
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,11 @@ gem "sprockets-rails"
1515

1616
gem 'rake'
1717
gem 'byebug'
18-
19-
if RUBY_VERSION < "3"
20-
gem "rack", "< 3"
21-
gem "puma", "< 6"
22-
else
23-
gem "rack"
24-
gem "puma"
25-
end
18+
gem 'puma'
19+
gem 'rack'
2620

2721
group :development, :test do
28-
if rails_version == "6.1"
29-
gem "importmap-rails", "0.6.1"
30-
else
31-
gem "importmap-rails"
32-
end
22+
gem 'importmap-rails'
3323
end
3424

3525
group :test do

app/channels/turbo/streams/broadcasts.rb

-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ def broadcast_refresh_to(*streamables, **opts)
3838
end
3939

4040
def broadcast_action_to(*streamables, action:, target: nil, targets: nil, attributes: {}, **rendering)
41-
attributes.deep_symbolize_keys! if RUBY_VERSION < "3"
42-
4341
broadcast_stream_to(*streamables, content: turbo_stream_action_tag(
4442
action, target: target, targets: targets, template: render_broadcast_action(rendering), **attributes)
4543
)

app/helpers/turbo/streams/action_helper.rb

+2-7
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ module Turbo::Streams::ActionHelper
2222
# message = Message.find(1)
2323
# turbo_stream_action_tag "remove", target: [message, :special]
2424
# # => <turbo-stream action="remove" target="special_message_1"></turbo-stream>
25-
def turbo_stream_action_tag(action, attributes = {})
26-
attributes.deep_symbolize_keys! if RUBY_VERSION < "3"
27-
28-
target = attributes.delete(:target)
29-
targets = attributes.delete(:targets)
30-
template = attributes.delete(:template)
25+
def turbo_stream_action_tag(action, target: nil, targets: nil, template: nil, **attributes)
3126
template = action.to_sym.in?(%i[ remove refresh ]) ? "" : tag.template(template.to_s.html_safe)
3227

3328
if target = convert_to_turbo_stream_dom_id(target)
@@ -44,7 +39,7 @@ def turbo_stream_action_tag(action, attributes = {})
4439
# turbo_stream_refresh_tag
4540
# # => <turbo-stream action="refresh"></turbo-stream>
4641
def turbo_stream_refresh_tag(request_id: Turbo.current_request_id, **attributes)
47-
turbo_stream_action_tag(:refresh, attributes.with_defaults({ "request-id": request_id }.compact))
42+
turbo_stream_action_tag(:refresh, "request-id": request_id.presence, **attributes)
4843
end
4944

5045
private

app/models/concerns/turbo/broadcastable.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ def broadcast_target_default
508508
self.class.broadcast_target_default
509509
end
510510

511-
def extract_options_and_add_target(rendering, target: broadcast_target_default)
511+
def extract_options_and_add_target(rendering = {}, target: broadcast_target_default)
512512
broadcast_rendering_with_defaults(rendering).tap do |options|
513513
options[:target] = target if !options.key?(:target) && !options.key?(:targets)
514514
end

app/models/turbo/streams/tag_builder.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ def prepend_all(targets, content = nil, **rendering, &block)
240240
#
241241
# turbo_stream.refresh request_id: "abc123"
242242
# # => <turbo-stream action="refresh" request-id="abc123"></turbo-stream>
243-
def refresh(**options)
244-
turbo_stream_refresh_tag(**options)
243+
def refresh(...)
244+
turbo_stream_refresh_tag(...)
245245
end
246246

247247
# Send an action of the type <tt>name</tt> to <tt>target</tt>. Options described in the concrete methods.

bug_report_template.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
gem "rails"
77
gem "propshaft"
88
gem "puma"
9-
gem "sqlite3", "~> 1.4"
9+
gem "sqlite3"
1010
gem "turbo-rails"
1111

1212
gem "capybara"

lib/turbo/engine.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class TurboStreamEncoder < IdentityEncoder
164164
ActiveSupport.on_load(:action_dispatch_system_test_case) do
165165
app.config.turbo.test_connect_after_actions.map do |method|
166166
class_eval <<~RUBY, __FILE__, __LINE__ + 1
167-
def #{method}(*args, &block) # def visit(*args, &block)
167+
def #{method}(...) # def visit(...)
168168
super.tap { connect_turbo_cable_stream_sources } # super.tap { connect_turbo_cable_stream_sources }
169169
end # end
170170
RUBY

lib/turbo/system_test_helper.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ def connect_turbo_cable_stream_sources(**options, &block)
5151
#
5252
# In addition to the filters listed above, accepts any valid Capybara global
5353
# filter option.
54-
def assert_turbo_cable_stream_source(*args, &block)
55-
assert_selector(:turbo_cable_stream_source, *args, &block)
54+
def assert_turbo_cable_stream_source(...)
55+
assert_selector(:turbo_cable_stream_source, ...)
5656
end
5757

5858
# Asserts that a `<turbo-cable-stream-source>` element is absent from the
@@ -75,8 +75,8 @@ def assert_turbo_cable_stream_source(*args, &block)
7575
#
7676
# In addition to the filters listed above, accepts any valid Capybara global
7777
# filter option.
78-
def assert_no_turbo_cable_stream_source(*args, &block)
79-
assert_no_selector(:turbo_cable_stream_source, *args, &block)
78+
def assert_no_turbo_cable_stream_source(...)
79+
assert_no_selector(:turbo_cable_stream_source, ...)
8080
end
8181

8282
Capybara.add_selector :turbo_cable_stream_source do

test/test_helper.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
ActionCable.server.config.logger = Logger.new(STDOUT) if ENV["VERBOSE"]
99

1010
module ActionViewTestCaseExtensions
11-
def render(*args, &block)
12-
ApplicationController.renderer.render(*args, &block)
13-
end
11+
delegate :render, to: ApplicationController
1412
end
1513

1614
class ActiveSupport::TestCase

turbo-rails.gemspec

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Gem::Specification.new do |s|
99
s.homepage = "https://github.com/hotwired/turbo-rails"
1010
s.license = "MIT"
1111

12-
s.required_ruby_version = ">= 2.6.0"
12+
s.required_ruby_version = ">= 3.1"
1313

14-
s.add_dependency "actionpack", ">= 6.0.0"
15-
s.add_dependency "railties", ">= 6.0.0"
14+
s.add_dependency "actionpack", ">= 7.1.0"
15+
s.add_dependency "railties", ">= 7.1.0"
1616

1717
s.files = Dir["{app,config,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
1818

0 commit comments

Comments
 (0)