cable_ready 4.4.6 → 5.0.0.pre2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +228 -161
  3. data/Gemfile.lock +146 -99
  4. data/LATEST +1 -0
  5. data/README.md +13 -13
  6. data/Rakefile +8 -2
  7. data/app/channels/cable_ready/stream.rb +12 -0
  8. data/app/helpers/cable_ready_helper.rb +11 -0
  9. data/app/jobs/cable_ready_broadcast_job.rb +14 -0
  10. data/bin/standardize +1 -1
  11. data/cable_ready.gemspec +4 -2
  12. data/lib/cable_ready.rb +44 -0
  13. data/lib/cable_ready/broadcaster.rb +3 -4
  14. data/lib/cable_ready/cable_car.rb +17 -0
  15. data/lib/cable_ready/channel.rb +14 -36
  16. data/lib/cable_ready/channels.rb +22 -68
  17. data/lib/cable_ready/compoundable.rb +11 -0
  18. data/lib/cable_ready/config.rb +78 -0
  19. data/lib/cable_ready/identifiable.rb +30 -0
  20. data/lib/cable_ready/operation_builder.rb +83 -0
  21. data/lib/cable_ready/sanity_checker.rb +151 -0
  22. data/lib/cable_ready/stream_identifier.rb +13 -0
  23. data/lib/cable_ready/version.rb +1 -1
  24. data/lib/generators/cable_ready/channel_generator.rb +71 -0
  25. data/lib/generators/cable_ready/initializer_generator.rb +14 -0
  26. data/lib/generators/cable_ready/stream_from_generator.rb +43 -0
  27. data/lib/generators/cable_ready/templates/config/initializers/cable_ready.rb +18 -0
  28. data/package.json +10 -5
  29. data/tags +58 -35
  30. data/test/lib/cable_ready/cable_car_test.rb +50 -0
  31. data/test/lib/cable_ready/identifiable_test.rb +75 -0
  32. data/test/lib/cable_ready/operation_builder_test.rb +211 -0
  33. data/test/lib/generators/cable_ready/channel_generator_test.rb +157 -0
  34. data/test/support/generator_test_helpers.rb +28 -0
  35. data/test/test_helper.rb +15 -0
  36. data/yarn.lock +134 -124
  37. metadata +66 -11
data/Gemfile.lock CHANGED
@@ -1,176 +1,220 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cable_ready (4.4.6)
4
+ cable_ready (5.0.0.pre2)
5
5
  rails (>= 5.2)
6
+ thread-local (>= 1.1.0)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
10
- actioncable (6.1.0)
11
- actionpack (= 6.1.0)
12
- activesupport (= 6.1.0)
11
+ actioncable (6.1.4)
12
+ actionpack (= 6.1.4)
13
+ activesupport (= 6.1.4)
13
14
  nio4r (~> 2.0)
14
15
  websocket-driver (>= 0.6.1)
15
- actionmailbox (6.1.0)
16
- actionpack (= 6.1.0)
17
- activejob (= 6.1.0)
18
- activerecord (= 6.1.0)
19
- activestorage (= 6.1.0)
20
- activesupport (= 6.1.0)
16
+ actionmailbox (6.1.4)
17
+ actionpack (= 6.1.4)
18
+ activejob (= 6.1.4)
19
+ activerecord (= 6.1.4)
20
+ activestorage (= 6.1.4)
21
+ activesupport (= 6.1.4)
21
22
  mail (>= 2.7.1)
22
- actionmailer (6.1.0)
23
- actionpack (= 6.1.0)
24
- actionview (= 6.1.0)
25
- activejob (= 6.1.0)
26
- activesupport (= 6.1.0)
23
+ actionmailer (6.1.4)
24
+ actionpack (= 6.1.4)
25
+ actionview (= 6.1.4)
26
+ activejob (= 6.1.4)
27
+ activesupport (= 6.1.4)
27
28
  mail (~> 2.5, >= 2.5.4)
28
29
  rails-dom-testing (~> 2.0)
29
- actionpack (6.1.0)
30
- actionview (= 6.1.0)
31
- activesupport (= 6.1.0)
30
+ actionpack (6.1.4)
31
+ actionview (= 6.1.4)
32
+ activesupport (= 6.1.4)
32
33
  rack (~> 2.0, >= 2.0.9)
33
34
  rack-test (>= 0.6.3)
34
35
  rails-dom-testing (~> 2.0)
