cable_ready 4.5.0 → 5.0.0.pre3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +260 -161
  3. data/Gemfile.lock +141 -96
  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 +3 -2
  12. data/lib/cable_ready.rb +40 -5
  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 +12 -32
  16. data/lib/cable_ready/channels.rb +4 -7
  17. data/lib/cable_ready/compoundable.rb +11 -0
  18. data/lib/cable_ready/config.rb +17 -5
  19. data/lib/cable_ready/identifiable.rb +30 -0
  20. data/lib/cable_ready/operation_builder.rb +80 -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/test/lib/cable_ready/cable_car_test.rb +50 -0
  30. data/test/lib/cable_ready/identifiable_test.rb +75 -0
  31. data/test/lib/cable_ready/operation_builder_test.rb +189 -0
  32. data/test/lib/generators/cable_ready/channel_generator_test.rb +157 -0
  33. data/test/support/generator_test_helpers.rb +28 -0
  34. data/test/test_helper.rb +15 -0
  35. data/yarn.lock +137 -127
  36. metadata +47 -8
  37. data/tags +0 -62
data/Gemfile.lock CHANGED
@@ -1,122 +1,166 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cable_ready (4.5.0)
4
+ cable_ready (5.0.0.pre3)
5
5
  rails (>= 5.2)
6
6
  thread-local (>= 1.1.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (6.1.1)
12
- actionpack (= 6.1.1)
13
- activesupport (= 6.1.1)
11
+ actioncable (6.1.4.1)
12
+ actionpack (= 6.1.4.1)
13
+ activesupport (= 6.1.4.1)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (6.1.1)
17
- actionpack (= 6.1.1)
18
- activejob (= 6.1.1)
19
- activerecord (= 6.1.1)
20
- activestorage (= 6.1.1)
21
- activesupport (= 6.1.1)
16
+ actionmailbox (6.1.4.1)
17
+ actionpack (= 6.1.4.1)
18
+ activejob (= 6.1.4.1)
19
+ activerecord (= 6.1.4.1)
20
+ activestorage (= 6.1.4.1)
21
+ activesupport (= 6.1.4.1)
22
22
  mail (>= 2.7.1)
23
- actionmailer (6.1.1)
24
- actionpack (= 6.1.1)
25
- actionview (= 6.1.1)
26
- activejob (= 6.1.1)
27
- activesupport (= 6.1.1)
23
+ actionmailer (6.1.4.1)
24
+ actionpack (= 6.1.4.1)
25
+ actionview (= 6.1.4.1)
26
+ activejob (= 6.1.4.1)
27
+ activesupport (= 6.1.4.1)
28
28
  mail (~> 2.5, >= 2.5.4)
29
29
  rails-dom-testing (~> 2.0)
30
- actionpack (6.1.1)
31
- actionview (= 6.1.1)
32
- activesupport (= 6.1.1)
30
+ actionpack (6.1.4.1)
31
+ actionview (= 6.1.4.1)
32
+ activesupport (= 6.1.4.1)
33
33
  rack (~> 2.0, >= 2.0.9)
34
34
  rack-test (>= 0.6.3)
35
35
  rails-dom-testing (~> 2.0)
36
36
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
- actiontext (6.1.1)
38
- actionpack (= 6.1.1)
39
- activerecord (= 6.1.1)
40
- activestorage (= 6.1.1)
41
- activesupport (= 6.1.1)
37
+ actiontext (6.1.4.1)
38
+ actionpack (= 6.1.4.1)
39
+ activerecord (= 6.1.4.1)
40
+ activestorage (= 6.1.4.1)
41
+ activesupport (= 6.1.4.1)
42
42
  nokogiri (>= 1.8.5)
43
- actionview (6.1.1)
44
- activesupport (= 6.1.1)
43
+ actionview (6.1.4.1)
44
+ activesupport (= 6.1.4.1)
45
45
  builder (~> 3.1)
46
46
  erubi (~> 1.4)
47
47
  rails-dom-testing (~> 2.0)
48
48
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
- activejob (6.1.1)
50
- activesupport (= 6.1.1)
49
+ activejob (6.1.4.1)
50
+ activesupport (= 6.1.4.1)
51
51
  globalid (>= 0.3.6)
52
- activemodel (6.1.1)
53
- activesupport (= 6.1.1)
54
- activerecord (6.1.1)
55
- activemodel (= 6.1.1)
56
- activesupport (= 6.1.1)
57
- activestorage (6.1.1)
58
- actionpack (= 6.1.1)
59
- activejob (= 6.1.1)
60
- activerecord (= 6.1.1)
61
- activesupport (= 6.1.1)
62
- marcel (~> 0.3.1)
63
- mimemagic (~> 0.3.2)
64
- activesupport (6.1.1)
52
+ activemodel (6.1.4.1)
53
+ activesupport (= 6.1.4.1)
54
+ activerecord (6.1.4.1)
55
+ activemodel (= 6.1.4.1)
56
+ activesupport (= 6.1.4.1)
57
+ activestorage (6.1.4.1)
58
+ actionpack (= 6.1.4.1)
59
+ activejob (= 6.1.4.1)
60
+ activerecord (= 6.1.4.1)
61
+ activesupport (= 6.1.4.1)
62
+ marcel (~> 1.0.0)
63
+ mini_mime (>= 1.1.0)
64
+ activesupport (6.1.4.1)
65
65
  concurrent-ruby (~> 1.0, >= 1.0.2)
66
66
  i18n (>= 1.6, < 2)
67
67
  minitest (>= 5.1)
68
68
  tzinfo (~> 2.0)
69
69
  zeitwerk (~> 2.3)
70
- addressable (2.7.0)
70
+ addressable (2.8.0)
71
71
  public_suffix (>= 2.0.2, < 5.0)
72
72
  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.8)
