cable_ready 4.4.3 → 5.0.0.pre1

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 +238 -155
  3. data/Gemfile.lock +144 -100
  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/lib/cable_ready.rb +41 -0
  12. data/lib/cable_ready/broadcaster.rb +3 -4
  13. data/lib/cable_ready/cable_car.rb +17 -0
  14. data/lib/cable_ready/channel.rb +14 -36
  15. data/lib/cable_ready/channels.rb +22 -65
  16. data/lib/cable_ready/compoundable.rb +11 -0
  17. data/lib/cable_ready/config.rb +78 -0
  18. data/lib/cable_ready/identifiable.rb +19 -0
  19. data/lib/cable_ready/operation_builder.rb +69 -0
  20. data/lib/cable_ready/sanity_checker.rb +151 -0
  21. data/lib/cable_ready/stream_identifier.rb +13 -0
  22. data/lib/cable_ready/version.rb +1 -1
  23. data/lib/generators/cable_ready/channel_generator.rb +71 -0
  24. data/lib/generators/cable_ready/initializer_generator.rb +14 -0
  25. data/lib/generators/cable_ready/stream_from_generator.rb +43 -0
  26. data/lib/generators/cable_ready/templates/config/initializers/cable_ready.rb +18 -0
  27. data/test/lib/cable_ready/cable_car_test.rb +28 -0
  28. data/test/lib/cable_ready/identifiable_test.rb +75 -0
  29. data/test/lib/cable_ready/operation_builder_test.rb +128 -0
  30. data/test/lib/generators/cable_ready/channel_generator_test.rb +157 -0
  31. data/test/support/generator_test_helpers.rb +28 -0
  32. data/test/test_helper.rb +15 -0
  33. metadata +66 -15
  34. data/cable_ready.gemspec +0 -25
  35. data/package.json +0 -36
  36. data/tags +0 -57
  37. data/yarn.lock +0 -2552
data/Gemfile.lock CHANGED
@@ -1,82 +1,116 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cable_ready (4.4.3)
4
+ cable_ready (5.0.0.pre0)
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.0.3.4)
11
- actionpack (= 6.0.3.4)
11
+ actioncable (6.1.3.2)
12
+ actionpack (= 6.1.3.2)
13
+ activesupport (= 6.1.3.2)
12
14
  nio4r (~> 2.0)
13
15
  websocket-driver (>= 0.6.1)
14
- actionmailbox (6.0.3.4)
15
- actionpack (= 6.0.3.4)
16
- activejob (= 6.0.3.4)
17
- activerecord (= 6.0.3.4)
18
- activestorage (= 6.0.3.4)
19
- activesupport (= 6.0.3.4)
16
+ actionmailbox (6.1.3.2)
17
+ actionpack (= 6.1.3.2)
18
+ activejob (= 6.1.3.2)
19
+ activerecord (= 6.1.3.2)
20
+ activestorage (= 6.1.3.2)
21
+ activesupport (= 6.1.3.2)
20
22
  mail (>= 2.7.1)
21
- actionmailer (6.0.3.4)
22
- actionpack (= 6.0.3.4)
23
- actionview (= 6.0.3.4)
24
- activejob (= 6.0.3.4)
23
+ actionmailer (6.1.3.2)
24
+ actionpack (= 6.1.3.2)
25
+ actionview (= 6.1.3.2)
26
+ activejob (= 6.1.3.2)
27
+ activesupport (= 6.1.3.2)
25
28
  mail (~> 2.5, >= 2.5.4)
26
29
  rails-dom-testing (~> 2.0)
27
- actionpack (6.0.3.4)
28
- actionview (= 6.0.3.4)
29
- activesupport (= 6.0.3.4)
30
- rack (~> 2.0, >= 2.0.8)
30
+ actionpack (6.1.3.2)
31
+ actionview (= 6.1.3.2)
32
+ activesupport (= 6.1.3.2)
33
+ rack (~> 2.0, >= 2.0.9)
31
34
  rack-test (>= 0.6.3)
32
35
  rails-dom-testing (~> 2.0)
