turbo-rails 1.5.0 → 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +67 -16
- data/app/assets/javascripts/turbo.js +1974 -785
- data/app/assets/javascripts/turbo.min.js +9 -5
- data/app/assets/javascripts/turbo.min.js.map +1 -1
- data/app/channels/turbo/streams/broadcasts.rb +33 -7
- data/app/channels/turbo/streams_channel.rb +15 -15
- data/app/controllers/concerns/turbo/request_id_tracking.rb +12 -0
- data/app/controllers/turbo/frames/frame_request.rb +2 -2
- data/app/controllers/turbo/native/navigation.rb +6 -3
- data/app/helpers/turbo/drive_helper.rb +72 -14
- data/app/helpers/turbo/frames_helper.rb +8 -8
- data/app/helpers/turbo/streams/action_helper.rb +12 -4
- data/app/helpers/turbo/streams_helper.rb +5 -0
- data/app/javascript/turbo/index.js +2 -0
- data/app/jobs/turbo/streams/action_broadcast_job.rb +2 -2
- data/app/jobs/turbo/streams/broadcast_job.rb +1 -1
- data/app/jobs/turbo/streams/broadcast_stream_job.rb +7 -0
- data/app/models/concerns/turbo/broadcastable.rb +184 -35
- data/app/models/turbo/debouncer.rb +24 -0
- data/app/models/turbo/streams/tag_builder.rb +20 -0
- data/app/models/turbo/thread_debouncer.rb +28 -0
- data/config/routes.rb +3 -4
- data/lib/install/turbo_with_importmap.rb +1 -1
- data/lib/tasks/turbo_tasks.rake +0 -22
- data/lib/turbo/broadcastable/test_helper.rb +5 -5
- data/lib/turbo/engine.rb +34 -8
- data/lib/turbo/test_assertions/integration_test_assertions.rb +2 -2
- data/lib/turbo/test_assertions.rb +2 -2
- data/lib/turbo/version.rb +1 -1
- data/lib/turbo-rails.rb +10 -0
- metadata +9 -5
- data/lib/install/turbo_needs_redis.rb +0 -20
@@ -4,7 +4,7 @@ module Turbo
|
|
4
4
|
# Assert that the Turbo Stream request's response body's HTML contains a
|
5
5
|
# `<turbo-stream>` element.
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# ==== Options
|
8
8
|
#
|
9
9
|
# * <tt>:status</tt> [Integer, Symbol] the HTTP response status
|
10
10
|
# * <tt>:action</tt> [String] matches the element's <tt>[action]</tt>
|
@@ -47,7 +47,7 @@ module Turbo
|
|
47
47
|
# Assert that the Turbo Stream request's response body's HTML does not
|
48
48
|
# contain a `<turbo-stream>` element.
|
49
49
|
#
|
50
|
-
#
|
50
|
+
# ==== Options
|
51
51
|
#
|
52
52
|
# * <tt>:status</tt> [Integer, Symbol] the HTTP response status
|
53
53
|
# * <tt>:action</tt> [String] matches the element's <tt>[action]</tt>
|
@@ -10,7 +10,7 @@ module Turbo
|
|
10
10
|
# Assert that the rendered fragment of HTML contains a `<turbo-stream>`
|
11
11
|
# element.
|
12
12
|
#
|
13
|
-
#
|
13
|
+
# ==== Options
|
14
14
|
#
|
15
15
|
# * <tt>:action</tt> [String] matches the element's <tt>[action]</tt>
|
16
16
|
# attribute
|
@@ -55,7 +55,7 @@ module Turbo
|
|
55
55
|
# Assert that the rendered fragment of HTML does not contain a `<turbo-stream>`
|
56
56
|
# element.
|
57
57
|
#
|
58
|
-
#
|
58
|
+
# ==== Options
|
59
59
|
#
|
60
60
|
# * <tt>:action</tt> [String] matches the element's <tt>[action]</tt>
|
61
61
|
# attribute
|
data/lib/turbo/version.rb
CHANGED
data/lib/turbo-rails.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
require "turbo/engine"
|
2
|
+
require "active_support/core_ext/module/attribute_accessors_per_thread"
|
2
3
|
|
3
4
|
module Turbo
|
4
5
|
extend ActiveSupport::Autoload
|
5
6
|
|
6
7
|
mattr_accessor :draw_routes, default: true
|
7
8
|
|
9
|
+
thread_mattr_accessor :current_request_id
|
10
|
+
|
8
11
|
class << self
|
9
12
|
attr_writer :signed_stream_verifier_key
|
10
13
|
|
@@ -15,5 +18,12 @@ module Turbo
|
|
15
18
|
def signed_stream_verifier_key
|
16
19
|
@signed_stream_verifier_key or raise ArgumentError, "Turbo requires a signed_stream_verifier_key"
|
17
20
|
end
|
21
|
+
|
22
|
+
def with_request_id(request_id)
|
23
|
+
old_request_id, self.current_request_id = self.current_request_id, request_id
|
24
|
+
yield
|
25
|
+
ensure
|
26
|
+
self.current_request_id = old_request_id
|
27
|
+
end
|
18
28
|
end
|
19
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Stephenson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-09-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activejob
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- app/channels/turbo/streams/broadcasts.rb
|
70
70
|
- app/channels/turbo/streams/stream_name.rb
|
71
71
|
- app/channels/turbo/streams_channel.rb
|
72
|
+
- app/controllers/concerns/turbo/request_id_tracking.rb
|
72
73
|
- app/controllers/turbo/frames/frame_request.rb
|
73
74
|
- app/controllers/turbo/native/navigation.rb
|
74
75
|
- app/controllers/turbo/native/navigation_controller.rb
|
@@ -85,11 +86,13 @@ files:
|
|
85
86
|
- app/javascript/turbo/snakeize.js
|
86
87
|
- app/jobs/turbo/streams/action_broadcast_job.rb
|
87
88
|
- app/jobs/turbo/streams/broadcast_job.rb
|
89
|
+
- app/jobs/turbo/streams/broadcast_stream_job.rb
|
88
90
|
- app/models/concerns/turbo/broadcastable.rb
|
91
|
+
- app/models/turbo/debouncer.rb
|
89
92
|
- app/models/turbo/streams/tag_builder.rb
|
93
|
+
- app/models/turbo/thread_debouncer.rb
|
90
94
|
- app/views/layouts/turbo_rails/frame.html.erb
|
91
95
|
- config/routes.rb
|
92
|
-
- lib/install/turbo_needs_redis.rb
|
93
96
|
- lib/install/turbo_with_bun.rb
|
94
97
|
- lib/install/turbo_with_importmap.rb
|
95
98
|
- lib/install/turbo_with_node.rb
|
@@ -103,7 +106,8 @@ files:
|
|
103
106
|
homepage: https://github.com/hotwired/turbo-rails
|
104
107
|
licenses:
|
105
108
|
- MIT
|
106
|
-
metadata:
|
109
|
+
metadata:
|
110
|
+
changelog_uri: https://github.com/hotwired/turbo-rails/releases
|
107
111
|
post_install_message:
|
108
112
|
rdoc_options: []
|
109
113
|
require_paths:
|
@@ -119,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
123
|
- !ruby/object:Gem::Version
|
120
124
|
version: '0'
|
121
125
|
requirements: []
|
122
|
-
rubygems_version: 3.
|
126
|
+
rubygems_version: 3.5.16
|
123
127
|
signing_key:
|
124
128
|
specification_version: 4
|
125
129
|
summary: The speed of a single-page web application without having to write any JavaScript.
|
@@ -1,20 +0,0 @@
|
|
1
|
-
if (cable_config_path = Rails.root.join("config/cable.yml")).exist?
|
2
|
-
say "Enable redis in bundle"
|
3
|
-
|
4
|
-
gemfile_content = File.read(Rails.root.join("Gemfile"))
|
5
|
-
pattern = /gem ['"]redis['"]/
|
6
|
-
|
7
|
-
if gemfile_content.match?(pattern)
|
8
|
-
uncomment_lines "Gemfile", pattern
|
9
|
-
else
|
10
|
-
append_file "Gemfile", "\n# Use Redis for Action Cable"
|
11
|
-
gem 'redis', '~> 4.0'
|
12
|
-
end
|
13
|
-
|
14
|
-
run_bundle
|
15
|
-
|
16
|
-
say "Switch development cable to use redis"
|
17
|
-
gsub_file cable_config_path.to_s, /development:\n\s+adapter: async/, "development:\n adapter: redis\n url: redis://localhost:6379/1"
|
18
|
-
else
|
19
|
-
say 'ActionCable config file (config/cable.yml) is missing. Uncomment "gem \'redis\'" in your Gemfile and create config/cable.yml to use the Turbo Streams broadcast feature.'
|
20
|
-
end
|