cubism 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +143 -118
- data/README.md +9 -0
- data/README.md~ +32 -12
- data/Rakefile +0 -2
- data/app/channels/cubism/presence_channel.rb +4 -0
- data/app/helpers/cubism_helper.rb +9 -0
- data/cubism.gemspec +2 -1
- data/lib/cubism/broadcaster.rb +3 -1
- data/lib/cubism/version.rb +1 -1
- data/lib/cubism.rb +6 -0
- data/package.json +1 -1
- data/test/test_helper.rb +11 -5
- metadata +46 -35
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2807897c46efb6dd8187d18c80c04bee84dfd0e50feeda467d5f735a0af9820e
|
|
4
|
+
data.tar.gz: 0440ddef045b5ce94cbe1928bcf662cf4726e5c206c8595c2c797aa8ad754463
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bed13da912fad03ac48d8afccb340fbf5b7bf480bfac99e615a77c3fd24cbb47c19ab038a6bcb778323305f4831e20dc33342e0942e56a15ff558fcbf31e99fd
|
|
7
|
+
data.tar.gz: 1290222d3ac7aa0f693b49fe321252649c37b18a7fef3ca6489e8aad61da99d02a243151d234a8b9759dc9fa9b368b3391ef819236642dd54610f003bfb6672e
|
data/Gemfile.lock
CHANGED
|
@@ -1,207 +1,225 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
cubism (0.2.
|
|
4
|
+
cubism (0.2.1)
|
|
5
5
|
cable_ready (>= 5.0.0)
|
|
6
6
|
kredis (>= 0.4)
|
|
7
|
+
observer
|
|
7
8
|
rails (>= 6.0)
|
|
8
9
|
|
|
9
10
|
GEM
|
|
10
11
|
remote: https://rubygems.org/
|
|
11
12
|
specs:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
action_text-trix (2.1.16)
|
|
14
|
+
railties
|
|
15
|
+
actioncable (8.1.2)
|
|
16
|
+
actionpack (= 8.1.2)
|
|
17
|
+
activesupport (= 8.1.2)
|
|
15
18
|
nio4r (~> 2.0)
|
|
16
19
|
websocket-driver (>= 0.6.1)
|
|
17
20
|
zeitwerk (~> 2.6)
|
|
18
|
-
actionmailbox (
|
|
19
|
-
actionpack (=
|
|
20
|
-
activejob (=
|
|
21
|
-
activerecord (=
|
|
22
|
-
activestorage (=
|
|
23
|
-
activesupport (=
|
|
24
|
-
mail (>= 2.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
activejob (= 7.1.3.2)
|
|
32
|
-
activesupport (= 7.1.3.2)
|
|
33
|
-
mail (~> 2.5, >= 2.5.4)
|
|
34
|
-
net-imap
|
|
35
|
-
net-pop
|
|
36
|
-
net-smtp
|
|
21
|
+
actionmailbox (8.1.2)
|
|
22
|
+
actionpack (= 8.1.2)
|
|
23
|
+
activejob (= 8.1.2)
|
|
24
|
+
activerecord (= 8.1.2)
|
|
25
|
+
activestorage (= 8.1.2)
|
|
26
|
+
activesupport (= 8.1.2)
|
|
27
|
+
mail (>= 2.8.0)
|
|
28
|
+
actionmailer (8.1.2)
|
|
29
|
+
actionpack (= 8.1.2)
|
|
30
|
+
actionview (= 8.1.2)
|
|
31
|
+
activejob (= 8.1.2)
|
|
32
|
+
activesupport (= 8.1.2)
|
|
33
|
+
mail (>= 2.8.0)
|
|
37
34
|
rails-dom-testing (~> 2.2)
|
|
38
|
-
actionpack (
|
|
39
|
-
actionview (=
|
|
40
|
-
activesupport (=
|
|
35
|
+
actionpack (8.1.2)
|
|
36
|
+
actionview (= 8.1.2)
|
|
37
|
+
activesupport (= 8.1.2)
|
|
41
38
|
nokogiri (>= 1.8.5)
|
|
42
|
-
racc
|
|
43
39
|
rack (>= 2.2.4)
|
|
44
40
|
rack-session (>= 1.0.1)
|
|
45
41
|
rack-test (>= 0.6.3)
|
|
46
42
|
rails-dom-testing (~> 2.2)
|
|
47
43
|
rails-html-sanitizer (~> 1.6)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
useragent (~> 0.16)
|
|
45
|
+
actiontext (8.1.2)
|
|
46
|
+
action_text-trix (~> 2.1.15)
|
|
47
|
+
actionpack (= 8.1.2)
|
|
48
|
+
activerecord (= 8.1.2)
|
|
49
|
+
activestorage (= 8.1.2)
|
|
50
|
+
activesupport (= 8.1.2)
|
|
53
51
|
globalid (>= 0.6.0)
|
|
54
52
|
nokogiri (>= 1.8.5)
|
|
55
|
-
actionview (
|
|
56
|
-
activesupport (=
|
|
53
|
+
actionview (8.1.2)
|
|
54
|
+
activesupport (= 8.1.2)
|
|
57
55
|
builder (~> 3.1)
|
|
58
56
|
erubi (~> 1.11)
|
|
59
57
|
rails-dom-testing (~> 2.2)
|
|
60
58
|
rails-html-sanitizer (~> 1.6)
|
|
61
|
-
activejob (
|
|
62
|
-
activesupport (=
|
|
59
|
+
activejob (8.1.2)
|
|
60
|
+
activesupport (= 8.1.2)
|
|
63
61
|
globalid (>= 0.3.6)
|
|
64
|
-
activemodel (
|
|
65
|
-
activesupport (=
|
|
66
|
-
activerecord (
|
|
67
|
-
activemodel (=
|
|
68
|
-
activesupport (=
|
|
62
|
+
activemodel (8.1.2)
|
|
63
|
+
activesupport (= 8.1.2)
|
|
64
|
+
activerecord (8.1.2)
|
|
65
|
+
activemodel (= 8.1.2)
|
|
66
|
+
activesupport (= 8.1.2)
|
|
69
67
|
timeout (>= 0.4.0)
|
|
70
|
-
activestorage (
|
|
71
|
-
actionpack (=
|
|
72
|
-
activejob (=
|
|
73
|
-
activerecord (=
|
|
74
|
-
activesupport (=
|
|
68
|
+
activestorage (8.1.2)
|
|
69
|
+
actionpack (= 8.1.2)
|
|
70
|
+
activejob (= 8.1.2)
|
|
71
|
+
activerecord (= 8.1.2)
|
|
72
|
+
activesupport (= 8.1.2)
|
|
75
73
|
marcel (~> 1.0)
|
|
76
|
-
activesupport (
|
|
74
|
+
activesupport (8.1.2)
|
|
77
75
|
base64
|
|
78
76
|
bigdecimal
|
|
79
|
-
concurrent-ruby (~> 1.0, >= 1.
|
|
77
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
80
78
|
connection_pool (>= 2.2.5)
|
|
81
79
|
drb
|
|
82
80
|
i18n (>= 1.6, < 2)
|
|
81
|
+
json
|
|
82
|
+
logger (>= 1.4.2)
|
|
83
83
|
minitest (>= 5.1)
|
|
84
|
-
|
|
85
|
-
tzinfo (~> 2.0)
|
|
84
|
+
securerandom (>= 0.3)
|
|
85
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
86
|
+
uri (>= 0.13.1)
|
|
86
87
|
appraisal (2.4.1)
|
|
87
88
|
bundler
|
|
88
89
|
rake
|
|
89
90
|
thor (>= 0.14.0)
|
|
90
91
|
ast (2.4.2)
|
|
91
|
-
base64 (0.
|
|
92
|
-
bigdecimal (
|
|
93
|
-
builder (3.
|
|
94
|
-
cable_ready (5.0.
|
|
92
|
+
base64 (0.3.0)
|
|
93
|
+
bigdecimal (4.0.1)
|
|
94
|
+
builder (3.3.0)
|
|
95
|
+
cable_ready (5.0.6)
|
|
95
96
|
actionpack (>= 5.2)
|
|
96
97
|
actionview (>= 5.2)
|
|
97
98
|
activesupport (>= 5.2)
|
|
99
|
+
observer (~> 0.1)
|
|
98
100
|
railties (>= 5.2)
|
|
99
101
|
thread-local (>= 1.1.0)
|
|
100
102
|
coderay (1.1.3)
|
|
101
|
-
concurrent-ruby (1.
|
|
102
|
-
connection_pool (
|
|
103
|
+
concurrent-ruby (1.3.6)
|
|
104
|
+
connection_pool (3.0.2)
|
|
103
105
|
crass (1.0.6)
|
|
104
|
-
date (3.
|
|
105
|
-
drb (2.2.
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
date (3.5.1)
|
|
107
|
+
drb (2.2.3)
|
|
108
|
+
erb (6.0.1)
|
|
109
|
+
erubi (1.13.1)
|
|
110
|
+
globalid (1.3.0)
|
|
108
111
|
activesupport (>= 6.1)
|
|
109
|
-
i18n (1.14.
|
|
112
|
+
i18n (1.14.8)
|
|
110
113
|
concurrent-ruby (~> 1.0)
|
|
111
|
-
io-console (0.
|
|
112
|
-
irb (1.
|
|
113
|
-
|
|
114
|
+
io-console (0.8.2)
|
|
115
|
+
irb (1.17.0)
|
|
116
|
+
pp (>= 0.6.0)
|
|
117
|
+
prism (>= 1.3.0)
|
|
118
|
+
rdoc (>= 4.0.0)
|
|
114
119
|
reline (>= 0.4.2)
|
|
115
|
-
|
|
120
|
+
json (2.18.1)
|
|
121
|
+
kredis (1.8.0)
|
|
116
122
|
activemodel (>= 6.0.0)
|
|
117
123
|
activesupport (>= 6.0.0)
|
|
118
124
|
redis (>= 4.2, < 6)
|
|
119
|
-
|
|
125
|
+
logger (1.7.0)
|
|
126
|
+
loofah (2.25.0)
|
|
120
127
|
crass (~> 1.0.2)
|
|
121
128
|
nokogiri (>= 1.12.0)
|
|
122
|
-
mail (2.
|
|
129
|
+
mail (2.9.0)
|
|
130
|
+
logger
|
|
123
131
|
mini_mime (>= 0.1.1)
|
|
124
132
|
net-imap
|
|
125
133
|
net-pop
|
|
126
134
|
net-smtp
|
|
127
|
-
marcel (1.0
|
|
135
|
+
marcel (1.1.0)
|
|
128
136
|
method_source (1.0.0)
|
|
129
137
|
mini_mime (1.1.5)
|
|
130
|
-
mini_portile2 (2.8.
|
|
131
|
-
minitest (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
mini_portile2 (2.8.9)
|
|
139
|
+
minitest (6.0.1)
|
|
140
|
+
prism (~> 1.5)
|
|
141
|
+
mocha (3.0.2)
|
|
142
|
+
ruby2_keywords (>= 0.0.5)
|
|
143
|
+
net-imap (0.6.3)
|
|
135
144
|
date
|
|
136
145
|
net-protocol
|
|
137
146
|
net-pop (0.1.2)
|
|
138
147
|
net-protocol
|
|
139
148
|
net-protocol (0.2.2)
|
|
140
149
|
timeout
|
|
141
|
-
net-smtp (0.5.
|
|
150
|
+
net-smtp (0.5.1)
|
|
142
151
|
net-protocol
|
|
143
|
-
nio4r (2.7.
|
|
144
|
-
nokogiri (1.
|
|
152
|
+
nio4r (2.7.5)
|
|
153
|
+
nokogiri (1.19.1)
|
|
145
154
|
mini_portile2 (~> 2.8.2)
|
|
146
155
|
racc (~> 1.4)
|
|
147
|
-
nokogiri (1.
|
|
156
|
+
nokogiri (1.19.1-arm64-darwin)
|
|
148
157
|
racc (~> 1.4)
|
|
158
|
+
observer (0.1.2)
|
|
149
159
|
parallel (1.21.0)
|
|
150
160
|
parser (3.1.0.0)
|
|
151
161
|
ast (~> 2.4.1)
|
|
162
|
+
pp (0.6.3)
|
|
163
|
+
prettyprint
|
|
164
|
+
prettyprint (0.2.0)
|
|
165
|
+
prism (1.9.0)
|
|
152
166
|
pry (0.14.1)
|
|
153
167
|
coderay (~> 1.1)
|
|
154
168
|
method_source (~> 1.0)
|
|
155
|
-
psych (5.1
|
|
169
|
+
psych (5.3.1)
|
|
170
|
+
date
|
|
156
171
|
stringio
|
|
157
|
-
racc (1.
|
|
158
|
-
rack (3.
|
|
159
|
-
rack-session (2.
|
|
172
|
+
racc (1.8.1)
|
|
173
|
+
rack (3.2.5)
|
|
174
|
+
rack-session (2.1.1)
|
|
175
|
+
base64 (>= 0.1.0)
|
|
160
176
|
rack (>= 3.0.0)
|
|
161
|
-
rack-test (2.
|
|
177
|
+
rack-test (2.2.0)
|
|
162
178
|
rack (>= 1.3)
|
|
163
|
-
rackup (2.1
|
|
179
|
+
rackup (2.3.1)
|
|
164
180
|
rack (>= 3)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
activesupport (= 7.1.3.2)
|
|
181
|
+
rails (8.1.2)
|
|
182
|
+
actioncable (= 8.1.2)
|
|
183
|
+
actionmailbox (= 8.1.2)
|
|
184
|
+
actionmailer (= 8.1.2)
|
|
185
|
+
actionpack (= 8.1.2)
|
|
186
|
+
actiontext (= 8.1.2)
|
|
187
|
+
actionview (= 8.1.2)
|
|
188
|
+
activejob (= 8.1.2)
|
|
189
|
+
activemodel (= 8.1.2)
|
|
190
|
+
activerecord (= 8.1.2)
|
|
191
|
+
activestorage (= 8.1.2)
|
|
192
|
+
activesupport (= 8.1.2)
|
|
178
193
|
bundler (>= 1.15.0)
|
|
179
|
-
railties (=
|
|
180
|
-
rails-dom-testing (2.
|
|
194
|
+
railties (= 8.1.2)
|
|
195
|
+
rails-dom-testing (2.3.0)
|
|
181
196
|
activesupport (>= 5.0.0)
|
|
182
197
|
minitest
|
|
183
198
|
nokogiri (>= 1.6)
|
|
184
|
-
rails-html-sanitizer (1.6.
|
|
199
|
+
rails-html-sanitizer (1.6.2)
|
|
185
200
|
loofah (~> 2.21)
|
|
186
|
-
nokogiri (
|
|
187
|
-
railties (
|
|
188
|
-
actionpack (=
|
|
189
|
-
activesupport (=
|
|
190
|
-
irb
|
|
201
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
202
|
+
railties (8.1.2)
|
|
203
|
+
actionpack (= 8.1.2)
|
|
204
|
+
activesupport (= 8.1.2)
|
|
205
|
+
irb (~> 1.13)
|
|
191
206
|
rackup (>= 1.0.0)
|
|
192
207
|
rake (>= 12.2)
|
|
193
208
|
thor (~> 1.0, >= 1.2.2)
|
|
209
|
+
tsort (>= 0.2)
|
|
194
210
|
zeitwerk (~> 2.6)
|
|
195
211
|
rainbow (3.0.0)
|
|
196
|
-
rake (13.1
|
|
197
|
-
rdoc (
|
|
212
|
+
rake (13.3.1)
|
|
213
|
+
rdoc (7.2.0)
|
|
214
|
+
erb
|
|
198
215
|
psych (>= 4.0.0)
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
216
|
+
tsort
|
|
217
|
+
redis (5.4.1)
|
|
218
|
+
redis-client (>= 0.22.0)
|
|
219
|
+
redis-client (0.26.4)
|
|
202
220
|
connection_pool
|
|
203
221
|
regexp_parser (2.2.0)
|
|
204
|
-
reline (0.
|
|
222
|
+
reline (0.6.3)
|
|
205
223
|
io-console (~> 0.5)
|
|
206
224
|
rexml (3.2.5)
|
|
207
225
|
rubocop (1.23.0)
|
|
@@ -219,22 +237,29 @@ GEM
|
|
|
219
237
|
rubocop (>= 1.7.0, < 2.0)
|
|
220
238
|
rubocop-ast (>= 0.4.0)
|
|
221
239
|
ruby-progressbar (1.11.0)
|
|
222
|
-
|
|
240
|
+
ruby2_keywords (0.0.5)
|
|
241
|
+
securerandom (0.4.1)
|
|
242
|
+
sqlite3 (2.9.0)
|
|
243
|
+
mini_portile2 (~> 2.8.0)
|
|
244
|
+
sqlite3 (2.9.0-arm64-darwin)
|
|
223
245
|
standard (1.5.0)
|
|
224
246
|
rubocop (= 1.23.0)
|
|
225
247
|
rubocop-performance (= 1.12.0)
|
|
226
|
-
stringio (3.
|
|
227
|
-
thor (1.
|
|
248
|
+
stringio (3.2.0)
|
|
249
|
+
thor (1.5.0)
|
|
228
250
|
thread-local (1.1.0)
|
|
229
|
-
timeout (0.
|
|
251
|
+
timeout (0.6.0)
|
|
252
|
+
tsort (0.2.0)
|
|
230
253
|
tzinfo (2.0.6)
|
|
231
254
|
concurrent-ruby (~> 1.0)
|
|
232
255
|
unicode-display_width (2.1.0)
|
|
233
|
-
|
|
234
|
-
|
|
256
|
+
uri (1.1.1)
|
|
257
|
+
useragent (0.16.11)
|
|
258
|
+
websocket-driver (0.8.0)
|
|
259
|
+
base64
|
|
235
260
|
websocket-extensions (>= 0.1.0)
|
|
236
261
|
websocket-extensions (0.1.5)
|
|
237
|
-
zeitwerk (2.
|
|
262
|
+
zeitwerk (2.7.5)
|
|
238
263
|
|
|
239
264
|
PLATFORMS
|
|
240
265
|
arm64-darwin-21
|
|
@@ -246,7 +271,7 @@ DEPENDENCIES
|
|
|
246
271
|
mocha
|
|
247
272
|
nokogiri
|
|
248
273
|
pry
|
|
249
|
-
sqlite3
|
|
274
|
+
sqlite3 (>= 2.1)
|
|
250
275
|
standard
|
|
251
276
|
|
|
252
277
|
BUNDLED WITH
|
data/README.md
CHANGED
|
@@ -125,6 +125,15 @@ The `cubicle_for` helper accepts the following options as keyword arguments:
|
|
|
125
125
|
### Supported Template Handlers
|
|
126
126
|
- ERB
|
|
127
127
|
|
|
128
|
+
## Testing
|
|
129
|
+
In Rails system tests there is a chance that tests will hang in some cases. To overcome this, add the flag
|
|
130
|
+
|
|
131
|
+
```ruby
|
|
132
|
+
Cubism.skip_in_test = true
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
to an initializer, for example `config/initializers/cubism.rb`.
|
|
136
|
+
|
|
128
137
|
## Gotchas
|
|
129
138
|
|
|
130
139
|
### Usage with ViewComponent
|
data/README.md~
CHANGED
|
@@ -71,10 +71,27 @@ And then execute:
|
|
|
71
71
|
$ bundle
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
There are a few ways to install the Cubism JavaScript client, depending on your application setup.
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
#### ESBuild / Webpacker
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
yarn add @minthesize/cubism
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### Import maps:
|
|
83
|
+
|
|
84
|
+
```ruby
|
|
85
|
+
# config/importmap.rb
|
|
86
|
+
# ...
|
|
87
|
+
pin '@minthesize/cubism', to: 'cubism.min.js', preload: true
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### Rails Asset pipeline (Sprockets):
|
|
91
|
+
|
|
92
|
+
```html+erb
|
|
93
|
+
<!-- app/views/layouts/application.html.erb -->
|
|
94
|
+
<%= javascript_include_tag "cubism.umd.min.js", "data-turbo-track": "reload" %>
|
|
78
95
|
```
|
|
79
96
|
|
|
80
97
|
### Kredis
|
|
@@ -146,7 +163,7 @@ yarn link # set the local machine's cubism npm package's lookup to this local pa
|
|
|
146
163
|
|
|
147
164
|
# Setup a sample project and edit Gemfile to point to local gem
|
|
148
165
|
# (e.g. `gem "cubism", path: "../cubism"`)
|
|
149
|
-
# yarn link @
|
|
166
|
+
# yarn link @minthesize/cubism
|
|
150
167
|
|
|
151
168
|
|
|
152
169
|
# Do your work, Submit PR, Profit!
|
|
@@ -163,14 +180,17 @@ cd path/to/project
|
|
|
163
180
|
yarn install --force
|
|
164
181
|
```
|
|
165
182
|
|
|
166
|
-
###
|
|
167
|
-
|
|
168
|
-
1.
|
|
169
|
-
2.
|
|
170
|
-
3. Run `
|
|
171
|
-
4.
|
|
172
|
-
5. Run `
|
|
173
|
-
|
|
183
|
+
### 📦 Releasing
|
|
184
|
+
|
|
185
|
+
1. Make sure that you run `yarn` and `bundle` to pick up the latest.
|
|
186
|
+
2. Bump version number at `lib/cubism/version.rb`. Pre-release versions use `.preN`
|
|
187
|
+
3. Run `rake build` and `yarn build`
|
|
188
|
+
4. Commit and push changes to github `git commit -m "Bump version to x.x.x"`
|
|
189
|
+
5. Run `rake release`
|
|
190
|
+
6. Run `yarn publish --no-git-tag-version`
|
|
191
|
+
7. Yarn will prompt you for the new version. Pre-release versions use `-preN`
|
|
192
|
+
8. Commit and push changes to GitHub
|
|
193
|
+
9. Create a new release on GitHub ([here](https://github.com/julianrubisch/cubism/releases)) and generate the changelog for the stable release for it
|
|
174
194
|
## License
|
|
175
195
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
176
196
|
|
data/Rakefile
CHANGED
|
@@ -2,6 +2,8 @@ class Cubism::PresenceChannel < ActionCable::Channel::Base
|
|
|
2
2
|
include CableReady::StreamIdentifier
|
|
3
3
|
|
|
4
4
|
def subscribed
|
|
5
|
+
return if Cubism.skip_in_test? && Rails.env.test?
|
|
6
|
+
|
|
5
7
|
if resource.present?
|
|
6
8
|
stream_from element_id
|
|
7
9
|
resource.cubicle_element_ids << element_id
|
|
@@ -12,6 +14,8 @@ class Cubism::PresenceChannel < ActionCable::Channel::Base
|
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
def unsubscribed
|
|
17
|
+
return if Cubism.skip_in_test? && Rails.env.test?
|
|
18
|
+
|
|
15
19
|
return unless resource.present?
|
|
16
20
|
|
|
17
21
|
resource.cubicle_element_ids.remove(element_id)
|
|
@@ -2,11 +2,20 @@ module CubismHelper
|
|
|
2
2
|
include CableReady::StreamIdentifier
|
|
3
3
|
|
|
4
4
|
def cubicle_for(resource, user, scope: "", html_options: {}, appear_trigger: :connect, disappear_trigger: nil, trigger_root: nil, exclude_current_user: true, &block)
|
|
5
|
+
return if Cubism.skip_in_test? && Rails.env.test?
|
|
6
|
+
|
|
5
7
|
block_location = block.source_location.join(":")
|
|
6
8
|
block_source = Cubism::BlockSource.find_or_create(
|
|
7
9
|
location: block_location,
|
|
8
10
|
view_context: self
|
|
9
11
|
)
|
|
12
|
+
if block_source.variable_name.blank?
|
|
13
|
+
block_variable_name = block.parameters.find { |type, _| [:req, :opt, :rest].include?(type) }&.last
|
|
14
|
+
if block_variable_name.present?
|
|
15
|
+
block_source.variable_name = block_variable_name.to_s
|
|
16
|
+
Cubism.source_store[block_source.digest] = block_source
|
|
17
|
+
end
|
|
18
|
+
end
|
|
10
19
|
|
|
11
20
|
resource_gid = resource.to_gid.to_s
|
|
12
21
|
|
data/cubism.gemspec
CHANGED
|
@@ -27,10 +27,11 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
spec.add_dependency "rails", ">= 6.0"
|
|
28
28
|
spec.add_dependency "kredis", ">= 0.4"
|
|
29
29
|
spec.add_dependency "cable_ready", ">= 5.0.0"
|
|
30
|
+
spec.add_dependency "observer"
|
|
30
31
|
|
|
31
32
|
spec.add_development_dependency "standard"
|
|
32
33
|
spec.add_development_dependency "nokogiri"
|
|
33
34
|
spec.add_development_dependency "mocha"
|
|
34
35
|
spec.add_development_dependency "appraisal"
|
|
35
|
-
spec.add_development_dependency "sqlite3"
|
|
36
|
+
spec.add_development_dependency "sqlite3", ">= 2.1"
|
|
36
37
|
end
|
data/lib/cubism/broadcaster.rb
CHANGED
|
@@ -21,7 +21,9 @@ module Cubism
|
|
|
21
21
|
|
|
22
22
|
block_source = block_container.block_source
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
inline_source = block_source.source
|
|
25
|
+
inline_source = inline_source.dup if inline_source.frozen?
|
|
26
|
+
html = ApplicationController.render(inline: inline_source, locals: {"#{block_source.variable_name}": present_users})
|
|
25
27
|
|
|
26
28
|
selector = "cubicle-element#cubicle-#{element_id}[identifier='#{signed_stream_identifier(resource.to_global_id.to_s)}']"
|
|
27
29
|
|
data/lib/cubism/version.rb
CHANGED
data/lib/cubism.rb
CHANGED
data/package.json
CHANGED
data/test/test_helper.rb
CHANGED
|
@@ -4,13 +4,19 @@ ENV["RAILS_ENV"] = "test"
|
|
|
4
4
|
require_relative "../test/dummy/config/environment"
|
|
5
5
|
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)]
|
|
6
6
|
require "rails/test_help"
|
|
7
|
-
require "minitest/unit"
|
|
8
7
|
require "mocha/minitest"
|
|
9
8
|
|
|
10
9
|
# Load fixtures from the engine
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
ActiveSupport::TestCase.
|
|
10
|
+
fixtures_path = File.expand_path("dummy/test/fixtures", __dir__)
|
|
11
|
+
|
|
12
|
+
if ActiveSupport::TestCase.respond_to?(:fixture_paths=)
|
|
13
|
+
ActiveSupport::TestCase.fixture_paths = [fixtures_path]
|
|
14
|
+
ActionDispatch::IntegrationTest.fixture_paths = ActiveSupport::TestCase.fixture_paths if ActionDispatch::IntegrationTest.respond_to?(:fixture_paths=)
|
|
15
|
+
ActiveSupport::TestCase.file_fixture_path = "#{fixtures_path}/files"
|
|
16
|
+
ActiveSupport::TestCase.fixtures :all
|
|
17
|
+
elsif ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
|
18
|
+
ActiveSupport::TestCase.fixture_path = fixtures_path
|
|
19
|
+
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path if ActionDispatch::IntegrationTest.respond_to?(:fixture_path=)
|
|
20
|
+
ActiveSupport::TestCase.file_fixture_path = "#{fixtures_path}/files"
|
|
15
21
|
ActiveSupport::TestCase.fixtures :all
|
|
16
22
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cubism
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Julian Rubisch
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rails
|
|
@@ -52,6 +51,20 @@ dependencies:
|
|
|
52
51
|
- - ">="
|
|
53
52
|
- !ruby/object:Gem::Version
|
|
54
53
|
version: 5.0.0
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: observer
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
55
68
|
- !ruby/object:Gem::Dependency
|
|
56
69
|
name: standard
|
|
57
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -114,14 +127,14 @@ dependencies:
|
|
|
114
127
|
requirements:
|
|
115
128
|
- - ">="
|
|
116
129
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '
|
|
130
|
+
version: '2.1'
|
|
118
131
|
type: :development
|
|
119
132
|
prerelease: false
|
|
120
133
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
134
|
requirements:
|
|
122
135
|
- - ">="
|
|
123
136
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: '
|
|
137
|
+
version: '2.1'
|
|
125
138
|
description: Lightweight Resource-Based Presence Solution with CableReady
|
|
126
139
|
email:
|
|
127
140
|
- julian@julianrubisch.at
|
|
@@ -217,7 +230,6 @@ licenses:
|
|
|
217
230
|
metadata:
|
|
218
231
|
homepage_uri: https://github.com/julianrubisch/cubism
|
|
219
232
|
source_code_uri: https://github.com/julianrubisch/cubism.git
|
|
220
|
-
post_install_message:
|
|
221
233
|
rdoc_options: []
|
|
222
234
|
require_paths:
|
|
223
235
|
- lib
|
|
@@ -232,52 +244,51 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
232
244
|
- !ruby/object:Gem::Version
|
|
233
245
|
version: '0'
|
|
234
246
|
requirements: []
|
|
235
|
-
rubygems_version: 3.
|
|
236
|
-
signing_key:
|
|
247
|
+
rubygems_version: 3.6.7
|
|
237
248
|
specification_version: 4
|
|
238
249
|
summary: Lightweight Resource-Based Presence Solution with CableReady
|
|
239
250
|
test_files:
|
|
251
|
+
- test/block_container_test.rb
|
|
252
|
+
- test/block_source_test.rb
|
|
253
|
+
- test/broadcaster_test.rb
|
|
254
|
+
- test/channels/cubism/presence_channel_test.rb
|
|
255
|
+
- test/cubicle_store_test.rb
|
|
256
|
+
- test/cubism_test.rb
|
|
257
|
+
- test/dummy/app/channels/application_cable/channel.rb
|
|
258
|
+
- test/dummy/app/channels/application_cable/connection.rb
|
|
259
|
+
- test/dummy/app/controllers/application_controller.rb
|
|
260
|
+
- test/dummy/app/helpers/application_helper.rb
|
|
261
|
+
- test/dummy/app/jobs/application_job.rb
|
|
240
262
|
- test/dummy/app/mailers/application_mailer.rb
|
|
241
263
|
- test/dummy/app/models/application_record.rb
|
|
242
264
|
- test/dummy/app/models/post.rb
|
|
243
265
|
- test/dummy/app/models/user.rb
|
|
244
|
-
- test/dummy/app/jobs/application_job.rb
|
|
245
|
-
- test/dummy/app/controllers/application_controller.rb
|
|
246
|
-
- test/dummy/app/helpers/application_helper.rb
|
|
247
|
-
- test/dummy/app/channels/application_cable/connection.rb
|
|
248
|
-
- test/dummy/app/channels/application_cable/channel.rb
|
|
249
|
-
- test/dummy/test/models/post_test.rb
|
|
250
|
-
- test/dummy/test/models/user_test.rb
|
|
251
|
-
- test/dummy/config/routes.rb
|
|
252
|
-
- test/dummy/config/environments/production.rb
|
|
253
|
-
- test/dummy/config/environments/development.rb
|
|
254
|
-
- test/dummy/config/environments/test.rb
|
|
255
|
-
- test/dummy/config/environment.rb
|
|
256
266
|
- test/dummy/config/application.rb
|
|
257
|
-
- test/dummy/config/puma.rb
|
|
258
267
|
- test/dummy/config/boot.rb
|
|
268
|
+
- test/dummy/config/environment.rb
|
|
269
|
+
- test/dummy/config/environments/development.rb
|
|
270
|
+
- test/dummy/config/environments/production.rb
|
|
271
|
+
- test/dummy/config/environments/test.rb
|
|
259
272
|
- test/dummy/config/initializers/application_controller_renderer.rb
|
|
260
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
|
261
|
-
- test/dummy/config/initializers/mime_types.rb
|
|
262
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
|
263
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
|
264
273
|
- test/dummy/config/initializers/assets.rb
|
|
265
|
-
- test/dummy/config/initializers/
|
|
266
|
-
- test/dummy/config/initializers/permissions_policy.rb
|
|
274
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
|
267
275
|
- test/dummy/config/initializers/content_security_policy.rb
|
|
276
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
|
277
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
|
268
278
|
- test/dummy/config/initializers/inflections.rb
|
|
269
|
-
- test/dummy/
|
|
279
|
+
- test/dummy/config/initializers/mime_types.rb
|
|
280
|
+
- test/dummy/config/initializers/permissions_policy.rb
|
|
281
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
|
282
|
+
- test/dummy/config/puma.rb
|
|
283
|
+
- test/dummy/config/routes.rb
|
|
270
284
|
- test/dummy/db/migrate/20220102072929_create_posts.rb
|
|
271
285
|
- test/dummy/db/migrate/20220102073003_create_users.rb
|
|
286
|
+
- test/dummy/db/schema.rb
|
|
287
|
+
- test/dummy/test/models/post_test.rb
|
|
288
|
+
- test/dummy/test/models/user_test.rb
|
|
289
|
+
- test/helpers/cubism_helper_test.rb
|
|
272
290
|
- test/integration/navigation_test.rb
|
|
273
|
-
- test/broadcaster_test.rb
|
|
274
|
-
- test/cubicle_store_test.rb
|
|
275
291
|
- test/models/concerns/presence_test.rb
|
|
276
292
|
- test/models/concerns/user_test.rb
|
|
277
|
-
- test/block_container_test.rb
|
|
278
|
-
- test/cubism_test.rb
|
|
279
293
|
- test/rendering/preprocessor_test.rb
|
|
280
294
|
- test/test_helper.rb
|
|
281
|
-
- test/helpers/cubism_helper_test.rb
|
|
282
|
-
- test/block_source_test.rb
|
|
283
|
-
- test/channels/cubism/presence_channel_test.rb
|