90
+ async (>= 1.25)
73
91
  builder (3.2.4)
74
92
  coderay (1.1.3)
75
- concurrent-ruby (1.1.8)
93
+ concurrent-ruby (1.1.9)
94
+ console (1.13.1)
95
+ fiber-local
76
96
  crass (1.0.6)
77
97
  erubi (1.10.0)
78
- faraday (1.3.0)
98
+ faraday (1.7.0)
99
+ faraday-em_http (~> 1.0)
100
+ faraday-em_synchrony (~> 1.0)
101
+ faraday-excon (~> 1.1)
102
+ faraday-httpclient (~> 1.0.1)
79
103
  faraday-net_http (~> 1.0)
104
+ faraday-net_http_persistent (~> 1.1)
105
+ faraday-patron (~> 1.0)
106
+ faraday-rack (~> 1.0)
80
107
  multipart-post (>= 1.2, < 3)
81
- ruby2_keywords
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)
82
112
  faraday-http-cache (2.2.0)
83
113
  faraday (>= 0.8)
114
+ faraday-httpclient (1.0.1)
84
115
  faraday-net_http (1.0.1)
85
- github_changelog_generator (1.15.2)
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)
86
121
  activesupport
122
+ async (>= 1.25.0)
123
+ async-http-faraday
87
124
  faraday-http-cache
88
125
  multi_json
89
126
  octokit (~> 4.6)
90
127
  rainbow (>= 2.2.1)
91
128
  rake (>= 10.0)
92
- retriable (~> 3.0)
93
- globalid (0.4.2)
94
- activesupport (>= 4.2.0)
95
- i18n (1.8.7)
129
+ globalid (0.5.2)
130
+ activesupport (>= 5.0)
131
+ i18n (1.8.10)
96
132
  concurrent-ruby (~> 1.0)
97
- loofah (2.9.0)
133
+ loofah (2.12.0)
98
134
  crass (~> 1.0.2)
99
135
  nokogiri (>= 1.5.9)
100
136
  magic_frozen_string_literal (1.2.0)
101
137
  mail (2.7.1)
102
138
  mini_mime (>= 0.1.1)
103
- marcel (0.3.3)
104
- mimemagic (~> 0.3.2)
139
+ marcel (1.0.1)
105
140
  method_source (0.9.2)
106
- mimemagic (0.3.5)
107
- mini_mime (1.0.2)
108
- minitest (5.14.3)
141
+ mini_mime (1.1.0)
142
+ mini_portile2 (2.6.1)
143
+ minitest (5.14.4)
144
+ mocha (1.13.0)
109
145
  multi_json (1.15.0)
110
146
  multipart-post (2.1.1)
111
- nio4r (2.5.4)
112
- nokogiri (1.11.1-x86_64-darwin)
147
+ nio4r (2.5.8)
148
+ nokogiri (1.12.3)
149
+ mini_portile2 (~> 2.6.1)
113
150
  racc (~> 1.4)
114
- octokit (4.20.0)
151
+ octokit (4.21.0)
115
152
  faraday (>= 0.9)
116
153
  sawyer (~> 0.8.0, >= 0.5.3)
117
154
  parallel (1.20.1)
118
- parser (3.0.0.0)
155
+ parser (3.0.2.0)
119
156
  ast (~> 2.4.1)
157
+ protocol-hpack (1.4.2)
158
+ protocol-http (0.22.5)
159
+ protocol-http1 (0.14.1)
160
+ protocol-http (~> 0.22)
161
+ protocol-http2 (0.14.2)
162
+ protocol-hpack (~> 1.4)
163
+ protocol-http (~> 0.18)
120
164
  pry (0.12.2)
121
165
  coderay (~> 1.1.0)
122
166
  method_source (~> 0.9.0)
@@ -127,53 +171,52 @@ GEM
127
171
  rack (2.2.3)
128
172
  rack-test (1.1.0)
129
173
  rack (>= 1.0, < 3)