33
36
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
34
- actiontext (6.0.3.4)
35
- actionpack (= 6.0.3.4)
36
- activerecord (= 6.0.3.4)
37
- activestorage (= 6.0.3.4)
38
- activesupport (= 6.0.3.4)
37
+ actiontext (6.1.3.2)
38
+ actionpack (= 6.1.3.2)
39
+ activerecord (= 6.1.3.2)
40
+ activestorage (= 6.1.3.2)
41
+ activesupport (= 6.1.3.2)
39
42
  nokogiri (>= 1.8.5)
40
- actionview (6.0.3.4)
41
- activesupport (= 6.0.3.4)
43
+ actionview (6.1.3.2)
44
+ activesupport (= 6.1.3.2)
42
45
  builder (~> 3.1)
43
46
  erubi (~> 1.4)
44
47
  rails-dom-testing (~> 2.0)
45
48
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
46
- activejob (6.0.3.4)
47
- activesupport (= 6.0.3.4)
49
+ activejob (6.1.3.2)
50
+ activesupport (= 6.1.3.2)
48
51
  globalid (>= 0.3.6)
49
- activemodel (6.0.3.4)
50
- activesupport (= 6.0.3.4)
51
- activerecord (6.0.3.4)
52
- activemodel (= 6.0.3.4)
53
- activesupport (= 6.0.3.4)
54
- activestorage (6.0.3.4)
55
- actionpack (= 6.0.3.4)
56
- activejob (= 6.0.3.4)
57
- activerecord (= 6.0.3.4)
58
- marcel (~> 0.3.1)
59
- activesupport (6.0.3.4)
52
+ activemodel (6.1.3.2)
53
+ activesupport (= 6.1.3.2)
54
+ activerecord (6.1.3.2)
55
+ activemodel (= 6.1.3.2)
56
+ activesupport (= 6.1.3.2)
57
+ activestorage (6.1.3.2)
58
+ actionpack (= 6.1.3.2)
59
+ activejob (= 6.1.3.2)
60
+ activerecord (= 6.1.3.2)
61
+ activesupport (= 6.1.3.2)
62
+ marcel (~> 1.0.0)
63
+ mini_mime (~> 1.0.2)
64
+ activesupport (6.1.3.2)
60
65
  concurrent-ruby (~> 1.0, >= 1.0.2)
61
- i18n (>= 0.7, < 2)
62
- minitest (~> 5.1)
63
- tzinfo (~> 1.1)
64
- zeitwerk (~> 2.2, >= 2.2.2)
66
+ i18n (>= 1.6, < 2)
67
+ minitest (>= 5.1)
68
+ tzinfo (~> 2.0)
69
+ zeitwerk (~> 2.3)
65
70
  addressable (2.7.0)
66
71
  public_suffix (>= 2.0.2, < 5.0)
67
- ast (2.4.1)
72
+ ast (2.4.2)
73
+ async (1.29.0)
74
+ console (~> 1.10)
75
+ nio4r (~> 2.3)
76
+ timers (~> 4.1)
77
+ async-http (0.56.2)
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.9.0)
85
+ async-http (~> 0.42)
86
+ faraday
87
+ async-io (1.31.0)
88
+ async (~> 1.14)
89
+ async-pool (0.3.6)
90
+ async (~> 1.25)
68
91
  builder (3.2.4)
69
92
  coderay (1.1.3)
70
- concurrent-ruby (1.1.7)
93
+ concurrent-ruby (1.1.8)
94
+ console (1.12.0)
95
+ fiber-local
71
96
  crass (1.0.6)
72
97
  erubi (1.10.0)
73
- faraday (1.1.0)
98
+ faraday (1.4.1)
99
+ faraday-excon (~> 1.1)
100
+ faraday-net_http (~> 1.0)
101
+ faraday-net_http_persistent (~> 1.1)
74
102
  multipart-post (>= 1.2, < 3)
75
- ruby2_keywords
103
+ ruby2_keywords (>= 0.0.4)
104
+ faraday-excon (1.1.0)
76
105
  faraday-http-cache (2.2.0)
77
106
  faraday (>= 0.8)
78
- github_changelog_generator (1.15.2)
107
+ faraday-net_http (1.0.1)
108
+ faraday-net_http_persistent (1.1.0)
109
+ fiber-local (1.0.0)
110
+ github_changelog_generator (1.16.3)
79
111
  activesupport
112
+ async (>= 1.25.0)
113
+ async-http-faraday
80
114
  faraday-http-cache
