stimulus_reflex 3.3.0.pre2 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of stimulus_reflex might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +102 -3
- data/Gemfile.lock +70 -68
- data/README.md +25 -19
- data/lib/generators/templates/app/javascript/controllers/%file_name%_controller.js.tt +53 -21
- data/lib/generators/templates/app/javascript/controllers/application_controller.js.tt +11 -8
- data/lib/stimulus_reflex.rb +4 -0
- data/lib/stimulus_reflex/broadcasters/broadcaster.rb +1 -0
- data/lib/stimulus_reflex/broadcasters/page_broadcaster.rb +1 -2
- data/lib/stimulus_reflex/broadcasters/selector_broadcaster.rb +2 -5
- data/lib/stimulus_reflex/channel.rb +20 -3
- data/lib/stimulus_reflex/sanity_checker.rb +80 -0
- data/lib/stimulus_reflex/version.rb +1 -1
- data/lib/tasks/stimulus_reflex/install.rake +13 -1
- data/test/generators/stimulus_reflex_generator_test.rb +2 -2
- metadata +26 -17
- data/stimulus_reflex.gemspec +0 -39
- data/tags +0 -76
- data/test/tmp/app/reflexes/application_reflex.rb +0 -12
- data/test/tmp/app/reflexes/demo_reflex.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8b04fb348bbf5ebfb86274f76f84bd70877490d96adb0b435d9108288e414ea
|
4
|
+
data.tar.gz: '082d8a0bf06b806c5bf717455a3698c59a3f75b40e16a062f1361e7931ea5692'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5e9b636b0869a338da5be3fb5dc5a35f582a94d28c76896c6e58964097af8670367ae66c691ac4a379492be362c445ec46fe9ddaaf5cc148c73bb0becb473aa
|
7
|
+
data.tar.gz: 3008e7ba71def33ae0b0774f9bd8cd716574a1877f62732c417e25bf20d4f9e29680f94ba587f051606a9bc2480fc7a7bc9879096e5029686b87ecd3c0b01960
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,103 @@
|
|
2
2
|
|
3
3
|
## [Unreleased](https://github.com/hopsoft/stimulus_reflex/tree/HEAD)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.3.0.
|
5
|
+
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.3.0.pre5...HEAD)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Support for token-based authentication [\#243](https://github.com/hopsoft/stimulus_reflex/pull/243) ([leastbad](https://github.com/leastbad))
|
10
|
+
|
11
|
+
**Closed issues:**
|
12
|
+
|
13
|
+
- Authorization [\#292](https://github.com/hopsoft/stimulus_reflex/issues/292)
|
14
|
+
- Params incorrect for form submitted for nested resource [\#290](https://github.com/hopsoft/stimulus_reflex/issues/290)
|
15
|
+
- Use set I18n.locale in Reflexes with Selector Morphs [\#280](https://github.com/hopsoft/stimulus_reflex/issues/280)
|
16
|
+
|
17
|
+
**Merged pull requests:**
|
18
|
+
|
19
|
+
- fixes and tweaks to client logging subsystem [\#313](https://github.com/hopsoft/stimulus_reflex/pull/313) ([leastbad](https://github.com/leastbad))
|
20
|
+
- add ready event after setupDeclarativeReflexes [\#312](https://github.com/hopsoft/stimulus_reflex/pull/312) ([leastbad](https://github.com/leastbad))
|
21
|
+
- Refactor sanity checks on boot [\#311](https://github.com/hopsoft/stimulus_reflex/pull/311) ([excid3](https://github.com/excid3))
|
22
|
+
|
23
|
+
## [v3.3.0.pre5](https://github.com/hopsoft/stimulus_reflex/tree/v3.3.0.pre5) (2020-09-18)
|
24
|
+
|
25
|
+
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.3.0.pre4...v3.3.0.pre5)
|
26
|
+
|
27
|
+
**Implemented enhancements:**
|
28
|
+
|
29
|
+
- Fail loudly if there's a version mismatch between the gem and the npm package. [\#294](https://github.com/hopsoft/stimulus_reflex/issues/294)
|
30
|
+
|
31
|
+
**Closed issues:**
|
32
|
+
|
33
|
+
- IE11 Support: "crypto" is undefined [\#308](https://github.com/hopsoft/stimulus_reflex/issues/308)
|
34
|
+
- Using `morph` gives error on missing Warden::Manager midddleware? [\#304](https://github.com/hopsoft/stimulus_reflex/issues/304)
|
35
|
+
- Update client controller template comments [\#298](https://github.com/hopsoft/stimulus_reflex/issues/298)
|
36
|
+
|
37
|
+
**Merged pull requests:**
|
38
|
+
|
39
|
+
- Support IE11 msCrypto \(\#308\) [\#310](https://github.com/hopsoft/stimulus_reflex/pull/310) ([chooselife22](https://github.com/chooselife22))
|
40
|
+
- Print warning and exit if caching is disabled or npm/gem versions are mismatched [\#309](https://github.com/hopsoft/stimulus_reflex/pull/309) ([excid3](https://github.com/excid3))
|
41
|
+
- ActionCable connectivity events [\#307](https://github.com/hopsoft/stimulus_reflex/pull/307) ([leastbad](https://github.com/leastbad))
|
42
|
+
- Copyedits [\#306](https://github.com/hopsoft/stimulus_reflex/pull/306) ([CodingItWrong](https://github.com/CodingItWrong))
|
43
|
+
- add redis to cable.yml in development mode [\#305](https://github.com/hopsoft/stimulus_reflex/pull/305) ([leastbad](https://github.com/leastbad))
|
44
|
+
- Update morph-modes.md [\#302](https://github.com/hopsoft/stimulus_reflex/pull/302) ([scottbarrow](https://github.com/scottbarrow))
|
45
|
+
- Enhance controller templates docs [\#300](https://github.com/hopsoft/stimulus_reflex/pull/300) ([pinzonjulian](https://github.com/pinzonjulian))
|
46
|
+
- Avoid mismatching client and server versions [\#297](https://github.com/hopsoft/stimulus_reflex/pull/297) ([piotrwodz](https://github.com/piotrwodz))
|
47
|
+
|
48
|
+
## [v3.3.0.pre4](https://github.com/hopsoft/stimulus_reflex/tree/v3.3.0.pre4) (2020-09-13)
|
49
|
+
|
50
|
+
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.3.0.pre3...v3.3.0.pre4)
|
51
|
+
|
52
|
+
**Fixed bugs:**
|
53
|
+
|
54
|
+
- Lifecycle callbacks do not work [\#281](https://github.com/hopsoft/stimulus_reflex/issues/281)
|
55
|
+
- Fix timing issues with post-Reflex lifecycle callbacks [\#299](https://github.com/hopsoft/stimulus_reflex/pull/299) ([leastbad](https://github.com/leastbad))
|
56
|
+
|
57
|
+
**Closed issues:**
|
58
|
+
|
59
|
+
- self-referential data-reflex-root [\#301](https://github.com/hopsoft/stimulus_reflex/issues/301)
|
60
|
+
- data-reflex-permanent not working when using slim templates [\#295](https://github.com/hopsoft/stimulus_reflex/issues/295)
|
61
|
+
- undefined method `rescue\_with\_handler' whit reflex action such as "click-\>…" or "change-\>…" [\#287](https://github.com/hopsoft/stimulus_reflex/issues/287)
|
62
|
+
|
63
|
+
**Merged pull requests:**
|
64
|
+
|
65
|
+
- Fixed typo in sample code. [\#296](https://github.com/hopsoft/stimulus_reflex/pull/296) ([jclarke](https://github.com/jclarke))
|
66
|
+
|
67
|
+
## [v3.3.0.pre3](https://github.com/hopsoft/stimulus_reflex/tree/v3.3.0.pre3) (2020-08-31)
|
68
|
+
|
69
|
+
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.3.0.pre2...v3.3.0.pre3)
|
70
|
+
|
71
|
+
**Fixed bugs:**
|
72
|
+
|
73
|
+
- First argument of type "object" in this.stimulate\(\) will always be assigned to options. [\#278](https://github.com/hopsoft/stimulus_reflex/issues/278)
|
74
|
+
- Allow morphs to run before triggering success/after [\#286](https://github.com/hopsoft/stimulus_reflex/pull/286) ([hopsoft](https://github.com/hopsoft))
|
75
|
+
|
76
|
+
**Closed issues:**
|
77
|
+
|
78
|
+
- Reflex ignores turbolinks cached pages [\#288](https://github.com/hopsoft/stimulus_reflex/issues/288)
|
79
|
+
- Issue with Stimulus Reflex and ViewComponent [\#284](https://github.com/hopsoft/stimulus_reflex/issues/284)
|
80
|
+
- controller inheritance does not seem to work [\#283](https://github.com/hopsoft/stimulus_reflex/issues/283)
|
81
|
+
- Cannot read property 'schema' of undefined [\#282](https://github.com/hopsoft/stimulus_reflex/issues/282)
|
82
|
+
- Reflex on form submit does not get parameter from input\[type="file"\] [\#277](https://github.com/hopsoft/stimulus_reflex/issues/277)
|
83
|
+
- jQuery Plugins [\#246](https://github.com/hopsoft/stimulus_reflex/issues/246)
|
84
|
+
- ActiveStorage variants performance [\#242](https://github.com/hopsoft/stimulus_reflex/issues/242)
|
85
|
+
- Unnecessary body update after text\_content [\#186](https://github.com/hopsoft/stimulus_reflex/issues/186)
|
86
|
+
- Warn about enabling Rails after running stimulus reflex' initializer [\#185](https://github.com/hopsoft/stimulus_reflex/issues/185)
|
87
|
+
- Integration tests for stimulus-reflex [\#162](https://github.com/hopsoft/stimulus_reflex/issues/162)
|
88
|
+
- Clearer explanation of quickstart example without javascript. [\#149](https://github.com/hopsoft/stimulus_reflex/issues/149)
|
89
|
+
- Webpack compilation fails with rails/webpacker 3.6 [\#83](https://github.com/hopsoft/stimulus_reflex/issues/83)
|
90
|
+
|
91
|
+
**Merged pull requests:**
|
92
|
+
|
93
|
+
- Check if reflex exists before using it [\#293](https://github.com/hopsoft/stimulus_reflex/pull/293) ([joshleblanc](https://github.com/joshleblanc))
|
94
|
+
- Add instructions for existing projects [\#291](https://github.com/hopsoft/stimulus_reflex/pull/291) ([gerrywastaken](https://github.com/gerrywastaken))
|
95
|
+
- Fix argument of type object always being assigned to options [\#279](https://github.com/hopsoft/stimulus_reflex/pull/279) ([shawnleong](https://github.com/shawnleong))
|
96
|
+
- Simplify devise authentication logic \(in docs\) [\#276](https://github.com/hopsoft/stimulus_reflex/pull/276) ([inner-whisper](https://github.com/inner-whisper))
|
97
|
+
- Bump lodash from 4.17.15 to 4.17.19 in /javascript [\#275](https://github.com/hopsoft/stimulus_reflex/pull/275) ([dependabot[bot]](https://github.com/apps/dependabot))
|
98
|
+
|
99
|
+
## [v3.3.0.pre2](https://github.com/hopsoft/stimulus_reflex/tree/v3.3.0.pre2) (2020-07-17)
|
100
|
+
|
101
|
+
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.3.0.pre1...v3.3.0.pre2)
|
6
102
|
|
7
103
|
**Closed issues:**
|
8
104
|
|
@@ -101,6 +197,10 @@
|
|
101
197
|
|
102
198
|
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.2.2.pre0...v3.2.2.pre1)
|
103
199
|
|
200
|
+
**Implemented enhancements:**
|
201
|
+
|
202
|
+
- Make element even more user friendly [\#210](https://github.com/hopsoft/stimulus_reflex/pull/210) ([hopsoft](https://github.com/hopsoft))
|
203
|
+
|
104
204
|
**Fixed bugs:**
|
105
205
|
|
106
206
|
- Session lost after throw :abort [\#221](https://github.com/hopsoft/stimulus_reflex/issues/221)
|
@@ -119,7 +219,6 @@
|
|
119
219
|
- Add a halted lifecycle event [\#190](https://github.com/hopsoft/stimulus_reflex/issues/190)
|
120
220
|
- Allow extractElementAttributes to use a checkbox list [\#147](https://github.com/hopsoft/stimulus_reflex/issues/147)
|
121
221
|
- reflex\_name restriction loosening [\#212](https://github.com/hopsoft/stimulus_reflex/pull/212) ([leastbad](https://github.com/leastbad))
|
122
|
-
- Make element even more user friendly [\#210](https://github.com/hopsoft/stimulus_reflex/pull/210) ([hopsoft](https://github.com/hopsoft))
|
123
222
|
- Form parameters [\#204](https://github.com/hopsoft/stimulus_reflex/pull/204) ([jasoncharnes](https://github.com/jasoncharnes))
|
124
223
|
- Map hashes in incoming arguments using with\_indifferent\_access [\#203](https://github.com/hopsoft/stimulus_reflex/pull/203) ([jaredcwhite](https://github.com/jaredcwhite))
|
125
224
|
- Combine dataset with data-attributes from parent elements on reflex call [\#200](https://github.com/hopsoft/stimulus_reflex/pull/200) ([marcoroth](https://github.com/marcoroth))
|
@@ -200,7 +299,6 @@
|
|
200
299
|
- Some housekeeping [\#189](https://github.com/hopsoft/stimulus_reflex/pull/189) ([hopsoft](https://github.com/hopsoft))
|
201
300
|
- Allow to call stimulate without a reflex target [\#188](https://github.com/hopsoft/stimulus_reflex/pull/188) ([marcoroth](https://github.com/marcoroth))
|
202
301
|
- Fix bug in super documentation [\#174](https://github.com/hopsoft/stimulus_reflex/pull/174) ([silva96](https://github.com/silva96))
|
203
|
-
- Support devise authenticated routes [\#172](https://github.com/hopsoft/stimulus_reflex/pull/172) ([db0sch](https://github.com/db0sch))
|
204
302
|
|
205
303
|
## [v3.1.4](https://github.com/hopsoft/stimulus_reflex/tree/v3.1.4) (2020-04-27)
|
206
304
|
|
@@ -228,6 +326,7 @@
|
|
228
326
|
|
229
327
|
- prettier-standard: include all js files in the project [\#177](https://github.com/hopsoft/stimulus_reflex/pull/177) ([marcoroth](https://github.com/marcoroth))
|
230
328
|
- Remove implicit permanent for text inputs [\#176](https://github.com/hopsoft/stimulus_reflex/pull/176) ([hopsoft](https://github.com/hopsoft))
|
329
|
+
- Support devise authenticated routes [\#172](https://github.com/hopsoft/stimulus_reflex/pull/172) ([db0sch](https://github.com/db0sch))
|
231
330
|
- setupDeclarativeReflexes export with UJS support [\#169](https://github.com/hopsoft/stimulus_reflex/pull/169) ([leastbad](https://github.com/leastbad))
|
232
331
|
- Fix compilation issue [\#168](https://github.com/hopsoft/stimulus_reflex/pull/168) ([jonathan-s](https://github.com/jonathan-s))
|
233
332
|
|
data/Gemfile.lock
CHANGED
@@ -1,65 +1,66 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stimulus_reflex (3.3.0
|
5
|
-
cable_ready (>= 4.
|
4
|
+
stimulus_reflex (3.3.0)
|
5
|
+
cable_ready (>= 4.3.0)
|
6
6
|
nokogiri
|
7
7
|
rack
|
8
8
|
rails (>= 5.2)
|
9
|
+
redis
|
9
10
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
12
13
|
specs:
|
13
|
-
actioncable (6.0.3.
|
14
|
-
actionpack (= 6.0.3.
|
14
|
+
actioncable (6.0.3.3)
|
15
|
+
actionpack (= 6.0.3.3)
|
15
16
|
nio4r (~> 2.0)
|
16
17
|
websocket-driver (>= 0.6.1)
|
17
|
-
actionmailbox (6.0.3.
|
18
|
-
actionpack (= 6.0.3.
|
19
|
-
activejob (= 6.0.3.
|
20
|
-
activerecord (= 6.0.3.
|
21
|
-
activestorage (= 6.0.3.
|
22
|
-
activesupport (= 6.0.3.
|
18
|
+
actionmailbox (6.0.3.3)
|
19
|
+
actionpack (= 6.0.3.3)
|
20
|
+
activejob (= 6.0.3.3)
|
21
|
+
activerecord (= 6.0.3.3)
|
22
|
+
activestorage (= 6.0.3.3)
|
23
|
+
activesupport (= 6.0.3.3)
|
23
24
|
mail (>= 2.7.1)
|
24
|
-
actionmailer (6.0.3.
|
25
|
-
actionpack (= 6.0.3.
|
26
|
-
actionview (= 6.0.3.
|
27
|
-
activejob (= 6.0.3.
|
25
|
+
actionmailer (6.0.3.3)
|
26
|
+
actionpack (= 6.0.3.3)
|
27
|
+
actionview (= 6.0.3.3)
|
28
|
+
activejob (= 6.0.3.3)
|
28
29
|
mail (~> 2.5, >= 2.5.4)
|
29
30
|
rails-dom-testing (~> 2.0)
|
30
|
-
actionpack (6.0.3.
|
31
|
-
actionview (= 6.0.3.
|
32
|
-
activesupport (= 6.0.3.
|
31
|
+
actionpack (6.0.3.3)
|
32
|
+
actionview (= 6.0.3.3)
|
33
|
+
activesupport (= 6.0.3.3)
|
33
34
|
rack (~> 2.0, >= 2.0.8)
|
34
35
|
rack-test (>= 0.6.3)
|
35
36
|
rails-dom-testing (~> 2.0)
|
36
37
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
37
|
-
actiontext (6.0.3.
|
38
|
-
actionpack (= 6.0.3.
|
39
|
-
activerecord (= 6.0.3.
|
40
|
-
activestorage (= 6.0.3.
|
41
|
-
activesupport (= 6.0.3.
|
38
|
+
actiontext (6.0.3.3)
|
39
|
+
actionpack (= 6.0.3.3)
|
40
|
+
activerecord (= 6.0.3.3)
|
41
|
+
activestorage (= 6.0.3.3)
|
42
|
+
activesupport (= 6.0.3.3)
|
42
43
|
nokogiri (>= 1.8.5)
|
43
|
-
actionview (6.0.3.
|
44
|
-
activesupport (= 6.0.3.
|
44
|
+
actionview (6.0.3.3)
|
45
|
+
activesupport (= 6.0.3.3)
|
45
46
|
builder (~> 3.1)
|
46
47
|
erubi (~> 1.4)
|
47
48
|
rails-dom-testing (~> 2.0)
|
48
49
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
49
|
-
activejob (6.0.3.
|
50
|
-
activesupport (= 6.0.3.
|
50
|
+
activejob (6.0.3.3)
|
51
|
+
activesupport (= 6.0.3.3)
|
51
52
|
globalid (>= 0.3.6)
|
52
|
-
activemodel (6.0.3.
|
53
|
-
activesupport (= 6.0.3.
|
54
|
-
activerecord (6.0.3.
|
55
|
-
activemodel (= 6.0.3.
|
56
|
-
activesupport (= 6.0.3.
|
57
|
-
activestorage (6.0.3.
|
58
|
-
actionpack (= 6.0.3.
|
59
|
-
activejob (= 6.0.3.
|
60
|
-
activerecord (= 6.0.3.
|
53
|
+
activemodel (6.0.3.3)
|
54
|
+
activesupport (= 6.0.3.3)
|
55
|
+
activerecord (6.0.3.3)
|
56
|
+
activemodel (= 6.0.3.3)
|
57
|
+
activesupport (= 6.0.3.3)
|
58
|
+
activestorage (6.0.3.3)
|
59
|
+
actionpack (= 6.0.3.3)
|
60
|
+
activejob (= 6.0.3.3)
|
61
|
+
activerecord (= 6.0.3.3)
|
61
62
|
marcel (~> 0.3.1)
|
62
|
-
activesupport (6.0.3.
|
63
|
+
activesupport (6.0.3.3)
|
63
64
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
64
65
|
i18n (>= 0.7, < 2)
|
65
66
|
minitest (~> 5.1)
|
@@ -70,14 +71,14 @@ GEM
|
|
70
71
|
cable_ready (4.3.0)
|
71
72
|
rails (>= 5.2)
|
72
73
|
coderay (1.1.3)
|
73
|
-
concurrent-ruby (1.1.
|
74
|
+
concurrent-ruby (1.1.7)
|
74
75
|
crass (1.0.6)
|
75
76
|
erubi (1.9.0)
|
76
77
|
globalid (0.4.2)
|
77
78
|
activesupport (>= 4.2.0)
|
78
|
-
i18n (1.8.
|
79
|
+
i18n (1.8.5)
|
79
80
|
concurrent-ruby (~> 1.0)
|
80
|
-
loofah (2.
|
81
|
+
loofah (2.7.0)
|
81
82
|
crass (~> 1.0.2)
|
82
83
|
nokogiri (>= 1.5.9)
|
83
84
|
mail (2.7.1)
|
@@ -88,8 +89,8 @@ GEM
|
|
88
89
|
mimemagic (0.3.5)
|
89
90
|
mini_mime (1.0.2)
|
90
91
|
mini_portile2 (2.4.0)
|
91
|
-
minitest (5.14.
|
92
|
-
nio4r (2.5.
|
92
|
+
minitest (5.14.2)
|
93
|
+
nio4r (2.5.4)
|
93
94
|
nokogiri (1.10.10)
|
94
95
|
mini_portile2 (~> 2.4.0)
|
95
96
|
parallel (1.19.2)
|
@@ -103,60 +104,61 @@ GEM
|
|
103
104
|
rack (2.2.3)
|
104
105
|
rack-test (1.1.0)
|
105
106
|
rack (>= 1.0, < 3)
|
106
|
-
rails (6.0.3.
|
107
|
-
actioncable (= 6.0.3.
|
108
|
-
actionmailbox (= 6.0.3.
|
109
|
-
actionmailer (= 6.0.3.
|
110
|
-
actionpack (= 6.0.3.
|
111
|
-
actiontext (= 6.0.3.
|
112
|
-
actionview (= 6.0.3.
|
113
|
-
activejob (= 6.0.3.
|
114
|
-
activemodel (= 6.0.3.
|
115
|
-
activerecord (= 6.0.3.
|
116
|
-
activestorage (= 6.0.3.
|
117
|
-
activesupport (= 6.0.3.
|
107
|
+
rails (6.0.3.3)
|
108
|
+
actioncable (= 6.0.3.3)
|
109
|
+
actionmailbox (= 6.0.3.3)
|
110
|
+
actionmailer (= 6.0.3.3)
|
111
|
+
actionpack (= 6.0.3.3)
|
112
|
+
actiontext (= 6.0.3.3)
|
113
|
+
actionview (= 6.0.3.3)
|
114
|
+
activejob (= 6.0.3.3)
|
115
|
+
activemodel (= 6.0.3.3)
|
116
|
+
activerecord (= 6.0.3.3)
|
117
|
+
activestorage (= 6.0.3.3)
|
118
|
+
activesupport (= 6.0.3.3)
|
118
119
|
bundler (>= 1.3.0)
|
119
|
-
railties (= 6.0.3.
|
120
|
+
railties (= 6.0.3.3)
|
120
121
|
sprockets-rails (>= 2.0.0)
|
121
122
|
rails-dom-testing (2.0.3)
|
122
123
|
activesupport (>= 4.2.0)
|
123
124
|
nokogiri (>= 1.6)
|
124
125
|
rails-html-sanitizer (1.3.0)
|
125
126
|
loofah (~> 2.3)
|
126
|
-
railties (6.0.3.
|
127
|
-
actionpack (= 6.0.3.
|
128
|
-
activesupport (= 6.0.3.
|
127
|
+
railties (6.0.3.3)
|
128
|
+
actionpack (= 6.0.3.3)
|
129
|
+
activesupport (= 6.0.3.3)
|
129
130
|
method_source
|
130
131
|
rake (>= 0.8.7)
|
131
132
|
thor (>= 0.20.3, < 2.0)
|
132
133
|
rainbow (3.0.0)
|
133
134
|
rake (13.0.1)
|
135
|
+
redis (4.2.2)
|
134
136
|
regexp_parser (1.7.1)
|
135
137
|
rexml (3.2.4)
|
136
|
-
rubocop (0.
|
138
|
+
rubocop (0.89.1)
|
137
139
|
parallel (~> 1.10)
|
138
|
-
parser (>= 2.7.
|
140
|
+
parser (>= 2.7.1.1)
|
139
141
|
rainbow (>= 2.2.2, < 4.0)
|
140
142
|
regexp_parser (>= 1.7)
|
141
143
|
rexml
|
142
|
-
rubocop-ast (>= 0.0.
|
144
|
+
rubocop-ast (>= 0.3.0, < 1.0)
|
143
145
|
ruby-progressbar (~> 1.7)
|
144
146
|
unicode-display_width (>= 1.4.0, < 2.0)
|
145
|
-
rubocop-ast (0.
|
146
|
-
parser (>= 2.7.
|
147
|
-
rubocop-performance (1.
|
148
|
-
rubocop (>= 0.
|
147
|
+
rubocop-ast (0.3.0)
|
148
|
+
parser (>= 2.7.1.4)
|
149
|
+
rubocop-performance (1.7.1)
|
150
|
+
rubocop (>= 0.82.0)
|
149
151
|
ruby-progressbar (1.10.1)
|
150
152
|
sprockets (4.0.2)
|
151
153
|
concurrent-ruby (~> 1.0)
|
152
154
|
rack (> 1, < 3)
|
153
|
-
sprockets-rails (3.2.
|
155
|
+
sprockets-rails (3.2.2)
|
154
156
|
actionpack (>= 4.0)
|
155
157
|
activesupport (>= 4.0)
|
156
158
|
sprockets (>= 3.0.0)
|
157
|
-
standard (0.
|
158
|
-
rubocop (~> 0.
|
159
|
-
rubocop-performance (~> 1.
|
159
|
+
standard (0.5.2)
|
160
|
+
rubocop (~> 0.89.1)
|
161
|
+
rubocop-performance (~> 1.7.1)
|
160
162
|
standardrb (1.0.0)
|
161
163
|
standard
|
162
164
|
thor (1.0.1)
|
data/README.md
CHANGED
@@ -44,45 +44,51 @@
|
|
44
44
|
<br />
|
45
45
|
|
46
46
|
|
47
|
-
### 🎉 **
|
47
|
+
### 🎉 **An exciting new way to build modern, reactive, real-time apps with Ruby on Rails.**
|
48
48
|
|
49
49
|
StimulusReflex eliminates the complexity imposed by full-stack frontend frameworks.
|
50
50
|
And, it's fast.
|
51
51
|
|
52
52
|
It works seamlessly with the Rails tooling you already know and love.
|
53
53
|
|
54
|
-
-
|
55
|
-
-
|
56
|
-
- [Russian doll caching](https://edgeguides.rubyonrails.org/caching_with_rails.html#russian-doll-caching)
|
57
|
-
- [
|
58
|
-
- [
|
59
|
-
- etc...
|
54
|
+
- Server-rendered HTML, delivered in miliseconds over the wire via Websockets
|
55
|
+
- ERB templates and partials, with first-class [ViewComponent](https://github.com/github/view_component) support
|
56
|
+
- [Russian doll caching](https://edgeguides.rubyonrails.org/caching_with_rails.html#russian-doll-caching) and [ActiveJob](https://guides.rubyonrails.org/active_job_basics.html)
|
57
|
+
- [StimulusJS](https://stimulusjs.org/) and [Turbolinks](https://www.youtube.com/watch?v=SWEts0rlezA)
|
58
|
+
- Built with [CableReady](https://www.youtube.com/watch?v=dPzv2qsj5L8), our secret power-move
|
60
59
|
|
61
|
-
**
|
60
|
+
**Our goal is to help small teams do big things with familiar tools.**
|
62
61
|
|
63
62
|
This project strives to live up to the vision outlined in [The Rails Doctrine](https://rubyonrails.org/doctrine/).
|
64
63
|
|
65
64
|
## 📚 Docs
|
66
65
|
|
67
|
-
- [
|
66
|
+
- [StimulusReflex Documentation](https://docs.stimulusreflex.com)
|
67
|
+
- [CableReady Documentation](https://cableready.stimulusreflex.com)
|
68
68
|
|
69
69
|
## ✨ Demos
|
70
70
|
|
71
|
-
-
|
72
|
-
-
|
71
|
+
- [StimulusReflex Expo](http://expo.stimulusreflex.com) - part showcase, part learning tool
|
72
|
+
- [Build a Twitter Clone in 10 Minutes](https://youtu.be/F5hA79vKE_E) (video)
|
73
|
+
- [BoxDrop](https://dropbox-clone-rails.herokuapp.com/) - a Dropbox-inspired [concept demo](https://github.com/marcoroth/boxdrop/)
|
73
74
|
|
74
|
-
##
|
75
|
+
## 👩👩👧 Discord Community
|
75
76
|
|
76
|
-
|
77
|
-
- [Discord](https://discord.gg/XveN625) - chat root
|
77
|
+
Please join over 500 of us on [Discord](https://discord.gg/XveN625) for support getting started, as well as active discussions around Rails, StimulusJS and CableReady.
|
78
78
|
|
79
|
-
|
79
|
+
![](https://img.shields.io/discord/629472241427415060)
|
80
|
+
|
81
|
+
Stop by #newcomers and introduce yourselves!
|
82
|
+
|
83
|
+
## 💙 Support
|
80
84
|
|
81
|
-
|
82
|
-
|
83
|
-
|
85
|
+
Your best bet is to ask for help on Discord before filing an issue on Github. We are happy to help, and we ask people to come with all relevant code to look at. A git repo is preferred, but Gists or posts on [Discourse](https://stimulus-reflex.discourse.group) are fine, too.
|
86
|
+
|
87
|
+
Please note that we are not actively providing support on Stack Overflow. If you post there, we likely won't see it.
|
88
|
+
|
89
|
+
## 🚀 Install
|
84
90
|
|
85
|
-
|
91
|
+
CLI and manual setup procedures are fully detailed in the [official docs](https://docs.stimulusreflex.com/setup).
|
86
92
|
|
87
93
|
## 🙏 Contributing
|
88
94
|
|
@@ -1,56 +1,88 @@
|
|
1
1
|
import ApplicationController from './application_controller'
|
2
2
|
|
3
|
-
/* This is the custom StimulusReflex controller for <%= class_name %>Reflex.
|
3
|
+
/* This is the custom StimulusReflex controller for the <%= class_name %> Reflex.
|
4
4
|
* Learn more at: https://docs.stimulusreflex.com
|
5
5
|
*/
|
6
6
|
export default class extends ApplicationController {
|
7
|
+
/*
|
8
|
+
* Regular Stimulus lifecycle methods
|
9
|
+
* Learn more at: https://stimulusjs.org/reference/lifecycle-callbacks
|
10
|
+
*
|
11
|
+
* If you intend to use this controller as a regular stimulus controller as well,
|
12
|
+
* make sure any Stimulus lifecycle methods overridden in ApplicationController call super.
|
13
|
+
*
|
14
|
+
* Important:
|
15
|
+
* By default, StimulusReflex overrides the -connect- method so make sure you
|
16
|
+
* call super if you intend to do anything else when this controller connects.
|
17
|
+
*/
|
18
|
+
|
19
|
+
connect () {
|
20
|
+
super.connect()
|
21
|
+
// add your code here, if applicable
|
22
|
+
}
|
23
|
+
|
7
24
|
/* Reflex specific lifecycle methods.
|
8
|
-
*
|
9
|
-
*
|
25
|
+
*
|
26
|
+
* For every method defined in your Reflex class, a matching set of lifecycle methods become available
|
27
|
+
* in this javascript controller. These are optional, so feel free to delete these stubs if you don't
|
28
|
+
* need them.
|
29
|
+
*
|
30
|
+
* Important:
|
31
|
+
* Make sure to add data-controller="<%= class_name.underscore.dasherize %>" to your markup alongside
|
32
|
+
* data-reflex="<%= class_name %>#dance" for the lifecycle methods to fire properly.
|
10
33
|
*
|
11
34
|
* Example:
|
12
35
|
*
|
13
|
-
* <a href="#" data-reflex="<%= class_name %>
|
36
|
+
* <a href="#" data-reflex="click-><%= class_name %>#dance" data-controller="<%= class_name.underscore.dasherize %>">Dance!</a>
|
14
37
|
*
|
15
38
|
* Arguments:
|
16
39
|
*
|
17
40
|
* element - the element that triggered the reflex
|
18
41
|
* may be different than the Stimulus controller's this.element
|
19
42
|
*
|
20
|
-
* reflex - the name of the reflex e.g. "<%= class_name
|
43
|
+
* reflex - the name of the reflex e.g. "<%= class_name %>#dance"
|
44
|
+
*
|
45
|
+
* error/noop - the error message (for reflexError), otherwise null
|
21
46
|
*
|
22
|
-
*
|
47
|
+
* reflexId - a UUID4 or developer-provided unique identifier for each Reflex
|
23
48
|
*/
|
24
49
|
|
25
50
|
<% if actions.empty? -%>
|
26
|
-
//
|
27
|
-
//
|
51
|
+
// Assuming you create a "<%= class_name %>#dance" action in your Reflex class
|
52
|
+
// you'll be able to use the following lifecycle methods:
|
53
|
+
|
54
|
+
// beforeDance(element, reflex, noop, reflexId) {
|
55
|
+
// element.innerText = 'Putting dance shoes on...'
|
28
56
|
// }
|
29
57
|
|
30
|
-
//
|
31
|
-
// element.innerText = '
|
58
|
+
// danceSuccess(element, reflex, noop, reflexId) {
|
59
|
+
// element.innerText = 'Danced like no one was watching! Was someone watching?'
|
32
60
|
// }
|
33
61
|
|
34
|
-
//
|
35
|
-
// console.error('
|
36
|
-
// element.innerText = '
|
62
|
+
// danceError(element, reflex, error, reflexId) {
|
63
|
+
// console.error('danceError', error);
|
64
|
+
// element.innerText = "Couldn't dance!"
|
37
65
|
// }
|
38
66
|
<% end -%>
|
39
67
|
<% actions.each do |action| -%>
|
40
|
-
// <%= "before_#{action}".camelize(:lower) %>(element, reflex) {
|
41
|
-
// console.log("before <%= action %>", element, reflex)
|
68
|
+
// <%= "before_#{action}".camelize(:lower) %>(element, reflex, noop, reflexId) {
|
69
|
+
// console.log("before <%= action %>", element, reflex, reflexId)
|
70
|
+
// }
|
71
|
+
|
72
|
+
// <%= "#{action}_success".camelize(:lower) %>(element, reflex, noop, reflexId) {
|
73
|
+
// console.log("<%= action %> success", element, reflex, reflexId)
|
42
74
|
// }
|
43
75
|
|
44
|
-
// <%= "#{action}
|
45
|
-
// console.
|
76
|
+
// <%= "#{action}_error".camelize(:lower) %>(element, reflex, error, reflexId) {
|
77
|
+
// console.error("<%= action %> error", element, reflex, error, reflexId)
|
46
78
|
// }
|
47
79
|
|
48
|
-
// <%= "#{action}
|
49
|
-
// console.
|
80
|
+
// <%= "#{action}_halted".camelize(:lower) %>(element, reflex, noop, reflexId) {
|
81
|
+
// console.warn("<%= action %> halted", element, reflex, reflexId)
|
50
82
|
// }
|
51
83
|
|
52
|
-
// <%= "after_#{action}".camelize(:lower) %>(element, reflex,
|
53
|
-
// console.log("after <%= action %>", element, reflex,
|
84
|
+
// <%= "after_#{action}".camelize(:lower) %>(element, reflex, noop, reflexId) {
|
85
|
+
// console.log("after <%= action %>", element, reflex, reflexId)
|
54
86
|
// }
|
55
87
|
<%= "\n" unless action == actions.last -%>
|
56
88
|
<% end -%>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Controller } from 'stimulus'
|
2
2
|
import StimulusReflex from 'stimulus_reflex'
|
3
3
|
|
4
|
-
/* This is your
|
4
|
+
/* This is your ApplicationController.
|
5
5
|
* All StimulusReflex controllers should inherit from this class.
|
6
6
|
*
|
7
7
|
* Example:
|
@@ -17,7 +17,8 @@ export default class extends Controller {
|
|
17
17
|
StimulusReflex.register(this)
|
18
18
|
}
|
19
19
|
|
20
|
-
/* Application
|
20
|
+
/* Application-wide lifecycle methods
|
21
|
+
*
|
21
22
|
* Use these methods to handle lifecycle concerns for the entire application.
|
22
23
|
* Using the lifecycle is optional, so feel free to delete these stubs if you don't need them.
|
23
24
|
*
|
@@ -26,24 +27,26 @@ export default class extends Controller {
|
|
26
27
|
* element - the element that triggered the reflex
|
27
28
|
* may be different than the Stimulus controller's this.element
|
28
29
|
*
|
29
|
-
* reflex - the name of the reflex e.g. "
|
30
|
+
* reflex - the name of the reflex e.g. "Example#demo"
|
31
|
+
*
|
32
|
+
* error/noop - the error message (for reflexError), otherwise null
|
30
33
|
*
|
31
|
-
*
|
34
|
+
* reflexId - a UUID4 or developer-provided unique identifier for each Reflex
|
32
35
|
*/
|
33
36
|
|
34
|
-
beforeReflex (element, reflex) {
|
37
|
+
beforeReflex (element, reflex, noop, reflexId) {
|
35
38
|
// document.body.classList.add('wait')
|
36
39
|
}
|
37
40
|
|
38
|
-
reflexSuccess (element, reflex,
|
41
|
+
reflexSuccess (element, reflex, noop, reflexId) {
|
39
42
|
// show success message etc...
|
40
43
|
}
|
41
44
|
|
42
|
-
reflexError (element, reflex, error) {
|
45
|
+
reflexError (element, reflex, error, reflexId) {
|
43
46
|
// show error message etc...
|
44
47
|
}
|
45
48
|
|
46
|
-
afterReflex (element, reflex) {
|
49
|
+
afterReflex (element, reflex, noop, reflexId) {
|
47
50
|
// document.body.classList.remove('wait')
|
48
51
|
}
|
49
52
|
}
|
data/lib/stimulus_reflex.rb
CHANGED
@@ -12,6 +12,7 @@ require "stimulus_reflex/version"
|
|
12
12
|
require "stimulus_reflex/reflex"
|
13
13
|
require "stimulus_reflex/element"
|
14
14
|
require "stimulus_reflex/channel"
|
15
|
+
require "stimulus_reflex/sanity_checker"
|
15
16
|
require "stimulus_reflex/broadcasters/broadcaster"
|
16
17
|
require "stimulus_reflex/broadcasters/nothing_broadcaster"
|
17
18
|
require "stimulus_reflex/broadcasters/page_broadcaster"
|
@@ -20,5 +21,8 @@ require "generators/stimulus_reflex_generator"
|
|
20
21
|
|
21
22
|
module StimulusReflex
|
22
23
|
class Engine < Rails::Engine
|
24
|
+
initializer "stimulus_reflex.sanity_check" do
|
25
|
+
SanityChecker.check!
|
26
|
+
end
|
23
27
|
end
|
24
28
|
end
|
@@ -7,7 +7,6 @@ module StimulusReflex
|
|
7
7
|
selectors, html = morph
|
8
8
|
updates = selectors.is_a?(Hash) ? selectors : Hash[selectors, html]
|
9
9
|
updates.each do |selector, html|
|
10
|
-
last = morph == morphs.last && selector == updates.keys.last
|
11
10
|
html = html.to_s
|
12
11
|
fragment = Nokogiri::HTML.fragment(html)
|
13
12
|
match = fragment.at_css(selector)
|
@@ -18,8 +17,7 @@ module StimulusReflex
|
|
18
17
|
children_only: true,
|
19
18
|
permanent_attribute_name: permanent_attribute_name,
|
20
19
|
stimulus_reflex: data.merge({
|
21
|
-
|
22
|
-
broadast_type: to_sym
|
20
|
+
broadcaster: to_sym
|
23
21
|
})
|
24
22
|
)
|
25
23
|
else
|
@@ -27,8 +25,7 @@ module StimulusReflex
|
|
27
25
|
selector: selector,
|
28
26
|
html: fragment.to_html,
|
29
27
|
stimulus_reflex: data.merge({
|
30
|
-
|
31
|
-
broadast_type: to_sym
|
28
|
+
broadcaster: to_sym
|
32
29
|
})
|
33
30
|
)
|
34
31
|
end
|
@@ -1,6 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
module ApplicationCable
|
4
|
+
class Channel < ActionCable::Channel::Base
|
5
|
+
def initialize(connection, identifier, params = {})
|
6
|
+
super
|
7
|
+
application_channel = Rails.root.join("app", "channels", "application_cable", "channel.rb")
|
8
|
+
require application_channel if File.exist?(application_channel)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class StimulusReflex::Channel < ApplicationCable::Channel
|
4
14
|
def stream_name
|
5
15
|
ids = connection.identifiers.map { |identifier| send(identifier).try(:id) || send(identifier) }
|
6
16
|
[
|
@@ -10,6 +20,7 @@ class StimulusReflex::Channel < ActionCable::Channel::Base
|
|
10
20
|
end
|
11
21
|
|
12
22
|
def subscribed
|
23
|
+
super
|
13
24
|
stream_from stream_name
|
14
25
|
end
|
15
26
|
|
@@ -32,9 +43,15 @@ class StimulusReflex::Channel < ActionCable::Channel::Base
|
|
32
43
|
reflex = reflex_class.new(self, url: url, element: element, selectors: selectors, method_name: method_name, permanent_attribute_name: permanent_attribute_name, params: params)
|
33
44
|
delegate_call_to_reflex reflex, method_name, arguments
|
34
45
|
rescue => invoke_error
|
35
|
-
reflex&.rescue_with_handler(invoke_error)
|
36
46
|
message = exception_message_with_backtrace(invoke_error)
|
37
|
-
|
47
|
+
body = "StimulusReflex::Channel Failed to invoke #{target}! #{url} #{message}"
|
48
|
+
if reflex
|
49
|
+
reflex.rescue_with_handler(invoke_error)
|
50
|
+
reflex.broadcast_message subject: "error", body: body, data: data
|
51
|
+
else
|
52
|
+
logger.error "\e[31m#{body}\e[0m"
|
53
|
+
end
|
54
|
+
return
|
38
55
|
end
|
39
56
|
|
40
57
|
if reflex.halted?
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class StimulusReflex::SanityChecker
|
4
|
+
NODE_VERSION_FORMAT = /(\d+\.\d+\.\d+.*):/
|
5
|
+
JSON_VERSION_FORMAT = /(\d+\.\d+\.\d+.*)"/
|
6
|
+
|
7
|
+
def self.check!
|
8
|
+
instance = new
|
9
|
+
instance.check_caching_enabled
|
10
|
+
instance.check_javascript_package_version
|
11
|
+
end
|
12
|
+
|
13
|
+
def check_caching_enabled
|
14
|
+
unless caching_enabled?
|
15
|
+
puts <<~WARN
|
16
|
+
WARNING: Stimulus Reflex requires caching to be enabled. Caching allows the session to be modified during ActionCable requests.
|
17
|
+
To enable caching in development, run:
|
18
|
+
rails dev:cache
|
19
|
+
WARN
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def check_javascript_package_version
|
24
|
+
if javascript_package_version.nil?
|
25
|
+
puts <<~WARN
|
26
|
+
WARNING: Can't locate the stimulus_reflex NPM package.
|
27
|
+
Either add it to your package.json as a dependency or use "yarn link stimulus_reflex" if you are doing development.
|
28
|
+
WARN
|
29
|
+
end
|
30
|
+
|
31
|
+
unless javascript_version_matches?
|
32
|
+
puts <<~WARN
|
33
|
+
WARNING: The Stimulus Reflex javascript package version (#{javascript_package_version}) does not match the Rubygem version (#{gem_version}).
|
34
|
+
To update the Stimulus Reflex npm package:
|
35
|
+
yarn upgrade stimulus_reflex@#{gem_version}
|
36
|
+
WARN
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def caching_enabled?
|
43
|
+
Rails.application.config.action_controller.perform_caching &&
|
44
|
+
Rails.application.config.cache_store != :null_store
|
45
|
+
end
|
46
|
+
|
47
|
+
def javascript_version_matches?
|
48
|
+
javascript_package_version == gem_version
|
49
|
+
end
|
50
|
+
|
51
|
+
def gem_version
|
52
|
+
@_gem_version ||= StimulusReflex::VERSION.gsub(".pre", "-pre")
|
53
|
+
end
|
54
|
+
|
55
|
+
def javascript_package_version
|
56
|
+
return @_js_version if defined?(@_js_version)
|
57
|
+
@_js_version = find_javascript_package_version
|
58
|
+
end
|
59
|
+
|
60
|
+
def find_javascript_package_version
|
61
|
+
if (match = search_file(yarn_lock_path, regex: /^stimulus_reflex/))
|
62
|
+
match[NODE_VERSION_FORMAT, 1]
|
63
|
+
elsif (match = search_file(yarn_link_path, regex: /version/))
|
64
|
+
match[JSON_VERSION_FORMAT, 1]
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def search_file(path, regex:)
|
69
|
+
return unless File.exist?(path)
|
70
|
+
File.foreach(path).grep(regex).first
|
71
|
+
end
|
72
|
+
|
73
|
+
def yarn_lock_path
|
74
|
+
Rails.root.join("yarn.lock")
|
75
|
+
end
|
76
|
+
|
77
|
+
def yarn_link_path
|
78
|
+
Rails.root.join("node_modules", "stimulus_reflex", "package.json")
|
79
|
+
end
|
80
|
+
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "fileutils"
|
4
|
+
require "stimulus_reflex/version"
|
4
5
|
|
5
6
|
namespace :stimulus_reflex do
|
6
7
|
desc "Install StimulusReflex in this application"
|
7
8
|
task install: :environment do
|
8
9
|
system "bundle exec rails webpacker:install:stimulus"
|
9
|
-
|
10
|
+
gem_version = StimulusReflex::VERSION.gsub(".pre", "-pre")
|
11
|
+
system "yarn add stimulus_reflex@#{gem_version}"
|
10
12
|
|
11
13
|
FileUtils.mkdir_p Rails.root.join("app/javascript/controllers"), verbose: true
|
12
14
|
FileUtils.mkdir_p Rails.root.join("app/reflexes"), verbose: true
|
@@ -50,6 +52,16 @@ namespace :stimulus_reflex do
|
|
50
52
|
File.open(filepath, "w") { |f| f.write lines.join }
|
51
53
|
end
|
52
54
|
|
55
|
+
filepath = Rails.root.join("config/cable.yml")
|
56
|
+
lines = File.open(filepath, "r") { |f| f.readlines }
|
57
|
+
if lines[1].include?("adapter: async")
|
58
|
+
lines.delete_at 1
|
59
|
+
lines.insert 1, " adapter: redis\n"
|
60
|
+
lines.insert 2, " url: <%= ENV.fetch(\"REDIS_URL\") { \"redis://localhost:6379/1\" } %>\n"
|
61
|
+
lines.insert 3, " channel_prefix: " + Rails.application.class.module_parent.to_s.underscore + "_development\n"
|
62
|
+
File.open(filepath, "w") { |f| f.write lines.join }
|
63
|
+
end
|
64
|
+
|
53
65
|
system "bundle exec rails generate stimulus_reflex example"
|
54
66
|
system "rails dev:cache" unless Rails.root.join("tmp", "caching-dev.txt").exist?
|
55
67
|
end
|
@@ -11,7 +11,7 @@ class StimulusReflexGeneratorTest < Rails::Generators::TestCase
|
|
11
11
|
test "creates singular named controller and reflex files" do
|
12
12
|
run_generator %w[demo]
|
13
13
|
assert_file "app/javascript/controllers/application_controller.js"
|
14
|
-
assert_file "app/javascript/controllers/demo_controller.js", /
|
14
|
+
assert_file "app/javascript/controllers/demo_controller.js", /Demo/
|
15
15
|
assert_file "app/reflexes/application_reflex.rb"
|
16
16
|
assert_file "app/reflexes/demo_reflex.rb", /DemoReflex/
|
17
17
|
end
|
@@ -19,7 +19,7 @@ class StimulusReflexGeneratorTest < Rails::Generators::TestCase
|
|
19
19
|
test "creates plural named controller and reflex files" do
|
20
20
|
run_generator %w[posts]
|
21
21
|
assert_file "app/javascript/controllers/application_controller.js"
|
22
|
-
assert_file "app/javascript/controllers/posts_controller.js", /
|
22
|
+
assert_file "app/javascript/controllers/posts_controller.js", /Posts/
|
23
23
|
assert_file "app/reflexes/application_reflex.rb"
|
24
24
|
assert_file "app/reflexes/posts_reflex.rb", /PostsReflex/
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stimulus_reflex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.0
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Hopkins
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -58,14 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 4.
|
61
|
+
version: 4.3.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 4.
|
68
|
+
version: 4.3.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: redis
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,7 +150,7 @@ dependencies:
|
|
136
150
|
- - ">="
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: '0'
|
139
|
-
description:
|
153
|
+
description:
|
140
154
|
email:
|
141
155
|
- natehop@gmail.com
|
142
156
|
executables: []
|
@@ -169,14 +183,11 @@ files:
|
|
169
183
|
- lib/stimulus_reflex/channel.rb
|
170
184
|
- lib/stimulus_reflex/element.rb
|
171
185
|
- lib/stimulus_reflex/reflex.rb
|
186
|
+
- lib/stimulus_reflex/sanity_checker.rb
|
172
187
|
- lib/stimulus_reflex/version.rb
|
173
188
|
- lib/tasks/stimulus_reflex/install.rake
|
174
|
-
- stimulus_reflex.gemspec
|
175
|
-
- tags
|
176
189
|
- test/generators/stimulus_reflex_generator_test.rb
|
177
190
|
- test/test_helper.rb
|
178
|
-
- test/tmp/app/reflexes/application_reflex.rb
|
179
|
-
- test/tmp/app/reflexes/demo_reflex.rb
|
180
191
|
homepage: https://github.com/hopsoft/stimulus_reflex
|
181
192
|
licenses:
|
182
193
|
- MIT
|
@@ -201,16 +212,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
212
|
version: '0'
|
202
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
214
|
requirements:
|
204
|
-
- - "
|
215
|
+
- - ">="
|
205
216
|
- !ruby/object:Gem::Version
|
206
|
-
version:
|
217
|
+
version: '0'
|
207
218
|
requirements: []
|
208
|
-
rubygems_version: 3.0.
|
209
|
-
signing_key:
|
219
|
+
rubygems_version: 3.0.6
|
220
|
+
signing_key:
|
210
221
|
specification_version: 4
|
211
222
|
summary: Build reactive applications with the Rails tooling you already know and love.
|
212
223
|
test_files:
|
213
|
-
- test/test_helper.rb
|
214
224
|
- test/generators/stimulus_reflex_generator_test.rb
|
215
|
-
- test/
|
216
|
-
- test/tmp/app/reflexes/application_reflex.rb
|
225
|
+
- test/test_helper.rb
|
data/stimulus_reflex.gemspec
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require File.expand_path("../lib/stimulus_reflex/version", __FILE__)
|
2
|
-
|
3
|
-
Gem::Specification.new do |gem|
|
4
|
-
gem.name = "stimulus_reflex"
|
5
|
-
gem.license = "MIT"
|
6
|
-
gem.version = StimulusReflex::VERSION
|
7
|
-
gem.authors = ["Nathan Hopkins"]
|
8
|
-
gem.email = ["natehop@gmail.com"]
|
9
|
-
gem.homepage = "https://github.com/hopsoft/stimulus_reflex"
|
10
|
-
gem.summary = "Build reactive applications with the Rails tooling you already know and love."
|
11
|
-
gem.post_install_message = <<~MESSAGE
|
12
|
-
Friendly reminder: When updating the stimulus_reflex gem,
|
13
|
-
don't forget to update your npm package as well.
|
14
|
-
|
15
|
-
See https://www.npmjs.com/package/stimulus_reflex
|
16
|
-
MESSAGE
|
17
|
-
|
18
|
-
gem.metadata = {
|
19
|
-
"bug_tracker_uri" => "https://github.com/hopsoft/stimulus_reflex/issues",
|
20
|
-
"changelog_uri" => "https://github.com/hopsoft/stimulus_reflex/CHANGELOG.md",
|
21
|
-
"documentation_uri" => "https://docs.stimulusreflex.com",
|
22
|
-
"homepage_uri" => gem.homepage,
|
23
|
-
"source_code_uri" => gem.homepage
|
24
|
-
}
|
25
|
-
|
26
|
-
gem.files = Dir["lib/**/*", "bin/*", "[A-Z]*"]
|
27
|
-
gem.test_files = Dir["test/**/*.rb"]
|
28
|
-
|
29
|
-
gem.add_dependency "rack"
|
30
|
-
gem.add_dependency "nokogiri"
|
31
|
-
gem.add_dependency "rails", ">= 5.2"
|
32
|
-
gem.add_dependency "cable_ready", ">= 4.1.2"
|
33
|
-
|
34
|
-
gem.add_development_dependency "bundler", "~> 2.0"
|
35
|
-
gem.add_development_dependency "pry-nav"
|
36
|
-
gem.add_development_dependency "pry"
|
37
|
-
gem.add_development_dependency "rake"
|
38
|
-
gem.add_development_dependency "standardrb"
|
39
|
-
end
|
data/tags
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
|
2
|
-
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
|
3
|
-
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
|
4
|
-
!_TAG_PROGRAM_NAME Exuberant Ctags //
|
5
|
-
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
|
6
|
-
!_TAG_PROGRAM_VERSION 5.8 //
|
7
|
-
ApplicationReflex test/tmp/app/reflexes/application_reflex.rb /^class ApplicationReflex < StimulusReflex::Reflex$/;" c
|
8
|
-
Broadcaster lib/stimulus_reflex/broadcasters/broadcaster.rb /^ class Broadcaster$/;" c class:StimulusReflex
|
9
|
-
DemoReflex test/tmp/app/reflexes/demo_reflex.rb /^class DemoReflex < ApplicationReflex$/;" c
|
10
|
-
Engine lib/stimulus_reflex.rb /^ class Engine < Rails::Engine$/;" c class:StimulusReflex
|
11
|
-
NothingBroadcaster lib/stimulus_reflex/broadcasters/nothing_broadcaster.rb /^ class NothingBroadcaster < Broadcaster$/;" c class:StimulusReflex
|
12
|
-
PageBroadcaster lib/stimulus_reflex/broadcasters/page_broadcaster.rb /^ class PageBroadcaster < Broadcaster$/;" c class:StimulusReflex
|
13
|
-
SelectorBroadcaster lib/stimulus_reflex/broadcasters/selector_broadcaster.rb /^ class SelectorBroadcaster < Broadcaster$/;" c class:StimulusReflex
|
14
|
-
StimulusReflex lib/stimulus_reflex.rb /^module StimulusReflex$/;" m
|
15
|
-
StimulusReflex lib/stimulus_reflex/broadcasters/broadcaster.rb /^module StimulusReflex$/;" m
|
16
|
-
StimulusReflex lib/stimulus_reflex/broadcasters/nothing_broadcaster.rb /^module StimulusReflex$/;" m
|
17
|
-
StimulusReflex lib/stimulus_reflex/broadcasters/page_broadcaster.rb /^module StimulusReflex$/;" m
|
18
|
-
StimulusReflex lib/stimulus_reflex/broadcasters/selector_broadcaster.rb /^module StimulusReflex$/;" m
|
19
|
-
StimulusReflex lib/stimulus_reflex/channel.rb /^class StimulusReflex::Channel < ActionCable::Channel::Base$/;" c
|
20
|
-
StimulusReflex lib/stimulus_reflex/element.rb /^class StimulusReflex::Element < OpenStruct$/;" c
|
21
|
-
StimulusReflex lib/stimulus_reflex/reflex.rb /^class StimulusReflex::Reflex$/;" c
|
22
|
-
StimulusReflex lib/stimulus_reflex/version.rb /^module StimulusReflex$/;" m
|
23
|
-
StimulusReflexGenerator lib/generators/stimulus_reflex_generator.rb /^class StimulusReflexGenerator < Rails::Generators::NamedBase$/;" c
|
24
|
-
StimulusReflexGeneratorTest test/generators/stimulus_reflex_generator_test.rb /^class StimulusReflexGeneratorTest < Rails::Generators::TestCase$/;" c
|
25
|
-
add_callback lib/stimulus_reflex/reflex.rb /^ def add_callback(kind, *args, &block)$/;" f class:StimulusReflex
|
26
|
-
after_reflex lib/stimulus_reflex/reflex.rb /^ def after_reflex(*args, &block)$/;" f class:StimulusReflex
|
27
|
-
around_reflex lib/stimulus_reflex/reflex.rb /^ def around_reflex(*args, &block)$/;" f class:StimulusReflex
|
28
|
-
before_reflex lib/stimulus_reflex/reflex.rb /^ def before_reflex(*args, &block)$/;" f class:StimulusReflex
|
29
|
-
broadcast lib/stimulus_reflex/broadcasters/broadcaster.rb /^ def broadcast(*args)$/;" f class:StimulusReflex.Broadcaster
|
30
|
-
broadcast lib/stimulus_reflex/broadcasters/nothing_broadcaster.rb /^ def broadcast(_, data)$/;" f class:StimulusReflex.NothingBroadcaster
|
31
|
-
broadcast lib/stimulus_reflex/broadcasters/page_broadcaster.rb /^ def broadcast(selectors, data)$/;" f class:StimulusReflex.PageBroadcaster
|
32
|
-
broadcast lib/stimulus_reflex/broadcasters/selector_broadcaster.rb /^ def broadcast(_, data = {})$/;" f class:StimulusReflex.SelectorBroadcaster
|
33
|
-
broadcast_message lib/stimulus_reflex/broadcasters/broadcaster.rb /^ def broadcast_message(subject:, body: nil, data: {})$/;" f class:StimulusReflex.Broadcaster
|
34
|
-
commit_session lib/stimulus_reflex/channel.rb /^ def commit_session(reflex)$/;" f class:StimulusReflex
|
35
|
-
controller lib/stimulus_reflex/reflex.rb /^ def controller$/;" f
|
36
|
-
copy_application_files lib/generators/stimulus_reflex_generator.rb /^ def copy_application_files$/;" f class:StimulusReflexGenerator
|
37
|
-
dataset lib/stimulus_reflex/element.rb /^ def dataset$/;" f class:StimulusReflex
|
38
|
-
default_reflex lib/stimulus_reflex/reflex.rb /^ def default_reflex$/;" f
|
39
|
-
delegate_call_to_reflex lib/stimulus_reflex/channel.rb /^ def delegate_call_to_reflex(reflex, method_name, arguments = [])$/;" f class:StimulusReflex
|
40
|
-
enqueue_message lib/stimulus_reflex/broadcasters/broadcaster.rb /^ def enqueue_message(subject:, body: nil, data: {})$/;" f class:StimulusReflex.Broadcaster
|
41
|
-
error javascript/log.js /^function error (response) {$/;" f
|
42
|
-
exception_message_with_backtrace lib/stimulus_reflex/channel.rb /^ def exception_message_with_backtrace(exception)$/;" f class:StimulusReflex
|
43
|
-
execute lib/generators/stimulus_reflex_generator.rb /^ def execute$/;" f class:StimulusReflexGenerator
|
44
|
-
export.reflexAttribute javascript/schema.js /^ reflexAttribute: 'data-reflex',$/;" p
|
45
|
-
export.reflexDatasetAttribute javascript/schema.js /^ reflexDatasetAttribute: 'data-reflex-dataset'$/;" p
|
46
|
-
export.reflexPermanentAttribute javascript/schema.js /^ reflexPermanentAttribute: 'data-reflex-permanent',$/;" p
|
47
|
-
export.reflexRootAttribute javascript/schema.js /^ reflexRootAttribute: 'data-reflex-root',$/;" p
|
48
|
-
findConsumer javascript/consumer.js /^function findConsumer (object, depth = 0) {$/;" f
|
49
|
-
function.success javascript/log.js /^function success (response, options = { halted: false }) {$/;" f
|
50
|
-
halted? lib/stimulus_reflex/reflex.rb /^ def halted?$/;" f
|
51
|
-
initialize lib/stimulus_reflex/broadcasters/broadcaster.rb /^ def initialize(reflex)$/;" f class:StimulusReflex.Broadcaster
|
52
|
-
initialize lib/stimulus_reflex/element.rb /^ def initialize(data = {})$/;" f class:StimulusReflex
|
53
|
-
initialize lib/stimulus_reflex/reflex.rb /^ def initialize(channel, url: nil, element: nil, selectors: [], method_name: nil, permanent_attribute_name: nil, params: {})$/;" f
|
54
|
-
is_reflex? lib/stimulus_reflex/channel.rb /^ def is_reflex?(reflex_class)$/;" f class:StimulusReflex
|
55
|
-
morph lib/stimulus_reflex/reflex.rb /^ def morph(selectors, html = "")$/;" f
|
56
|
-
morphs lib/stimulus_reflex/broadcasters/selector_broadcaster.rb /^ def morphs$/;" f class:StimulusReflex.SelectorBroadcaster
|
57
|
-
normalize_callback_option! lib/stimulus_reflex/reflex.rb /^ def normalize_callback_option!(options, from, to)$/;" f class:StimulusReflex
|
58
|
-
normalize_callback_options! lib/stimulus_reflex/reflex.rb /^ def normalize_callback_options!(options)$/;" f class:StimulusReflex
|
59
|
-
nothing? lib/stimulus_reflex/broadcasters/broadcaster.rb /^ def nothing?$/;" f class:StimulusReflex.Broadcaster
|
60
|
-
nothing? lib/stimulus_reflex/broadcasters/nothing_broadcaster.rb /^ def nothing?$/;" f class:StimulusReflex.NothingBroadcaster
|
61
|
-
object_with_indifferent_access lib/stimulus_reflex/channel.rb /^ def object_with_indifferent_access(object)$/;" f class:StimulusReflex
|
62
|
-
page? lib/stimulus_reflex/broadcasters/broadcaster.rb /^ def page?$/;" f class:StimulusReflex.Broadcaster
|
63
|
-
page? lib/stimulus_reflex/broadcasters/page_broadcaster.rb /^ def page?$/;" f class:StimulusReflex.PageBroadcaster
|
64
|
-
params lib/stimulus_reflex/reflex.rb /^ def params$/;" f
|
65
|
-
process lib/stimulus_reflex/reflex.rb /^ def process(name, *args)$/;" f
|
66
|
-
receive lib/stimulus_reflex/channel.rb /^ def receive(data)$/;" f class:StimulusReflex
|
67
|
-
request lib/stimulus_reflex/reflex.rb /^ def request$/;" f
|
68
|
-
selector? lib/stimulus_reflex/broadcasters/broadcaster.rb /^ def selector?$/;" f class:StimulusReflex.Broadcaster
|
69
|
-
selector? lib/stimulus_reflex/broadcasters/selector_broadcaster.rb /^ def selector?$/;" f class:StimulusReflex.SelectorBroadcaster
|
70
|
-
stream_name lib/stimulus_reflex/channel.rb /^ def stream_name$/;" f class:StimulusReflex
|
71
|
-
subscribed lib/stimulus_reflex/channel.rb /^ def subscribed$/;" f class:StimulusReflex
|
72
|
-
to_sym lib/stimulus_reflex/broadcasters/broadcaster.rb /^ def to_sym$/;" f class:StimulusReflex.Broadcaster
|
73
|
-
to_sym lib/stimulus_reflex/broadcasters/nothing_broadcaster.rb /^ def to_sym$/;" f class:StimulusReflex.NothingBroadcaster
|
74
|
-
to_sym lib/stimulus_reflex/broadcasters/page_broadcaster.rb /^ def to_sym$/;" f class:StimulusReflex.PageBroadcaster
|
75
|
-
to_sym lib/stimulus_reflex/broadcasters/selector_broadcaster.rb /^ def to_sym$/;" f class:StimulusReflex.SelectorBroadcaster
|
76
|
-
url_params lib/stimulus_reflex/reflex.rb /^ def url_params$/;" f
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class ApplicationReflex < StimulusReflex::Reflex
|
4
|
-
# Put application wide Reflex behavior in this file.
|
5
|
-
#
|
6
|
-
# Example:
|
7
|
-
#
|
8
|
-
# # If your ActionCable connection is: `identified_by :current_user`
|
9
|
-
# delegate :current_user, to: :connection
|
10
|
-
#
|
11
|
-
# Learn more at: https://docs.stimulusreflex.com
|
12
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class DemoReflex < ApplicationReflex
|
4
|
-
# Add Reflex methods in this file.
|
5
|
-
#
|
6
|
-
# All Reflex instances expose the following properties:
|
7
|
-
#
|
8
|
-
# - connection - the ActionCable connection
|
9
|
-
# - channel - the ActionCable channel
|
10
|
-
# - request - an ActionDispatch::Request proxy for the socket connection
|
11
|
-
# - session - the ActionDispatch::Session store for the current visitor
|
12
|
-
# - url - the URL of the page that triggered the reflex
|
13
|
-
# - element - a Hash like object that represents the HTML element that triggered the reflex
|
14
|
-
# - params - parameters from the element's closest form (if any)
|
15
|
-
#
|
16
|
-
# Example:
|
17
|
-
#
|
18
|
-
# def example(argument=true)
|
19
|
-
# # Your logic here...
|
20
|
-
# # Any declared instance variables will be made available to the Rails controller and view.
|
21
|
-
# end
|
22
|
-
#
|
23
|
-
# Learn more at: https://docs.stimulusreflex.com
|
24
|
-
|
25
|
-
end
|