35
36
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
- actiontext (6.1.0)
37
- actionpack (= 6.1.0)
38
- activerecord (= 6.1.0)
39
- activestorage (= 6.1.0)
40
- activesupport (= 6.1.0)
37
+ actiontext (6.1.4)
38
+ actionpack (= 6.1.4)
39
+ activerecord (= 6.1.4)
40
+ activestorage (= 6.1.4)
41
+ activesupport (= 6.1.4)
41
42
  nokogiri (>= 1.8.5)
42
- actionview (6.1.0)
43
- activesupport (= 6.1.0)
43
+ actionview (6.1.4)
44
+ activesupport (= 6.1.4)
44
45
  builder (~> 3.1)
45
46
  erubi (~> 1.4)
46
47
  rails-dom-testing (~> 2.0)
47
48
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
- activejob (6.1.0)
49
- activesupport (= 6.1.0)
49
+ activejob (6.1.4)
50
+ activesupport (= 6.1.4)
50
51
  globalid (>= 0.3.6)
51
- activemodel (6.1.0)
52
- activesupport (= 6.1.0)
53
- activerecord (6.1.0)
54
- activemodel (= 6.1.0)
55
- activesupport (= 6.1.0)
56
- activestorage (6.1.0)
57
- actionpack (= 6.1.0)
58
- activejob (= 6.1.0)
59
- activerecord (= 6.1.0)
60
- activesupport (= 6.1.0)
61
- marcel (~> 0.3.1)
62
- mimemagic (~> 0.3.2)
63
- activesupport (6.1.0)
52
+ activemodel (6.1.4)
53
+ activesupport (= 6.1.4)
54
+ activerecord (6.1.4)
55
+ activemodel (= 6.1.4)
56
+ activesupport (= 6.1.4)
57
+ activestorage (6.1.4)
58
+ actionpack (= 6.1.4)
59
+ activejob (= 6.1.4)
60
+ activerecord (= 6.1.4)
61
+ activesupport (= 6.1.4)
62
+ marcel (~> 1.0.0)
63
+ mini_mime (>= 1.1.0)
64
+ activesupport (6.1.4)
64
65
  concurrent-ruby (~> 1.0, >= 1.0.2)
65
66
  i18n (>= 1.6, < 2)
66
67
  minitest (>= 5.1)
67
68
  tzinfo (~> 2.0)
68
69
  zeitwerk (~> 2.3)
69
- addressable (2.7.0)
70
+ addressable (2.8.0)
70
71
  public_suffix (>= 2.0.2, < 5.0)
71
- ast (2.4.1)
72
+ ast (2.4.2)
73
+ async (1.30.0)
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.8)
90
+ async (>= 1.25)
72
91
  builder (3.2.4)
73
92
  coderay (1.1.3)
74
- concurrent-ruby (1.1.7)
93
+ concurrent-ruby (1.1.9)
94
+ console (1.13.1)
95
+ fiber-local
75
96
  crass (1.0.6)
76
97
  erubi (1.10.0)
77
- faraday (1.1.0)
98
+ faraday (1.5.1)
99
+ faraday-em_http (~> 1.0)
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)
78
106
  multipart-post (>= 1.2, < 3)
79
- ruby2_keywords
107
+ ruby2_keywords (>= 0.0.4)
108
+ faraday-em_http (1.0.0)
109
+ faraday-em_synchrony (1.0.0)
110
+ faraday-excon (1.1.0)
80
111
  faraday-http-cache (2.2.0)
81
112
  faraday (>= 0.8)
82
- github_changelog_generator (1.15.2)
113
+ faraday-httpclient (1.0.1)
114
+ faraday-net_http (1.0.1)
115
+ faraday-net_http_persistent (1.2.0)
116
+ faraday-patron (1.0.0)
117
+ fiber-local (1.0.0)
118
+ github_changelog_generator (1.16.4)
83
119
  activesupport
120
+ async (>= 1.25.0)
121
+ async-http-faraday
84
122
  faraday-http-cache
85
123
  multi_json
86
124
  octokit (~> 4.6)
87
125
  rainbow (>= 2.2.1)
88
126
  rake (>= 10.0)
89
- retriable (~> 3.0)
90
127
  globalid (0.4.2)
91
128
  activesupport (>= 4.2.0)
92
- i18n (1.8.5)
129
+ i18n (1.8.10)
93
130
  concurrent-ruby (~> 1.0)