81
115
  multi_json
82
116
  octokit (~> 4.6)
@@ -85,88 +119,96 @@ GEM
85
119
  retriable (~> 3.0)
86
120
  globalid (0.4.2)
87
121
  activesupport (>= 4.2.0)
88
- i18n (1.8.5)
122
+ i18n (1.8.10)
89
123
  concurrent-ruby (~> 1.0)
90
- loofah (2.8.0)
124
+ loofah (2.9.1)
91
125
  crass (~> 1.0.2)
92
126
  nokogiri (>= 1.5.9)
93
127
  magic_frozen_string_literal (1.2.0)
94
128
  mail (2.7.1)
95
129
  mini_mime (>= 0.1.1)
96
- marcel (0.3.3)
97
- mimemagic (~> 0.3.2)
130
+ marcel (1.0.1)
98
131
  method_source (0.9.2)
99
- mimemagic (0.3.5)
100
- mini_mime (1.0.2)
101
- mini_portile2 (2.4.0)
102
- minitest (5.14.2)
132
+ mini_mime (1.0.3)
133
+ mini_portile2 (2.5.1)
134
+ minitest (5.14.4)
135
+ mocha (1.12.0)
103
136
  multi_json (1.15.0)
104
137
  multipart-post (2.1.1)
105
- nio4r (2.5.4)
106
- nokogiri (1.10.10)
107
- mini_portile2 (~> 2.4.0)
108
- octokit (4.19.0)
138
+ nio4r (2.5.7)
139
+ nokogiri (1.11.5)
140
+ mini_portile2 (~> 2.5.0)
141
+ racc (~> 1.4)
142
+ octokit (4.21.0)
109
143
  faraday (>= 0.9)
110
144
  sawyer (~> 0.8.0, >= 0.5.3)
111
145
  parallel (1.20.1)
112
- parser (2.7.2.0)
146
+ parser (3.0.1.1)
113
147
  ast (~> 2.4.1)
148
+ protocol-hpack (1.4.2)
149
+ protocol-http (0.22.0)
150
+ protocol-http1 (0.14.1)
151
+ protocol-http (~> 0.22)
152
+ protocol-http2 (0.14.2)
153
+ protocol-hpack (~> 1.4)
154
+ protocol-http (~> 0.18)
114
155
  pry (0.12.2)
115
156
  coderay (~> 1.1.0)
116
157
  method_source (~> 0.9.0)
117
158
  pry-nav (0.3.0)
118
159
  pry (>= 0.9.10, < 0.13.0)
119
160
  public_suffix (4.0.6)
161
+ racc (1.5.2)
120
162
  rack (2.2.3)
121
163
  rack-test (1.1.0)
122
164
  rack (>= 1.0, < 3)
123
- rails (6.0.3.4)
124
- actioncable (= 6.0.3.4)
125
- actionmailbox (= 6.0.3.4)
126
- actionmailer (= 6.0.3.4)
127
- actionpack (= 6.0.3.4)
128
- actiontext (= 6.0.3.4)
129
- actionview (= 6.0.3.4)
130
- activejob (= 6.0.3.4)
131
- activemodel (= 6.0.3.4)
132
- activerecord (= 6.0.3.4)
133
- activestorage (= 6.0.3.4)
134
- activesupport (= 6.0.3.4)
135
- bundler (>= 1.3.0)
136
- railties (= 6.0.3.4)
165
+ rails (6.1.3.2)
166
+ actioncable (= 6.1.3.2)
167
+ actionmailbox (= 6.1.3.2)
168
+ actionmailer (= 6.1.3.2)
169
+ actionpack (= 6.1.3.2)
170
+ actiontext (= 6.1.3.2)
171
+ actionview (= 6.1.3.2)
172
+ activejob (= 6.1.3.2)
173
+ activemodel (= 6.1.3.2)
174
+ activerecord (= 6.1.3.2)
175
+ activestorage (= 6.1.3.2)
176
+ activesupport (= 6.1.3.2)
177
+ bundler (>= 1.15.0)
178
+ railties (= 6.1.3.2)
137
179
  sprockets-rails (>= 2.0.0)
138
180
  rails-dom-testing (2.0.3)
139
181
  activesupport (>= 4.2.0)
