cable_ready 5.0.0.pre8 → 5.0.0.pre10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -542
- data/Gemfile +4 -1
- data/Gemfile.lock +125 -168
- data/IMPLEMENTATION.md +93 -0
- data/README.md +36 -10
- data/Rakefile +0 -8
- data/app/assets/javascripts/cable_ready.js +1265 -0
- data/app/assets/javascripts/cable_ready.min.js +2 -0
- data/app/assets/javascripts/cable_ready.min.js.map +1 -0
- data/app/assets/javascripts/cable_ready.umd.js +1186 -0
- data/app/assets/javascripts/cable_ready.umd.min.js +2 -0
- data/app/assets/javascripts/cable_ready.umd.min.js.map +1 -0
- data/app/channels/cable_ready/stream.rb +7 -5
- data/app/helpers/cable_ready/view_helper.rb +58 -0
- data/app/jobs/cable_ready_broadcast_job.rb +9 -8
- data/app/models/concerns/cable_ready/updatable/collection_updatable_callbacks.rb +2 -0
- data/app/models/concerns/cable_ready/updatable/collections_registry.rb +2 -0
- data/app/models/concerns/cable_ready/updatable/model_updatable_callbacks.rb +6 -3
- data/app/models/concerns/cable_ready/updatable.rb +110 -17
- data/app/models/concerns/extend_has_many.rb +2 -0
- data/cable_ready.gemspec +40 -0
- data/lib/cable_ready/broadcaster.rb +2 -0
- data/lib/cable_ready/cable_car.rb +2 -0
- data/lib/cable_ready/channel.rb +12 -4
- data/lib/cable_ready/channels.rb +3 -1
- data/lib/cable_ready/config.rb +16 -2
- data/lib/cable_ready/engine.rb +50 -0
- data/lib/cable_ready/identifiable.rb +23 -5
- data/lib/cable_ready/importmap.rb +4 -0
- data/lib/cable_ready/installer.rb +224 -0
- data/lib/cable_ready/operation_builder.rb +1 -1
- data/lib/cable_ready/sanity_checker.rb +1 -31
- data/lib/cable_ready/version.rb +1 -1
- data/lib/cable_ready.rb +4 -26
- data/lib/cable_ready_helper.rb +13 -0
- data/lib/generators/cable_ready/channel_generator.rb +51 -12
- data/lib/generators/cable_ready/templates/config/initializers/cable_ready.rb +10 -6
- data/lib/install/action_cable.rb +144 -0
- data/lib/install/broadcaster.rb +109 -0
- data/lib/install/bundle.rb +54 -0
- data/lib/install/compression.rb +51 -0
- data/lib/install/config.rb +39 -0
- data/lib/install/development.rb +34 -0
- data/lib/install/esbuild.rb +101 -0
- data/lib/install/importmap.rb +96 -0
- data/lib/install/initializers.rb +15 -0
- data/lib/install/mrujs.rb +121 -0
- data/lib/install/npm_packages.rb +13 -0
- data/lib/install/shakapacker.rb +61 -0
- data/lib/install/spring.rb +54 -0
- data/lib/install/updatable.rb +34 -0
- data/lib/install/vite.rb +62 -0
- data/lib/install/webpacker.rb +81 -0
- data/lib/install/yarn.rb +56 -0
- data/lib/tasks/cable_ready/cable_ready.rake +249 -0
- data/package.json +61 -0
- data/rollup.config.mjs +76 -0
- data/web-test-runner.config.mjs +12 -0
- data/yarn.lock +4623 -0
- metadata +96 -129
- data/LATEST +0 -1
- data/app/helpers/cable_ready_helper.rb +0 -25
- data/lib/generators/cable_ready/helpers_generator.rb +0 -43
- data/lib/generators/cable_ready/initializer_generator.rb +0 -14
- data/test/dummy/app/channels/application_cable/channel.rb +0 -4
- data/test/dummy/app/channels/application_cable/connection.rb +0 -4
- data/test/dummy/app/controllers/application_controller.rb +0 -2
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/jobs/application_job.rb +0 -7
- data/test/dummy/app/mailers/application_mailer.rb +0 -4
- data/test/dummy/app/models/application_record.rb +0 -3
- data/test/dummy/app/models/global_idable_entity.rb +0 -16
- data/test/dummy/app/models/post.rb +0 -4
- data/test/dummy/app/models/section.rb +0 -6
- data/test/dummy/app/models/team.rb +0 -6
- data/test/dummy/app/models/topic.rb +0 -4
- data/test/dummy/app/models/user.rb +0 -7
- data/test/dummy/config/application.rb +0 -22
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -76
- data/test/dummy/config/environments/production.rb +0 -120
- data/test/dummy/config/environments/test.rb +0 -59
- data/test/dummy/config/initializers/application_controller_renderer.rb +0 -8
- data/test/dummy/config/initializers/assets.rb +0 -12
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -8
- data/test/dummy/config/initializers/cable_ready.rb +0 -18
- data/test/dummy/config/initializers/content_security_policy.rb +0 -28
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -5
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -6
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/permissions_policy.rb +0 -11
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/puma.rb +0 -43
- data/test/dummy/config/routes.rb +0 -3
- data/test/dummy/db/migrate/20210902154139_create_users.rb +0 -9
- data/test/dummy/db/migrate/20210902154153_create_posts.rb +0 -10
- data/test/dummy/db/migrate/20210904081930_create_topics.rb +0 -9
- data/test/dummy/db/migrate/20210904093607_create_sections.rb +0 -9
- data/test/dummy/db/migrate/20210913191735_create_teams.rb +0 -8
- data/test/dummy/db/migrate/20210913191759_add_team_reference_to_users.rb +0 -5
- data/test/dummy/db/schema.rb +0 -49
- data/test/dummy/test/models/post_test.rb +0 -7
- data/test/dummy/test/models/section_test.rb +0 -7
- data/test/dummy/test/models/team_test.rb +0 -7
- data/test/dummy/test/models/topic_test.rb +0 -7
- data/test/dummy/test/models/user_test.rb +0 -7
- data/test/lib/cable_ready/cable_car_test.rb +0 -50
- data/test/lib/cable_ready/compoundable_test.rb +0 -26
- data/test/lib/cable_ready/helper_test.rb +0 -25
- data/test/lib/cable_ready/identifiable_test.rb +0 -69
- data/test/lib/cable_ready/operation_builder_test.rb +0 -189
- data/test/lib/cable_ready/updatable_test.rb +0 -112
- data/test/lib/generators/cable_ready/channel_generator_test.rb +0 -157
- data/test/support/generator_test_helpers.rb +0 -28
- data/test/test_helper.rb +0 -18
data/Gemfile.lock
CHANGED
@@ -1,260 +1,217 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cable_ready (5.0.0.
|
5
|
-
|
4
|
+
cable_ready (5.0.0.pre10)
|
5
|
+
actionpack (>= 5.2)
|
6
|
+
actionview (>= 5.2)
|
7
|
+
activesupport (>= 5.2)
|
8
|
+
railties (>= 5.2)
|
6
9
|
thread-local (>= 1.1.0)
|
7
10
|
|
8
11
|
GEM
|
9
12
|
remote: https://rubygems.org/
|
10
13
|
specs:
|
11
|
-
actioncable (6.1.
|
12
|
-
actionpack (= 6.1.
|
13
|
-
activesupport (= 6.1.
|
14
|
+
actioncable (6.1.7.2)
|
15
|
+
actionpack (= 6.1.7.2)
|
16
|
+
activesupport (= 6.1.7.2)
|
14
17
|
nio4r (~> 2.0)
|
15
18
|
websocket-driver (>= 0.6.1)
|
16
|
-
actionmailbox (6.1.
|
17
|
-
actionpack (= 6.1.
|
18
|
-
activejob (= 6.1.
|
19
|
-
activerecord (= 6.1.
|
20
|
-
activestorage (= 6.1.
|
21
|
-
activesupport (= 6.1.
|
19
|
+
actionmailbox (6.1.7.2)
|
20
|
+
actionpack (= 6.1.7.2)
|
21
|
+
activejob (= 6.1.7.2)
|
22
|
+
activerecord (= 6.1.7.2)
|
23
|
+
activestorage (= 6.1.7.2)
|
24
|
+
activesupport (= 6.1.7.2)
|
22
25
|
mail (>= 2.7.1)
|
23
|
-
actionmailer (6.1.
|
24
|
-
actionpack (= 6.1.
|
25
|
-
actionview (= 6.1.
|
26
|
-
activejob (= 6.1.
|
27
|
-
activesupport (= 6.1.
|
26
|
+
actionmailer (6.1.7.2)
|
27
|
+
actionpack (= 6.1.7.2)
|
28
|
+
actionview (= 6.1.7.2)
|
29
|
+
activejob (= 6.1.7.2)
|
30
|
+
activesupport (= 6.1.7.2)
|
28
31
|
mail (~> 2.5, >= 2.5.4)
|
29
32
|
rails-dom-testing (~> 2.0)
|
30
|
-
actionpack (6.1.
|
31
|
-
actionview (= 6.1.
|
32
|
-
activesupport (= 6.1.
|
33
|
+
actionpack (6.1.7.2)
|
34
|
+
actionview (= 6.1.7.2)
|
35
|
+
activesupport (= 6.1.7.2)
|
33
36
|
rack (~> 2.0, >= 2.0.9)
|
34
37
|
rack-test (>= 0.6.3)
|
35
38
|
rails-dom-testing (~> 2.0)
|
36
39
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
37
|
-
actiontext (6.1.
|
38
|
-
actionpack (= 6.1.
|
39
|
-
activerecord (= 6.1.
|
40
|
-
activestorage (= 6.1.
|
41
|
-
activesupport (= 6.1.
|
40
|
+
actiontext (6.1.7.2)
|
41
|
+
actionpack (= 6.1.7.2)
|
42
|
+
activerecord (= 6.1.7.2)
|
43
|
+
activestorage (= 6.1.7.2)
|
44
|
+
activesupport (= 6.1.7.2)
|
42
45
|
nokogiri (>= 1.8.5)
|
43
|
-
actionview (6.1.
|
44
|
-
activesupport (= 6.1.
|
46
|
+
actionview (6.1.7.2)
|
47
|
+
activesupport (= 6.1.7.2)
|
45
48
|
builder (~> 3.1)
|
46
49
|
erubi (~> 1.4)
|
47
50
|
rails-dom-testing (~> 2.0)
|
48
51
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
49
|
-
activejob (6.1.
|
50
|
-
activesupport (= 6.1.
|
52
|
+
activejob (6.1.7.2)
|
53
|
+
activesupport (= 6.1.7.2)
|
51
54
|
globalid (>= 0.3.6)
|
52
|
-
activemodel (6.1.
|
53
|
-
activesupport (= 6.1.
|
54
|
-
activerecord (6.1.
|
55
|
-
activemodel (= 6.1.
|
56
|
-
activesupport (= 6.1.
|
57
|
-
activestorage (6.1.
|
58
|
-
actionpack (= 6.1.
|
59
|
-
activejob (= 6.1.
|
60
|
-
activerecord (= 6.1.
|
61
|
-
activesupport (= 6.1.
|
62
|
-
marcel (~> 1.0
|
55
|
+
activemodel (6.1.7.2)
|
56
|
+
activesupport (= 6.1.7.2)
|
57
|
+
activerecord (6.1.7.2)
|
58
|
+
activemodel (= 6.1.7.2)
|
59
|
+
activesupport (= 6.1.7.2)
|
60
|
+
activestorage (6.1.7.2)
|
61
|
+
actionpack (= 6.1.7.2)
|
62
|
+
activejob (= 6.1.7.2)
|
63
|
+
activerecord (= 6.1.7.2)
|
64
|
+
activesupport (= 6.1.7.2)
|
65
|
+
marcel (~> 1.0)
|
63
66
|
mini_mime (>= 1.1.0)
|
64
|
-
activesupport (6.1.
|
67
|
+
activesupport (6.1.7.2)
|
65
68
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
66
69
|
i18n (>= 1.6, < 2)
|
67
70
|
minitest (>= 5.1)
|
68
71
|
tzinfo (~> 2.0)
|
69
72
|
zeitwerk (~> 2.3)
|
70
|
-
addressable (2.8.0)
|
71
|
-
public_suffix (>= 2.0.2, < 5.0)
|
72
73
|
ast (2.4.2)
|
73
|
-
async (1.30.1)
|
74
|
-
console (~> 1.10)
|
75
|
-
nio4r (~> 2.3)
|
76
|
-
timers (~> 4.1)
|
77
|
-
async-http (0.56.5)
|
78
|
-
async (>= 1.25)
|
79
|
-
async-io (>= 1.28)
|
80
|
-
async-pool (>= 0.2)
|
81
|
-
protocol-http (~> 0.22.0)
|
82
|
-
protocol-http1 (~> 0.14.0)
|
83
|
-
protocol-http2 (~> 0.14.0)
|
84
|
-
async-http-faraday (0.11.0)
|
85
|
-
async-http (~> 0.42)
|
86
|
-
faraday
|
87
|
-
async-io (1.32.2)
|
88
|
-
async
|
89
|
-
async-pool (0.3.9)
|
90
|
-
async (>= 1.25)
|
91
74
|
builder (3.2.4)
|
92
75
|
coderay (1.1.3)
|
93
|
-
concurrent-ruby (1.
|
94
|
-
console (1.13.1)
|
95
|
-
fiber-local
|
76
|
+
concurrent-ruby (1.2.0)
|
96
77
|
crass (1.0.6)
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
faraday-em_synchrony (~> 1.0)
|
101
|
-
faraday-excon (~> 1.1)
|
102
|
-
faraday-httpclient (~> 1.0.1)
|
103
|
-
faraday-net_http (~> 1.0)
|
104
|
-
faraday-net_http_persistent (~> 1.1)
|
105
|
-
faraday-patron (~> 1.0)
|
106
|
-
faraday-rack (~> 1.0)
|
107
|
-
multipart-post (>= 1.2, < 3)
|
108
|
-
ruby2_keywords (>= 0.0.4)
|
109
|
-
faraday-em_http (1.0.0)
|
110
|
-
faraday-em_synchrony (1.0.0)
|
111
|
-
faraday-excon (1.1.0)
|
112
|
-
faraday-http-cache (2.2.0)
|
113
|
-
faraday (>= 0.8)
|
114
|
-
faraday-httpclient (1.0.1)
|
115
|
-
faraday-net_http (1.0.1)
|
116
|
-
faraday-net_http_persistent (1.2.0)
|
117
|
-
faraday-patron (1.0.0)
|
118
|
-
faraday-rack (1.0.0)
|
119
|
-
fiber-local (1.0.0)
|
120
|
-
github_changelog_generator (1.16.4)
|
121
|
-
activesupport
|
122
|
-
async (>= 1.25.0)
|
123
|
-
async-http-faraday
|
124
|
-
faraday-http-cache
|
125
|
-
multi_json
|
126
|
-
octokit (~> 4.6)
|
127
|
-
rainbow (>= 2.2.1)
|
128
|
-
rake (>= 10.0)
|
129
|
-
globalid (0.5.2)
|
78
|
+
date (3.3.3)
|
79
|
+
erubi (1.12.0)
|
80
|
+
globalid (1.1.0)
|
130
81
|
activesupport (>= 5.0)
|
131
|
-
i18n (1.
|
82
|
+
i18n (1.12.0)
|
132
83
|
concurrent-ruby (~> 1.0)
|
133
|
-
|
84
|
+
json (2.6.3)
|
85
|
+
language_server-protocol (3.17.0.3)
|
86
|
+
loofah (2.19.1)
|
134
87
|
crass (~> 1.0.2)
|
135
88
|
nokogiri (>= 1.5.9)
|
136
89
|
magic_frozen_string_literal (1.2.0)
|
137
|
-
mail (2.
|
90
|
+
mail (2.8.1)
|
138
91
|
mini_mime (>= 0.1.1)
|
92
|
+
net-imap
|
93
|
+
net-pop
|
94
|
+
net-smtp
|
139
95
|
marcel (1.0.2)
|
140
96
|
method_source (1.0.0)
|
141
97
|
mini_mime (1.1.2)
|
142
|
-
minitest (5.
|
143
|
-
mocha (
|
144
|
-
|
145
|
-
|
98
|
+
minitest (5.17.0)
|
99
|
+
mocha (2.0.2)
|
100
|
+
ruby2_keywords (>= 0.0.5)
|
101
|
+
net-imap (0.3.4)
|
102
|
+
date
|
103
|
+
net-protocol
|
104
|
+
net-pop (0.1.2)
|
105
|
+
net-protocol
|
106
|
+
net-protocol (0.2.1)
|
107
|
+
timeout
|
108
|
+
net-smtp (0.3.3)
|
109
|
+
net-protocol
|
146
110
|
nio4r (2.5.8)
|
147
|
-
nokogiri (1.
|
111
|
+
nokogiri (1.14.2-x86_64-darwin)
|
112
|
+
racc (~> 1.4)
|
113
|
+
nokogiri (1.14.2-x86_64-linux)
|
148
114
|
racc (~> 1.4)
|
149
|
-
|
150
|
-
|
151
|
-
sawyer (~> 0.8.0, >= 0.5.3)
|
152
|
-
parallel (1.21.0)
|
153
|
-
parser (3.0.2.0)
|
115
|
+
parallel (1.22.1)
|
116
|
+
parser (3.2.1.0)
|
154
117
|
ast (~> 2.4.1)
|
155
|
-
|
156
|
-
protocol-http (0.22.5)
|
157
|
-
protocol-http1 (0.14.2)
|
158
|
-
protocol-http (~> 0.22)
|
159
|
-
protocol-http2 (0.14.2)
|
160
|
-
protocol-hpack (~> 1.4)
|
161
|
-
protocol-http (~> 0.18)
|
162
|
-
pry (0.14.1)
|
118
|
+
pry (0.14.2)
|
163
119
|
coderay (~> 1.1)
|
164
120
|
method_source (~> 1.0)
|
165
121
|
pry-nav (1.0.0)
|
166
122
|
pry (>= 0.9.10, < 0.15)
|
167
|
-
|
168
|
-
|
169
|
-
rack (2.2
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
activesupport (= 6.1.4.1)
|
123
|
+
racc (1.6.2)
|
124
|
+
rack (2.2.6.2)
|
125
|
+
rack-test (2.0.2)
|
126
|
+
rack (>= 1.3)
|
127
|
+
rails (6.1.7.2)
|
128
|
+
actioncable (= 6.1.7.2)
|
129
|
+
actionmailbox (= 6.1.7.2)
|
130
|
+
actionmailer (= 6.1.7.2)
|
131
|
+
actionpack (= 6.1.7.2)
|
132
|
+
actiontext (= 6.1.7.2)
|
133
|
+
actionview (= 6.1.7.2)
|
134
|
+
activejob (= 6.1.7.2)
|
135
|
+
activemodel (= 6.1.7.2)
|
136
|
+
activerecord (= 6.1.7.2)
|
137
|
+
activestorage (= 6.1.7.2)
|
138
|
+
activesupport (= 6.1.7.2)
|
184
139
|
bundler (>= 1.15.0)
|
185
|
-
railties (= 6.1.
|
140
|
+
railties (= 6.1.7.2)
|
186
141
|
sprockets-rails (>= 2.0.0)
|
187
142
|
rails-dom-testing (2.0.3)
|
188
143
|
activesupport (>= 4.2.0)
|
189
144
|
nokogiri (>= 1.6)
|
190
|
-
rails-html-sanitizer (1.
|
191
|
-
loofah (~> 2.
|
192
|
-
railties (6.1.
|
193
|
-
actionpack (= 6.1.
|
194
|
-
activesupport (= 6.1.
|
145
|
+
rails-html-sanitizer (1.5.0)
|
146
|
+
loofah (~> 2.19, >= 2.19.1)
|
147
|
+
railties (6.1.7.2)
|
148
|
+
actionpack (= 6.1.7.2)
|
149
|
+
activesupport (= 6.1.7.2)
|
195
150
|
method_source
|
196
|
-
rake (>=
|
151
|
+
rake (>= 12.2)
|
197
152
|
thor (~> 1.0)
|
198
|
-
rainbow (3.
|
153
|
+
rainbow (3.1.1)
|
199
154
|
rake (13.0.6)
|
200
|
-
regexp_parser (2.
|
155
|
+
regexp_parser (2.7.0)
|
201
156
|
rexml (3.2.5)
|
202
|
-
rubocop (1.
|
157
|
+
rubocop (1.39.0)
|
158
|
+
json (~> 2.3)
|
203
159
|
parallel (~> 1.10)
|
204
|
-
parser (>= 3.
|
160
|
+
parser (>= 3.1.2.1)
|
205
161
|
rainbow (>= 2.2.2, < 4.0)
|
206
162
|
regexp_parser (>= 1.8, < 3.0)
|
207
|
-
rexml
|
208
|
-
rubocop-ast (>= 1.
|
163
|
+
rexml (>= 3.2.5, < 4.0)
|
164
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
209
165
|
ruby-progressbar (~> 1.7)
|
210
166
|
unicode-display_width (>= 1.4.0, < 3.0)
|
211
|
-
rubocop-ast (1.
|
212
|
-
parser (>= 3.
|
213
|
-
rubocop-performance (1.
|
167
|
+
rubocop-ast (1.26.0)
|
168
|
+
parser (>= 3.2.1.0)
|
169
|
+
rubocop-performance (1.15.1)
|
214
170
|
rubocop (>= 1.7.0, < 2.0)
|
215
171
|
rubocop-ast (>= 0.4.0)
|
216
172
|
ruby-progressbar (1.11.0)
|
217
173
|
ruby2_keywords (0.0.5)
|
218
|
-
|
219
|
-
addressable (>= 2.3.5)
|
220
|
-
faraday (> 0.8, < 2.0)
|
221
|
-
sprockets (4.0.2)
|
174
|
+
sprockets (4.2.0)
|
222
175
|
concurrent-ruby (~> 1.0)
|
223
|
-
rack (
|
224
|
-
sprockets-rails (3.4.
|
176
|
+
rack (>= 2.2.4, < 4)
|
177
|
+
sprockets-rails (3.4.2)
|
225
178
|
actionpack (>= 5.2)
|
226
179
|
activesupport (>= 5.2)
|
227
180
|
sprockets (>= 3.0.0)
|
228
|
-
sqlite3 (1.
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
181
|
+
sqlite3 (1.6.0-x86_64-darwin)
|
182
|
+
sqlite3 (1.6.0-x86_64-linux)
|
183
|
+
standard (1.19.1)
|
184
|
+
language_server-protocol (~> 3.17.0.2)
|
185
|
+
rubocop (= 1.39.0)
|
186
|
+
rubocop-performance (= 1.15.1)
|
187
|
+
standardrb (1.0.1)
|
233
188
|
standard
|
234
|
-
thor (1.1
|
189
|
+
thor (1.2.1)
|
235
190
|
thread-local (1.1.0)
|
236
|
-
|
237
|
-
tzinfo (2.0.
|
191
|
+
timeout (0.3.1)
|
192
|
+
tzinfo (2.0.6)
|
238
193
|
concurrent-ruby (~> 1.0)
|
239
|
-
unicode-display_width (2.
|
194
|
+
unicode-display_width (2.4.2)
|
240
195
|
websocket-driver (0.7.5)
|
241
196
|
websocket-extensions (>= 0.1.0)
|
242
197
|
websocket-extensions (0.1.5)
|
243
|
-
zeitwerk (2.
|
198
|
+
zeitwerk (2.6.7)
|
244
199
|
|
245
200
|
PLATFORMS
|
201
|
+
x86_64-darwin-19
|
246
202
|
x86_64-linux
|
247
203
|
|
248
204
|
DEPENDENCIES
|
249
205
|
cable_ready!
|
250
|
-
github_changelog_generator
|
251
206
|
magic_frozen_string_literal
|
252
207
|
mocha
|
253
208
|
pry
|
254
209
|
pry-nav
|
210
|
+
rails (~> 6.1)
|
255
211
|
rake
|
256
212
|
sqlite3
|
213
|
+
standard (= 1.19.1)
|
257
214
|
standardrb
|
258
215
|
|
259
216
|
BUNDLED WITH
|
260
|
-
2.
|
217
|
+
2.3.24
|
data/IMPLEMENTATION.md
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
# CableReady Language Implementation Project
|
2
|
+
|
3
|
+
We believe that CableReady can become the universal standard tool for developers to dynamically control client browsers from the server. While the project has roots in the Ruby on Rails community, the JS client is unopinionated about how the simple JSON structure that it consumes was created.
|
4
|
+
|
5
|
+
We would like to announce support for Python, Go, C#, Java, PHP and NodeJS server libraries in early 2022. While there's a broad set of features a server library could implement, there's a baseline that we'd like to make sure all implementations can offer.
|
6
|
+
|
7
|
+
## Background
|
8
|
+
|
9
|
+
CableReady was started in 2017 by Nate Hopkins. It predates LiveView and the HTML-on-the-wire trend by 18 months. It sees roughly 15,000 downloads per week and offers 36 different [operations](https://cableready.stimulusreflex.com/v/v5/reference/operations).
|
10
|
+
|
11
|
+
CableReady is currently a client-side JS module and a server-side Ruby module.
|
12
|
+
|
13
|
+
## Key concepts
|
14
|
+
|
15
|
+
- available everywhere
|
16
|
+
- multiple operations per payload
|
17
|
+
- schemaless
|
18
|
+
- simple JSON wire format
|
19
|
+
- method chaining
|
20
|
+
- transport agnostic
|
21
|
+
- extensible via custom operations
|
22
|
+
|
23
|
+
### Available everywhere
|
24
|
+
|
25
|
+
Rails developers can access a `cable_ready` singleton from just about anywhere in their application, and we believe it's a big part of the secret sauce. While every language and framework has their own idioms, we encourage implementors to remove barriers and make it easy to call CableReady anywhere it could be useful.
|
26
|
+
|
27
|
+
https://cableready.stimulusreflex.com/v/v5/cableready-everywhere
|
28
|
+
|
29
|
+
### Operations and their options
|
30
|
+
|
31
|
+
Operations are the basic atomic unit of activity in CableReady. Each operation typically has a very specific focus and often mimics the DOM JS spec for the activity in question. Operations have options passed to them which specify their exact behavior.
|
32
|
+
|
33
|
+
Multiple operations can be prepared together. They will be executed in the order that they were created. Different operation types can be mixed together in one payload.
|
34
|
+
|
35
|
+
The Ruby implementation offers two interfaces; the (original) primary mechanism delivers the operations to a WebSocket channel in what we refer to as a "broadcast". The other - known as "cable car" - returns a JSON string that can be sent, persisted or displayed for any purpose.
|
36
|
+
|
37
|
+
### Schemaless
|
38
|
+
|
39
|
+
CableReady operations each have their own mandatory and optional options, along with options that are provided to every operation by the library. However, arbitrary additional options can be passed to an operation and they will be passed to the client. This makes it easy for CableReady to form the basis of much larger projects, such as StimulusReflex.
|
40
|
+
|
41
|
+
### JSON wire format
|
42
|
+
|
43
|
+
As of v5.0, the CableReady JSON wire format is an array of objects, where each object represents one operation. It's intentionally very simple.
|
44
|
+
|
45
|
+
```json
|
46
|
+
[{\"message\":\"Hello!\",\"operation\":\"consoleLog\"}]
|
47
|
+
```
|
48
|
+
|
49
|
+
Each operation has **camelCased** key/value pairs that convey options. Every operation must have an `operation` value, or the client will raise an exception.
|
50
|
+
|
51
|
+
### Method chaining
|
52
|
+
|
53
|
+
Developer experience is a high priority. We take pride in the readability and expressiveness offered by our server API. The basic pseudocode structure we provide looks like:
|
54
|
+
|
55
|
+
```rb
|
56
|
+
cable_ready[:foo].operation(options).broadcast
|
57
|
+
```
|
58
|
+
|
59
|
+
In other words, the first method `cable_ready` starts a method chain by returning `self`, and then each operation is a method that also returns the chain started by the initial method. In this way, you can chain together as many operations as you like. Finally, we have a `broadcast` method which takes the current chain and broadcasts it via WebSockets to the `:foo` channel.
|
60
|
+
|
61
|
+
We also have our "cable car" interface which emits JSON when `to_json` is called. This makes it perfect for responding to Ajax fetch requests:
|
62
|
+
|
63
|
+
```rb
|
64
|
+
cable_car.operation(options).to_json
|
65
|
+
```
|
66
|
+
|
67
|
+
The `cable_car` might be assembled in steps, perhaps via a control loop:
|
68
|
+
|
69
|
+
```rb
|
70
|
+
inspiration = cable_car.console_log(message: "Hello there!").dispatch_event(name: "fred", detail: {inspiring: true})
|
71
|
+
3.times do |i|
|
72
|
+
inspiration.console_log(message: "Still here: #{i}")
|
73
|
+
end
|
74
|
+
inspiration.to_json
|
75
|
+
```
|
76
|
+
|
77
|
+
The main expectation that should hold between languages is that you will start the chain with a command, add one or many operation methods, and then execute the chain.
|
78
|
+
|
79
|
+
### Transport agnostic
|
80
|
+
|
81
|
+
CableReady started its life as a WebSocket library, but the neutral JSON format has potential far beyond just WebSocket usage. We now frequently return CableReady JSON payloads via Ajax as well. There's nothing stopping you from embedding payloads into a DOM element attribute, for example.
|
82
|
+
|
83
|
+
We believe that a minimally viable CableReady server library must be able to produce compatible JSON. There's no hard requirement that it interface with WebSockets, although we do find this to be a major sweet spot and will do our best to provide support.
|
84
|
+
|
85
|
+
### Custom operations
|
86
|
+
|
87
|
+
While CableReady ships with an impressive number of operations out of the box, users should be able to add their own operations. Admittedly, the method used to dynamically create all of the methods for each operation is the [most sophisticated](https://github.com/stimulusreflex/cable_ready/blob/master/lib/cable_ready/operation_builder.rb) one in our framework, but again, we're here to help.
|
88
|
+
|
89
|
+
https://cableready.stimulusreflex.com/v/v5/customization#custom-operations
|
90
|
+
|
91
|
+
# Get involved!
|
92
|
+
|
93
|
+
We have a wonderful community with over 1600 folks on our Discord server, helping people get started. Come join https://discord.gg/stimulus-reflex and drop by the #cable_ready channel with any questions.
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<p align="center">
|
2
|
-
<img src="https://
|
2
|
+
<img src="https://raw.githubusercontent.com/stimulusreflex/cable_ready/master/assets/cable-ready-logo-with-copy.svg" width="360" />
|
3
3
|
<h1 align="center">Welcome to CableReady 👋</h1>
|
4
4
|
<p align="center">
|
5
5
|
<a href="https://rubygems.org/gems/cable_ready">
|
@@ -17,10 +17,10 @@
|
|
17
17
|
<a href="http://blog.codinghorror.com/the-best-code-is-no-code-at-all/" target="_blank">
|
18
18
|
<img alt="Lines of Code" src="https://img.shields.io/badge/lines_of_code-1203-brightgreen.svg?style=flat" />
|
19
19
|
</a>
|
20
|
+
<br />
|
20
21
|
<a href="https://cableready.stimulusreflex.com" target="_blank">
|
21
22
|
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
|
22
23
|
</a>
|
23
|
-
<br />
|
24
24
|
<a href="#badge">
|
25
25
|
<img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
|
26
26
|
</a>
|
@@ -31,9 +31,6 @@
|
|
31
31
|
<img alt="JavaScript Code Style" src="https://img.shields.io/badge/JavaScript_Code_Style-prettier_standard-ff69b4.svg" />
|
32
32
|
</a>
|
33
33
|
<br />
|
34
|
-
<a href="https://www.codacy.com/manual/hopsoft/cable_ready/dashboard?utm_source=github.com&utm_medium=referral&utm_content=hopsoft/cable_ready&utm_campaign=Badge_Grade" target="_blank">
|
35
|
-
<img alt="Code Quality" src="https://app.codacy.com/project/badge/Grade/8e6971e3410347eaaa16be2555160b9c"/>
|
36
|
-
</a>
|
37
34
|
<a target="_blank" rel="noopener noreferrer" href="https://github.com/stimulusreflex/cable_ready/workflows/Prettier-Standard/badge.svg">
|
38
35
|
<img src="https://github.com/stimulusreflex/cable_ready/workflows/Prettier-Standard/badge.svg" alt="Prettier-Standard" style="max-width:100%;">
|
39
36
|
</a>
|
@@ -60,12 +57,41 @@ to learn more about ActionCable before proceeding.
|
|
60
57
|
|
61
58
|
## 🚀 Install
|
62
59
|
|
60
|
+
### Rubygem
|
61
|
+
|
63
62
|
```sh
|
64
|
-
bundle add cable_ready
|
63
|
+
bundle add cable_ready
|
65
64
|
```
|
66
65
|
|
67
|
-
|
66
|
+
### JavaScript
|
67
|
+
|
68
|
+
There are a few ways to install the CableReady JavaScript client, depending on your application setup.
|
69
|
+
|
70
|
+
#### ESBuild / Webpacker
|
71
|
+
|
72
|
+
```sh
|
73
|
+
yarn add cable_ready
|
74
|
+
```
|
75
|
+
|
76
|
+
#### Import maps:
|
68
77
|
|
78
|
+
```ruby
|
79
|
+
# config/importmap.rb
|
80
|
+
|
81
|
+
# ...
|
82
|
+
|
83
|
+
pin 'cable_ready', to: 'cable_ready.min.js', preload: true
|
84
|
+
```
|
85
|
+
|
86
|
+
#### Rails Asset pipeline (Sprockets):
|
87
|
+
|
88
|
+
```html+erb
|
89
|
+
<!-- app/views/layouts/application.html.erb -->
|
90
|
+
|
91
|
+
<%= javascript_include_tag "cable_ready.umd.min.js", "data-turbo-track": "reload" %>
|
92
|
+
```
|
93
|
+
|
94
|
+
Checkout the [documentation](https://cableready.stimulusreflex.com) to continue!
|
69
95
|
|
70
96
|
## 🙏 Contributing
|
71
97
|
|
@@ -84,13 +110,13 @@ Please run `./bin/standardize` prior submitting pull requests.
|
|
84
110
|
|
85
111
|
1. Make sure that you run `yarn` and `bundle` to pick up the latest.
|
86
112
|
1. Bump version number at `lib/cable_ready/version.rb`. Pre-release versions use `.preN`
|
87
|
-
1. Run `rake build`
|
113
|
+
1. Run `rake build` and `yarn build`
|
88
114
|
1. Commit and push changes to github
|
89
115
|
1. Run `rake release`
|
90
116
|
1. Run `yarn publish --no-git-tag-version`
|
91
117
|
1. Yarn will prompt you for the new version. Pre-release versions use `-preN`
|
92
|
-
1.
|
93
|
-
1.
|
118
|
+
1. Commit and push changes to GitHub
|
119
|
+
1. Create a new release on GitHub ([here](https://github.com/stimulusreflex/cable_ready/releases)) and generate the changelog for the stable release for it
|
94
120
|
|
95
121
|
## 📝 License
|
96
122
|
|
data/Rakefile
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
|
-
require "github_changelog_generator/task"
|
5
4
|
require "rake/testtask"
|
6
5
|
require "pry"
|
7
6
|
|
@@ -14,10 +13,3 @@ Rake::TestTask.new(:test) do |t|
|
|
14
13
|
t.verbose = true
|
15
14
|
t.warning = false
|
16
15
|
end
|
17
|
-
|
18
|
-
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
19
|
-
config.user = "stimulusreflex"
|
20
|
-
config.project = "cable_ready"
|
21
|
-
config.exclude_labels = %w[duplicate question invalid wontfix nodoc]
|
22
|
-
config.token = ENV["GITHUB_CHANGELOG_GENERATOR_TOKEN"]
|
23
|
-
end
|