94
- loofah (2.8.0)
131
+ loofah (2.10.0)
95
132
  crass (~> 1.0.2)
96
133
  nokogiri (>= 1.5.9)
97
134
  magic_frozen_string_literal (1.2.0)
98
135
  mail (2.7.1)
99
136
  mini_mime (>= 0.1.1)
100
- marcel (0.3.3)
101
- mimemagic (~> 0.3.2)
137
+ marcel (1.0.1)
102
138
  method_source (0.9.2)
103
- mimemagic (0.3.5)
104
- mini_mime (1.0.2)
105
- mini_portile2 (2.4.0)
106
- minitest (5.14.2)
139
+ mini_mime (1.1.0)
140
+ mini_portile2 (2.5.3)
141
+ minitest (5.14.4)
142
+ mocha (1.13.0)
107
143
  multi_json (1.15.0)
108
144
  multipart-post (2.1.1)
109
- nio4r (2.5.4)
110
- nokogiri (1.10.10)
111
- mini_portile2 (~> 2.4.0)
112
- octokit (4.19.0)
145
+ nio4r (2.5.7)
146
+ nokogiri (1.11.7)
147
+ mini_portile2 (~> 2.5.0)
148
+ racc (~> 1.4)
149
+ octokit (4.21.0)
113
150
  faraday (>= 0.9)
114
151
  sawyer (~> 0.8.0, >= 0.5.3)
115
152
  parallel (1.20.1)
116
- parser (2.7.2.0)
153
+ parser (3.0.2.0)
117
154
  ast (~> 2.4.1)
155
+ protocol-hpack (1.4.2)
156
+ protocol-http (0.22.5)
157
+ protocol-http1 (0.14.1)
158
+ protocol-http (~> 0.22)
159
+ protocol-http2 (0.14.2)
160
+ protocol-hpack (~> 1.4)
161
+ protocol-http (~> 0.18)
118
162
  pry (0.12.2)
119
163
  coderay (~> 1.1.0)
120
164
  method_source (~> 0.9.0)
121
165
  pry-nav (0.3.0)
122
166
  pry (>= 0.9.10, < 0.13.0)
123
167
  public_suffix (4.0.6)
168
+ racc (1.5.2)
124
169
  rack (2.2.3)
125
170
  rack-test (1.1.0)
126
171
  rack (>= 1.0, < 3)
127
- rails (6.1.0)
128
- actioncable (= 6.1.0)
129
- actionmailbox (= 6.1.0)
130
- actionmailer (= 6.1.0)
131
- actionpack (= 6.1.0)
132
- actiontext (= 6.1.0)
133
- actionview (= 6.1.0)
134
- activejob (= 6.1.0)
135
- activemodel (= 6.1.0)
136
- activerecord (= 6.1.0)
137
- activestorage (= 6.1.0)
138
- activesupport (= 6.1.0)
172
+ rails (6.1.4)
173
+ actioncable (= 6.1.4)
174
+ actionmailbox (= 6.1.4)
175
+ actionmailer (= 6.1.4)
176
+ actionpack (= 6.1.4)
177
+ actiontext (= 6.1.4)
178
+ actionview (= 6.1.4)
179
+ activejob (= 6.1.4)
180
+ activemodel (= 6.1.4)
181
+ activerecord (= 6.1.4)
182
+ activestorage (= 6.1.4)
183
+ activesupport (= 6.1.4)
139
184
  bundler (>= 1.15.0)
140
- railties (= 6.1.0)
185
+ railties (= 6.1.4)
141
186
  sprockets-rails (>= 2.0.0)
142
187
  rails-dom-testing (2.0.3)
143
188
  activesupport (>= 4.2.0)
144
189
  nokogiri (>= 1.6)
145
190
  rails-html-sanitizer (1.3.0)
146
191
  loofah (~> 2.3)
147
- railties (6.1.0)
148
- actionpack (= 6.1.0)
149
- activesupport (= 6.1.0)
192
+ railties (6.1.4)
193
+ actionpack (= 6.1.4)
194
+ activesupport (= 6.1.4)
150
195
  method_source
151
- rake (>= 0.8.7)
196
+ rake (>= 0.13)
152
197
  thor (~> 1.0)
153
198
  rainbow (3.0.0)