140
182
  nokogiri (>= 1.6)
141
183
  rails-html-sanitizer (1.3.0)
142
184
  loofah (~> 2.3)
143
- railties (6.0.3.4)
144
- actionpack (= 6.0.3.4)
145
- activesupport (= 6.0.3.4)
185
+ railties (6.1.3.2)
186
+ actionpack (= 6.1.3.2)
187
+ activesupport (= 6.1.3.2)
146
188
  method_source
147
189
  rake (>= 0.8.7)
148
- thor (>= 0.20.3, < 2.0)
190
+ thor (~> 1.0)
149
191
  rainbow (3.0.0)
150
- rake (13.0.1)
151
- regexp_parser (2.0.0)
192
+ rake (13.0.3)
193
+ regexp_parser (2.1.1)
152
194
  retriable (3.1.2)
153
- rexml (3.2.4)
154
- rubocop (1.4.2)
195
+ rexml (3.2.5)
196
+ rubocop (1.14.0)
155
197
  parallel (~> 1.10)
156
- parser (>= 2.7.1.5)
198
+ parser (>= 3.0.0.0)
157
199
  rainbow (>= 2.2.2, < 4.0)
158
- regexp_parser (>= 1.8)
200
+ regexp_parser (>= 1.8, < 3.0)
159
201
  rexml
160
- rubocop-ast (>= 1.1.1)
202
+ rubocop-ast (>= 1.5.0, < 2.0)
161
203
  ruby-progressbar (~> 1.7)
162
- unicode-display_width (>= 1.4.0, < 2.0)
163
- rubocop-ast (1.2.0)
164
- parser (>= 2.7.1.5)
165
- rubocop-performance (1.9.1)
166
- rubocop (>= 0.90.0, < 2.0)
204
+ unicode-display_width (>= 1.4.0, < 3.0)
205
+ rubocop-ast (1.5.0)
206
+ parser (>= 3.0.1.1)
207
+ rubocop-performance (1.11.2)
208
+ rubocop (>= 1.7.0, < 2.0)
167
209
  rubocop-ast (>= 0.4.0)
168
- ruby-progressbar (1.10.1)
169
- ruby2_keywords (0.0.2)
210
+ ruby-progressbar (1.11.0)
211
+ ruby2_keywords (0.0.4)
170
212
  sawyer (0.8.2)
171
213
  addressable (>= 2.3.5)
172
214
  faraday (> 0.8, < 2.0)
@@ -177,16 +219,17 @@ GEM
177
219
  actionpack (>= 4.0)
178
220
  activesupport (>= 4.0)
179
221
  sprockets (>= 3.0.0)
180
- standard (0.10.1)
181
- rubocop (= 1.4.2)
182
- rubocop-performance (= 1.9.1)
222
+ standard (1.1.1)
223
+ rubocop (= 1.14.0)
224
+ rubocop-performance (= 1.11.2)
183
225
  standardrb (1.0.0)
184
226
  standard
185
- thor (1.0.1)
186
- thread_safe (0.3.6)
187
- tzinfo (1.2.8)
188
- thread_safe (~> 0.1)
189
- unicode-display_width (1.7.0)
227
+ thor (1.1.0)
228
+ thread-local (1.1.0)
229
+ timers (4.3.3)
230
+ tzinfo (2.0.4)
231
+ concurrent-ruby (~> 1.0)
232
+ unicode-display_width (2.0.0)
190
233
  websocket-driver (0.7.3)
191
234
  websocket-extensions (>= 0.1.0)
192
235
  websocket-extensions (0.1.5)
@@ -199,10 +242,11 @@ DEPENDENCIES
199
242
  cable_ready!
200
243
  github_changelog_generator
201
244
  magic_frozen_string_literal
245
+ mocha
202
246
  pry
203
247
  pry-nav
204
248
  rake
205
249
  standardrb
206
250
 
207
251
  BUNDLED WITH
208
- 2.1.4
252
+ 2.2.3
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-427-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
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CableReadyHelper
4
+ include CableReady::Compoundable
5
+ include CableReady::StreamIdentifier
6
+
7
+ def stream_from(*keys)
8
+ keys.select!(&:itself)
9
+ tag.stream_from(identifier: signed_stream_identifier(compound(keys)))
10
+ end
11
+ end