130
- rails (6.1.1)
131
- actioncable (= 6.1.1)
132
- actionmailbox (= 6.1.1)
133
- actionmailer (= 6.1.1)
134
- actionpack (= 6.1.1)
135
- actiontext (= 6.1.1)
136
- actionview (= 6.1.1)
137
- activejob (= 6.1.1)
138
- activemodel (= 6.1.1)
139
- activerecord (= 6.1.1)
140
- activestorage (= 6.1.1)
141
- activesupport (= 6.1.1)
174
+ rails (6.1.4.1)
175
+ actioncable (= 6.1.4.1)
176
+ actionmailbox (= 6.1.4.1)
177
+ actionmailer (= 6.1.4.1)
178
+ actionpack (= 6.1.4.1)
179
+ actiontext (= 6.1.4.1)
180
+ actionview (= 6.1.4.1)
181
+ activejob (= 6.1.4.1)
182
+ activemodel (= 6.1.4.1)
183
+ activerecord (= 6.1.4.1)
184
+ activestorage (= 6.1.4.1)
185
+ activesupport (= 6.1.4.1)
142
186
  bundler (>= 1.15.0)
143
- railties (= 6.1.1)
187
+ railties (= 6.1.4.1)
144
188
  sprockets-rails (>= 2.0.0)
145
189
  rails-dom-testing (2.0.3)
146
190
  activesupport (>= 4.2.0)
147
191
  nokogiri (>= 1.6)
148
- rails-html-sanitizer (1.3.0)
192
+ rails-html-sanitizer (1.4.1)
149
193
  loofah (~> 2.3)
150
- railties (6.1.1)
151
- actionpack (= 6.1.1)
152
- activesupport (= 6.1.1)
194
+ railties (6.1.4.1)
195
+ actionpack (= 6.1.4.1)
196
+ activesupport (= 6.1.4.1)
153
197
  method_source
154
- rake (>= 0.8.7)
198
+ rake (>= 0.13)
155
199
  thor (~> 1.0)
156
200
  rainbow (3.0.0)
157
- rake (13.0.3)
158
- regexp_parser (2.0.3)
159
- retriable (3.1.2)
160
- rexml (3.2.4)
161
- rubocop (1.7.0)
201
+ rake (13.0.6)
202
+ regexp_parser (2.1.1)
203
+ rexml (3.2.5)
204
+ rubocop (1.18.4)
162
205
  parallel (~> 1.10)
163
- parser (>= 2.7.1.5)
206
+ parser (>= 3.0.0.0)
164
207
  rainbow (>= 2.2.2, < 4.0)
165
208
  regexp_parser (>= 1.8, < 3.0)
166
209
  rexml
167
- rubocop-ast (>= 1.2.0, < 2.0)
210
+ rubocop-ast (>= 1.8.0, < 2.0)
168
211
  ruby-progressbar (~> 1.7)
169
- unicode-display_width (>= 1.4.0, < 2.0)
170
- rubocop-ast (1.4.1)
171
- parser (>= 2.7.1.5)
172
- rubocop-performance (1.9.2)
173
- rubocop (>= 0.90.0, < 2.0)
212
+ unicode-display_width (>= 1.4.0, < 3.0)
213
+ rubocop-ast (1.10.0)
214
+ parser (>= 3.0.1.1)
215
+ rubocop-performance (1.11.4)
216
+ rubocop (>= 1.7.0, < 2.0)
174
217
  rubocop-ast (>= 0.4.0)
175
218
  ruby-progressbar (1.11.0)
176
- ruby2_keywords (0.0.4)
219
+ ruby2_keywords (0.0.5)
177
220
  sawyer (0.8.2)
178
221
  addressable (>= 2.3.5)
179
222
  faraday (> 0.8, < 2.0)
@@ -184,17 +227,18 @@ GEM
184
227
  actionpack (>= 4.0)
185
228
  activesupport (>= 4.0)
186
229
  sprockets (>= 3.0.0)
187
- standard (0.11.0)
188
- rubocop (= 1.7.0)
189
- rubocop-performance (= 1.9.2)
230
+ standard (1.1.7)
231
+ rubocop (= 1.18.4)
232
+ rubocop-performance (= 1.11.4)
190
233
  standardrb (1.0.0)
191
234
  standard
192
235
  thor (1.1.0)
193
236
  thread-local (1.1.0)
237
+ timers (4.3.3)
194
238
  tzinfo (2.0.4)
195
239
  concurrent-ruby (~> 1.0)
196
- unicode-display_width (1.7.0)
197
- websocket-driver (0.7.3)
240
+ unicode-display_width (2.0.0)
241
+ websocket-driver (0.7.5)
198
242
  websocket-extensions (>= 0.1.0)
199
243
  websocket-extensions (0.1.5)
200
244
  zeitwerk (2.4.2)
@@ -206,10 +250,11 @@ DEPENDENCIES
206
250
  cable_ready!
207
251
  github_changelog_generator
208
252
  magic_frozen_string_literal
253
+ mocha
209
254
  pry
210
255
  pry-nav
211
256
  rake
212
257
  standardrb
213
258
 
214
259
  BUNDLED WITH
215
- 2.1.4
260
+ 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-663-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