154
- rake (13.0.1)
155
- regexp_parser (2.0.0)
156
- retriable (3.1.2)
157
- rexml (3.2.4)
158
- rubocop (1.4.2)
199
+ rake (13.0.6)
200
+ regexp_parser (2.1.1)
201
+ rexml (3.2.5)
202
+ rubocop (1.18.3)
159
203
  parallel (~> 1.10)
160
- parser (>= 2.7.1.5)
204
+ parser (>= 3.0.0.0)
161
205
  rainbow (>= 2.2.2, < 4.0)
162
- regexp_parser (>= 1.8)
206
+ regexp_parser (>= 1.8, < 3.0)
163
207
  rexml
164
- rubocop-ast (>= 1.1.1)
208
+ rubocop-ast (>= 1.7.0, < 2.0)
165
209
  ruby-progressbar (~> 1.7)
166
- unicode-display_width (>= 1.4.0, < 2.0)
167
- rubocop-ast (1.3.0)
168
- parser (>= 2.7.1.5)
169
- rubocop-performance (1.9.1)
170
- rubocop (>= 0.90.0, < 2.0)
210
+ unicode-display_width (>= 1.4.0, < 3.0)
211
+ rubocop-ast (1.8.0)
212
+ parser (>= 3.0.1.1)
213
+ rubocop-performance (1.11.4)
214
+ rubocop (>= 1.7.0, < 2.0)
171
215
  rubocop-ast (>= 0.4.0)
172
- ruby-progressbar (1.10.1)
173
- ruby2_keywords (0.0.2)
216
+ ruby-progressbar (1.11.0)
217
+ ruby2_keywords (0.0.5)
174
218
  sawyer (0.8.2)
175
219
  addressable (>= 2.3.5)
176
220
  faraday (> 0.8, < 2.0)
@@ -181,16 +225,18 @@ GEM
181
225
  actionpack (>= 4.0)
182
226
  activesupport (>= 4.0)
183
227
  sprockets (>= 3.0.0)
184
- standard (0.10.2)
185
- rubocop (= 1.4.2)
186
- rubocop-performance (= 1.9.1)
228
+ standard (1.1.5)
229
+ rubocop (= 1.18.3)
230
+ rubocop-performance (= 1.11.4)
187
231
  standardrb (1.0.0)
188
232
  standard
189
- thor (1.0.1)
233
+ thor (1.1.0)
234
+ thread-local (1.1.0)
235
+ timers (4.3.3)
190
236
  tzinfo (2.0.4)
191
237
  concurrent-ruby (~> 1.0)
192
- unicode-display_width (1.7.0)
193
- websocket-driver (0.7.3)
238
+ unicode-display_width (2.0.0)
239
+ websocket-driver (0.7.5)
194
240
  websocket-extensions (>= 0.1.0)
195
241
  websocket-extensions (0.1.5)
196
242
  zeitwerk (2.4.2)
@@ -202,10 +248,11 @@ DEPENDENCIES
202
248
  cable_ready!
203
249
  github_changelog_generator
204
250
  magic_frozen_string_literal
251
+ mocha
205
252
  pry
206
253
  pry-nav
207
254
  rake
208
255
  standardrb
209
256
 
210
257
  BUNDLED WITH
211
- 2.1.4
258
+ 2.2.19
data/LATEST ADDED
@@ -0,0 +1 @@
1
+ 4.5.0
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="https://gitcdn.link/repo/hopsoft/cable_ready/master/assets/cable-ready-logo-with-copy.svg" width="360" />
2
+ <img src="https://gitcdn.link/repo/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
  <img src="https://img.shields.io/gem/v/cable_ready.svg?color=red" />
@@ -7,11 +7,11 @@
7
7
  <a href="https://www.npmjs.com/package/cable_ready">
8
8
  <img alt="downloads" src="https://img.shields.io/npm/dm/cable_ready.svg?color=blue" target="_blank" />
9
9
  </a>
10
- <a href="https://github.com/hopsoft/cable_ready/blob/master/LICENSE">
10
+ <a href="https://github.com/stimulusreflex/cable_ready/blob/master/LICENSE">
11
11
  <img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-brightgreen.svg" target="_blank" />
12
12
  </a>
13
13
  <a href="http://blog.codinghorror.com/the-best-code-is-no-code-at-all/" target="_blank">
14
- <img alt="Lines of Code" src="https://img.shields.io/badge/lines_of_code-483-brightgreen.svg?style=flat" />
14
+ <img alt="Lines of Code" src="https://img.shields.io/badge/lines_of_code-1203-brightgreen.svg?style=flat" />
15
15
  </a>
16
16
  <a href="https://cableready.stimulusreflex.com" target="_blank">
17
17
  <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
@@ -30,11 +30,11 @@
30
30
  <a href="https://www.codacy.com/manual/hopsoft/cable_ready/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=hopsoft/cable_ready&amp;utm_campaign=Badge_Grade" target="_blank">
31
31
  <img alt="Code Quality" src="https://app.codacy.com/project/badge/Grade/8e6971e3410347eaaa16be2555160b9c"/>
32
32
  </a>
33
- <a target="_blank" rel="noopener noreferrer" href="https://github.com/hopsoft/cable_ready/workflows/Prettier-Standard/badge.svg">
34
- <img src="https://github.com/hopsoft/cable_ready/workflows/Prettier-Standard/badge.svg" alt="Prettier-Standard" style="max-width:100%;">
33
+ <a target="_blank" rel="noopener noreferrer" href="https://github.com/stimulusreflex/cable_ready/workflows/Prettier-Standard/badge.svg">
34
+ <img src="https://github.com/stimulusreflex/cable_ready/workflows/Prettier-Standard/badge.svg" alt="Prettier-Standard" style="max-width:100%;">
35
35
  </a>
36
- <a target="_blank" rel="noopener noreferrer" href="https://github.com/hopsoft/cable_ready/workflows/StandardRB/badge.svg">
37
- <img src="https://github.com/hopsoft/cable_ready/workflows/StandardRB/badge.svg" alt="StandardRB" style="max-width:100%;">
36
+ <a target="_blank" rel="noopener noreferrer" href="https://github.com/stimulusreflex/cable_ready/workflows/StandardRB/badge.svg">
37
+ <img src="https://github.com/stimulusreflex/cable_ready/workflows/StandardRB/badge.svg" alt="StandardRB" style="max-width:100%;">
38
38
  </a>
39
39
  </p>
40
40
  </p>
@@ -48,11 +48,11 @@ to learn more about ActionCable before proceeding.
48
48
  ## 📚 Docs
49
49
 
50
50
  - [Official Documentation](https://cableready.stimulusreflex.com)
51
- - [Documentation Source Code](https://github.com/hopsoft/cable_ready/tree/master/docs)
51
+ - [Documentation Source Code](https://github.com/stimulusreflex/cable_ready/tree/master/docs)
52
52
 
53
53
  ## 💙 Community
54
54
 
55
- - [Discord](https://discord.gg/XveN625) - chat root
55
+ - [Discord](https://discord.gg/stimulus-reflex) - primary support channel
56
56
 
57
57
  ## 🚀 Install
58
58
 
@@ -79,10 +79,10 @@ Please run `./bin/standardize` prior submitting pull requests.
79
79
  ### 📦 Releasing
80
80
 
81
81
  1. Bump version number at `lib/cable_ready/version.rb`
82
- 1. Run `rake build`
83
- 1. Run `rake release`
84
- 1. Run `yarn publish --no-git-tag-version`
85
- 1. Commit and push changes to the `package.json` file
82
+ 2. Run `rake build`
83
+ 3. Run `rake release`
84
+ 4. Run `yarn publish --no-git-tag-version`
85
+ 5. Commit and push changes to the `package.json` file
86
86
 
87
87
  ## 📝 License
88
88
 
data/Rakefile CHANGED
@@ -2,11 +2,17 @@
2
2
 
3
3
  require "bundler/gem_tasks"
4
4
  require "github_changelog_generator/task"
5
+ require "rake/testtask"
6
+ require "pry"
5
7
 
6
8
  task default: [:test]
7
9
 
8
- task :test do
9
- puts "Please write some tests..."
10
+ Rake::TestTask.new(:test) do |t|
11
+ t.libs << "lib"
12
+ t.libs << "test"
13
+ t.pattern = "test/**/*_test.rb"
14
+ t.verbose = true
15
+ t.warning = false
10
16
  end
11
17
 
12
18
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CableReady
4
+ class Stream < ActionCable::Channel::Base
5
+ include CableReady::StreamIdentifier
6
+
7
+ def subscribed
8
+ locator = verified_stream_identifier(params[:identifier])
9
+ locator.present? ? stream_from(locator) : reject
10
+ end
11
+ end
12
+ end