maquina 0.4.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -0
  3. data/Gemfile +1 -0
  4. data/Gemfile.lock +163 -179
  5. data/app/controllers/concerns/maquina/authenticate.rb +33 -13
  6. data/app/controllers/concerns/maquina/resourceful.rb +1 -1
  7. data/app/controllers/maquina/first_runs_controller.rb +43 -0
  8. data/app/controllers/maquina/sessions_controller.rb +22 -25
  9. data/app/helpers/maquina/application_helper.rb +3 -5
  10. data/app/models/concerns/maquina/searchable.rb +4 -0
  11. data/app/models/maquina/organization.rb +2 -0
  12. data/app/models/maquina/user.rb +2 -0
  13. data/app/views/layouts/maquina/sessions.html.erb +6 -4
  14. data/app/views/maquina/accept_invitations/new_view.rb +1 -1
  15. data/app/views/maquina/application/alert.rb +4 -4
  16. data/app/views/maquina/application/components/action_text_component.rb +1 -1
  17. data/app/views/maquina/application/components/checkbox_component.rb +1 -1
  18. data/app/views/maquina/application/components/date_component.rb +1 -1
  19. data/app/views/maquina/application/components/file_component.rb +1 -1
  20. data/app/views/maquina/application/components/input_component.rb +1 -1
  21. data/app/views/maquina/application/components/select_component.rb +1 -1
  22. data/app/views/maquina/application/components/text_area_component.rb +1 -1
  23. data/app/views/maquina/application/edit.rb +1 -1
  24. data/app/views/maquina/application/form.rb +1 -1
  25. data/app/views/maquina/application/index_header.rb +1 -1
  26. data/app/views/maquina/application/index_modal.rb +1 -1
  27. data/app/views/maquina/application/index_table.rb +1 -1
  28. data/app/views/maquina/application/new.rb +1 -1
  29. data/app/views/maquina/application/sessions_header.rb +5 -3
  30. data/app/views/maquina/application_view.rb +1 -1
  31. data/app/views/maquina/first_runs/form.rb +28 -0
  32. data/app/views/maquina/first_runs/show.html.erb +5 -0
  33. data/app/views/maquina/form.rb +44 -0
  34. data/app/views/maquina/navbar/menu.rb +1 -1
  35. data/app/views/maquina/navbar/menu_item_link.rb +1 -1
  36. data/app/views/maquina/navbar/mobile_button.rb +1 -1
  37. data/app/views/maquina/navbar/mobile_menu.rb +1 -1
  38. data/app/views/maquina/navbar/notification.rb +1 -1
  39. data/app/views/maquina/navbar/profile.rb +1 -1
  40. data/app/views/maquina/navbar/profile_button.rb +1 -1
  41. data/app/views/maquina/navbar/profile_menu.rb +1 -1
  42. data/app/views/maquina/navbar/profile_menu_item_link.rb +1 -1
  43. data/app/views/maquina/navbar/search.rb +1 -1
  44. data/app/views/maquina/navbar/title.rb +1 -1
  45. data/app/views/maquina/sessions/form.rb +3 -4
  46. data/app/views/maquina/sessions/new.html.erb +1 -4
  47. data/config/importmap.rb +7 -6
  48. data/config/locales/flash.es.yml +14 -5
  49. data/config/locales/forms.es.yml +13 -1
  50. data/config/locales/models.es.yml +1 -0
  51. data/config/locales/views.es.yml +8 -0
  52. data/config/routes.rb +1 -0
  53. data/lib/generators/maquina/install_stimulus_controllers/install_stimulus_controllers_generator.rb +23 -0
  54. data/lib/maquina/version.rb +1 -1
  55. data/lib/maquina.rb +2 -2
  56. metadata +31 -74
  57. data/app/views/maquina/sessions/create.turbo_stream.erb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff7934937d226b48ad2b19332b6292ee45532039475cf4d7479f0f5500464239
4
- data.tar.gz: d33cc955289dbb1336cdac3be95c9eea12f5e7f380c225f1503272766820e763
3
+ metadata.gz: e51a9efb272de4b998c5f61912374dbebbc5b869f59032bbee8144ab281e7ab1
4
+ data.tar.gz: a7a2f654e839f0b354f9318956fd2591968946394ddbc269eaa44e1b10e1009b
5
5
  SHA512:
6
- metadata.gz: dd2f9053d11c84e30e64c62ccc48305449b66db8ccae4386c55d863734780f65e04490941e5fd25e805795472702543cc8624cb964f58d4ea027162d72371e58
7
- data.tar.gz: 24035729ba026356996c0401e4e90f2ff99d3e5f4fd77f1731f393527b3558386872cbb82ac7aecb829ef37d8a5e8a06e573a16dca4d9ced50ddd45f94248f21
6
+ metadata.gz: 94aed90ec94af63c1e55d155b3cebe623eeb5e4d1443cf6c0504292de215d88e7cb738bc9c6c7d3bcdae950926fc0c79b3658ab5d59e22fb5e4418743d21aa8e
7
+ data.tar.gz: 06d69def1b1e34e7b425d030850504cca5ca7363efcb2b4c3d298020a55f8ccd705fd5a9ccc2e7e4b3748b83ebae21d206423fbb5779034fa956f15bff4e9478
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.4
data/Gemfile CHANGED
@@ -6,6 +6,7 @@ gemspec
6
6
 
7
7
  gem "irb"
8
8
  gem "pg"
9
+ gem "pg_search"
9
10
  gem "puma"
10
11
  gem "propshaft"
11
12
  gem "tailwindcss-rails"
data/Gemfile.lock CHANGED
@@ -1,153 +1,149 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- maquina (0.4.0)
5
- action_policy (~> 0.6.0)
6
- bcrypt (~> 3.1.7)
7
- importmap-rails (~> 1.2.0)
8
- money-rails (~> 1.15.0)
9
- pagy (~> 6.2)
10
- pg_search (~> 2.3.0)
11
- phlex-rails (~> 1.1.0)
4
+ maquina (0.5.1)
5
+ action_policy (>= 0.6.0)
6
+ bcrypt (>= 3.1.7)
7
+ importmap-rails (>= 2.0.0)
8
+ money-rails (>= 1.15.0)
9
+ pagy (>= 6.2)
10
+ phlex-rails (>= 1.1.0)
12
11
  rails (>= 7.0.4)
13
- rotp (~> 6.2, >= 6.2.1)
14
- stimulus-rails (~> 1.3.0)
15
- tailwindcss-rails (~> 2.1.0)
16
- turbo-rails (~> 1.5.0)
12
+ rotp (>= 6.2.1)
13
+ stimulus-rails (>= 1.3.0)
14
+ tailwindcss-rails (>= 2.1.0)
15
+ turbo-rails (>= 2.0.0)
17
16
 
18
17
  GEM
19
18
  remote: https://rubygems.org/
20
19
  specs:
21
- action_policy (0.6.7)
22
- ruby-next-core (>= 0.14.0)
23
- actioncable (7.1.2)
24
- actionpack (= 7.1.2)
25
- activesupport (= 7.1.2)
20
+ action_policy (0.7.1)
21
+ ruby-next-core (>= 1.0)
22
+ actioncable (7.2.1)
23
+ actionpack (= 7.2.1)
24
+ activesupport (= 7.2.1)
26
25
  nio4r (~> 2.0)
27
26
  websocket-driver (>= 0.6.1)
28
27
  zeitwerk (~> 2.6)
29
- actionmailbox (7.1.2)
30
- actionpack (= 7.1.2)
31
- activejob (= 7.1.2)
32
- activerecord (= 7.1.2)
33
- activestorage (= 7.1.2)
34
- activesupport (= 7.1.2)
35
- mail (>= 2.7.1)
36
- net-imap
37
- net-pop
38
- net-smtp
39
- actionmailer (7.1.2)
40
- actionpack (= 7.1.2)
41
- actionview (= 7.1.2)
42
- activejob (= 7.1.2)
43
- activesupport (= 7.1.2)
44
- mail (~> 2.5, >= 2.5.4)
45
- net-imap
46
- net-pop
47
- net-smtp
28
+ actionmailbox (7.2.1)
29
+ actionpack (= 7.2.1)
30
+ activejob (= 7.2.1)
31
+ activerecord (= 7.2.1)
32
+ activestorage (= 7.2.1)
33
+ activesupport (= 7.2.1)
34
+ mail (>= 2.8.0)
35
+ actionmailer (7.2.1)
36
+ actionpack (= 7.2.1)
37
+ actionview (= 7.2.1)
38
+ activejob (= 7.2.1)
39
+ activesupport (= 7.2.1)
40
+ mail (>= 2.8.0)
48
41
  rails-dom-testing (~> 2.2)
49
- actionpack (7.1.2)
50
- actionview (= 7.1.2)
51
- activesupport (= 7.1.2)
42
+ actionpack (7.2.1)
43
+ actionview (= 7.2.1)
44
+ activesupport (= 7.2.1)
52
45
  nokogiri (>= 1.8.5)
53
46
  racc
54
- rack (>= 2.2.4)
47
+ rack (>= 2.2.4, < 3.2)
55
48
  rack-session (>= 1.0.1)
56
49
  rack-test (>= 0.6.3)
57
50
  rails-dom-testing (~> 2.2)
58
51
  rails-html-sanitizer (~> 1.6)
59
- actiontext (7.1.2)
60
- actionpack (= 7.1.2)
61
- activerecord (= 7.1.2)
62
- activestorage (= 7.1.2)
63
- activesupport (= 7.1.2)
52
+ useragent (~> 0.16)
53
+ actiontext (7.2.1)
54
+ actionpack (= 7.2.1)
55
+ activerecord (= 7.2.1)
56
+ activestorage (= 7.2.1)
57
+ activesupport (= 7.2.1)
64
58
  globalid (>= 0.6.0)
65
59
  nokogiri (>= 1.8.5)
66
- actionview (7.1.2)
67
- activesupport (= 7.1.2)
60
+ actionview (7.2.1)
61
+ activesupport (= 7.2.1)
68
62
  builder (~> 3.1)
69
63
  erubi (~> 1.11)
70
64
  rails-dom-testing (~> 2.2)
71
65
  rails-html-sanitizer (~> 1.6)
72
- activejob (7.1.2)
73
- activesupport (= 7.1.2)
66
+ activejob (7.2.1)
67
+ activesupport (= 7.2.1)
74
68
  globalid (>= 0.3.6)
75
- activemodel (7.1.2)
76
- activesupport (= 7.1.2)
77
- activerecord (7.1.2)
78
- activemodel (= 7.1.2)
79
- activesupport (= 7.1.2)
69
+ activemodel (7.2.1)
70
+ activesupport (= 7.2.1)
71
+ activerecord (7.2.1)
72
+ activemodel (= 7.2.1)
73
+ activesupport (= 7.2.1)
80
74
  timeout (>= 0.4.0)
81
- activestorage (7.1.2)
82
- actionpack (= 7.1.2)
83
- activejob (= 7.1.2)
84
- activerecord (= 7.1.2)
85
- activesupport (= 7.1.2)
75
+ activestorage (7.2.1)
76
+ actionpack (= 7.2.1)
77
+ activejob (= 7.2.1)
78
+ activerecord (= 7.2.1)
79
+ activesupport (= 7.2.1)
86
80
  marcel (~> 1.0)
87
- activesupport (7.1.2)
81
+ activesupport (7.2.1)
88
82
  base64
89
83
  bigdecimal
90
- concurrent-ruby (~> 1.0, >= 1.0.2)
84
+ concurrent-ruby (~> 1.0, >= 1.3.1)
91
85
  connection_pool (>= 2.2.5)
92
86
  drb
93
87
  i18n (>= 1.6, < 2)
88
+ logger (>= 1.4.2)
94
89
  minitest (>= 5.1)
95
- mutex_m
96
- tzinfo (~> 2.0)
97
- addressable (2.8.6)
98
- public_suffix (>= 2.0.2, < 6.0)
90
+ securerandom (>= 0.3)
91
+ tzinfo (~> 2.0, >= 2.0.5)
92
+ addressable (2.8.7)
93
+ public_suffix (>= 2.0.2, < 7.0)
99
94
  ast (2.4.2)
100
95
  backport (1.2.0)
101
96
  base64 (0.2.0)
102
97
  bcrypt (3.1.20)
103
98
  benchmark (0.3.0)
104
- bigdecimal (3.1.5)
105
- brakeman (6.1.0)
106
- builder (3.2.4)
99
+ bigdecimal (3.1.8)
100
+ brakeman (6.2.1)
101
+ racc
102
+ builder (3.3.0)
107
103
  bundle-audit (0.1.0)
108
104
  bundler-audit
109
- bundler-audit (0.9.1)
105
+ bundler-audit (0.9.2)
110
106
  bundler (>= 1.2.0, < 3)
111
107
  thor (~> 1.0)
112
- cgi (0.4.1)
113
- concurrent-ruby (1.2.2)
108
+ childprocess (5.1.0)
109
+ logger (~> 1.5)
110
+ concurrent-ruby (1.3.4)
114
111
  connection_pool (2.4.1)
115
112
  crass (1.0.6)
116
113
  date (3.3.4)
117
- debug (1.9.0)
114
+ debug (1.9.2)
118
115
  irb (~> 1.10)
119
116
  reline (>= 0.3.8)
120
- diff-lcs (1.5.0)
121
- drb (2.2.0)
122
- ruby2_keywords
117
+ diff-lcs (1.5.1)
118
+ drb (2.2.1)
123
119
  e2mmap (0.1.0)
124
- erb (4.0.3)
125
- cgi (>= 0.3.3)
126
- erubi (1.12.0)
120
+ erubi (1.13.0)
127
121
  globalid (1.2.1)
128
122
  activesupport (>= 6.1)
129
- i18n (1.14.1)
123
+ i18n (1.14.5)
130
124
  concurrent-ruby (~> 1.0)
131
- importmap-rails (1.2.3)
125
+ importmap-rails (2.0.1)
132
126
  actionpack (>= 6.0.0)
133
127
  activesupport (>= 6.0.0)
134
128
  railties (>= 6.0.0)
135
- io-console (0.7.1)
136
- irb (1.10.1)
137
- rdoc
138
- reline (>= 0.3.8)
139
- jaro_winkler (1.5.6)
140
- json (2.7.1)
129
+ io-console (0.7.2)
130
+ irb (1.14.0)
131
+ rdoc (>= 4.0.0)
132
+ reline (>= 0.4.2)
133
+ jaro_winkler (1.6.0)
134
+ json (2.7.2)
141
135
  kramdown (2.4.0)
142
136
  rexml
143
137
  kramdown-parser-gfm (1.1.0)
144
138
  kramdown (~> 2.0)
145
139
  language_server-protocol (3.17.0.3)
146
- launchy (2.5.2)
140
+ launchy (3.0.1)
147
141
  addressable (~> 2.8)
148
- letter_opener (1.8.1)
149
- launchy (>= 2.2, < 3)
142
+ childprocess (~> 5.0)
143
+ letter_opener (1.10.0)
144
+ launchy (>= 2.2, < 4)
150
145
  lint_roller (1.1.0)
146
+ logger (1.6.1)
151
147
  loofah (2.22.0)
152
148
  crass (~> 1.0.2)
153
149
  nokogiri (>= 1.12.0)
@@ -156,61 +152,55 @@ GEM
156
152
  net-imap
157
153
  net-pop
158
154
  net-smtp
159
- marcel (1.0.2)
155
+ marcel (1.0.4)
160
156
  mini_mime (1.1.5)
161
- minitest (5.20.0)
162
- monetize (1.12.0)
157
+ minitest (5.25.1)
158
+ monetize (1.13.0)
163
159
  money (~> 6.12)
164
- money (6.16.0)
160
+ money (6.19.0)
165
161
  i18n (>= 0.6.4, <= 2)
166
162
  money-rails (1.15.0)
167
163
  activesupport (>= 3.0)
168
164
  monetize (~> 1.9)
169
165
  money (~> 6.13)
170
166
  railties (>= 3.0)
171
- mutex_m (0.2.0)
172
- net-imap (0.4.8)
167
+ net-imap (0.4.16)
173
168
  date
174
169
  net-protocol
175
170
  net-pop (0.1.2)
176
171
  net-protocol
177
172
  net-protocol (0.2.2)
178
173
  timeout
179
- net-smtp (0.4.0)
174
+ net-smtp (0.5.0)
180
175
  net-protocol
181
- nio4r (2.7.0)
182
- nokogiri (1.15.5-arm64-darwin)
176
+ nio4r (2.7.3)
177
+ nokogiri (1.16.7-arm64-darwin)
183
178
  racc (~> 1.4)
184
- pagy (6.2.0)
185
- parallel (1.24.0)
186
- parser (3.2.2.4)
179
+ pagy (9.0.8)
180
+ parallel (1.26.3)
181
+ parser (3.3.5.0)
187
182
  ast (~> 2.4.1)
188
183
  racc
189
- pg (1.5.4)
190
- pg_search (2.3.6)
191
- activerecord (>= 5.2)
192
- activesupport (>= 5.2)
193
- phlex (1.9.0)
194
- concurrent-ruby (~> 1.2)
195
- erb (>= 4)
196
- zeitwerk (~> 2.6)
197
- phlex-rails (1.1.1)
198
- phlex (~> 1.9)
184
+ pg (1.5.8)
185
+ pg_search (2.3.7)
186
+ activerecord (>= 6.1)
187
+ activesupport (>= 6.1)
188
+ phlex (1.10.3)
189
+ phlex-rails (1.2.1)
190
+ phlex (~> 1.10.0)
199
191
  railties (>= 6.1, < 8)
200
- zeitwerk (~> 2.6)
201
- prism (0.19.0)
202
- propshaft (0.8.0)
192
+ propshaft (0.9.1)
203
193
  actionpack (>= 7.0.0)
204
194
  activesupport (>= 7.0.0)
205
195
  rack
206
196
  railties (>= 7.0.0)
207
197
  psych (5.1.2)
208
198
  stringio
209
- public_suffix (5.0.4)
210
- puma (6.4.0)
199
+ public_suffix (6.0.1)
200
+ puma (6.4.2)
211
201
  nio4r (~> 2.0)
212
- racc (1.7.3)
213
- rack (3.0.8)
202
+ racc (1.8.1)
203
+ rack (3.1.7)
214
204
  rack-session (2.0.0)
215
205
  rack (>= 3.0.0)
216
206
  rack-test (2.1.0)
@@ -218,20 +208,20 @@ GEM
218
208
  rackup (2.1.0)
219
209
  rack (>= 3)
220
210
  webrick (~> 1.8)
221
- rails (7.1.2)
222
- actioncable (= 7.1.2)
223
- actionmailbox (= 7.1.2)
224
- actionmailer (= 7.1.2)
225
- actionpack (= 7.1.2)
226
- actiontext (= 7.1.2)
227
- actionview (= 7.1.2)
228
- activejob (= 7.1.2)
229
- activemodel (= 7.1.2)
230
- activerecord (= 7.1.2)
231
- activestorage (= 7.1.2)
232
- activesupport (= 7.1.2)
211
+ rails (7.2.1)
212
+ actioncable (= 7.2.1)
213
+ actionmailbox (= 7.2.1)
214
+ actionmailer (= 7.2.1)
215
+ actionpack (= 7.2.1)
216
+ actiontext (= 7.2.1)
217
+ actionview (= 7.2.1)
218
+ activejob (= 7.2.1)
219
+ activemodel (= 7.2.1)
220
+ activerecord (= 7.2.1)
221
+ activestorage (= 7.2.1)
222
+ activesupport (= 7.2.1)
233
223
  bundler (>= 1.15.0)
234
- railties (= 7.1.2)
224
+ railties (= 7.2.1)
235
225
  rails-dom-testing (2.2.0)
236
226
  activesupport (>= 5.0.0)
237
227
  minitest
@@ -239,53 +229,50 @@ GEM
239
229
  rails-html-sanitizer (1.6.0)
240
230
  loofah (~> 2.21)
241
231
  nokogiri (~> 1.14)
242
- railties (7.1.2)
243
- actionpack (= 7.1.2)
244
- activesupport (= 7.1.2)
245
- irb
232
+ railties (7.2.1)
233
+ actionpack (= 7.2.1)
234
+ activesupport (= 7.2.1)
235
+ irb (~> 1.13)
246
236
  rackup (>= 1.0.0)
247
237
  rake (>= 12.2)
248
238
  thor (~> 1.0, >= 1.2.2)
249
239
  zeitwerk (~> 2.6)
250
240
  rainbow (3.1.1)
251
- rake (13.1.0)
241
+ rake (13.2.1)
252
242
  rbs (2.8.4)
253
- rdoc (6.6.2)
243
+ rdoc (6.7.0)
254
244
  psych (>= 4.0.0)
255
- regexp_parser (2.8.3)
256
- reline (0.4.1)
245
+ regexp_parser (2.9.2)
246
+ reline (0.5.10)
257
247
  io-console (~> 0.5)
258
248
  reverse_markdown (2.1.1)
259
249
  nokogiri
260
- rexml (3.2.6)
250
+ rexml (3.3.7)
261
251
  rotp (6.3.0)
262
- rubocop (1.57.2)
252
+ rubocop (1.65.1)
263
253
  json (~> 2.3)
264
254
  language_server-protocol (>= 3.17.0)
265
255
  parallel (~> 1.10)
266
- parser (>= 3.2.2.4)
256
+ parser (>= 3.3.0.2)
267
257
  rainbow (>= 2.2.2, < 4.0)
268
- regexp_parser (>= 1.8, < 3.0)
258
+ regexp_parser (>= 2.4, < 3.0)
269
259
  rexml (>= 3.2.5, < 4.0)
270
- rubocop-ast (>= 1.28.1, < 2.0)
260
+ rubocop-ast (>= 1.31.1, < 2.0)
271
261
  ruby-progressbar (~> 1.7)
272
262
  unicode-display_width (>= 2.4.0, < 3.0)
273
- rubocop-ast (1.30.0)
274
- parser (>= 3.2.1.0)
275
- rubocop-performance (1.19.1)
276
- rubocop (>= 1.7.0, < 2.0)
277
- rubocop-ast (>= 0.4.0)
278
- rubocop-rails (2.20.2)
263
+ rubocop-ast (1.32.3)
264
+ parser (>= 3.3.1.0)
265
+ rubocop-performance (1.21.1)
266
+ rubocop (>= 1.48.1, < 2.0)
267
+ rubocop-ast (>= 1.31.1, < 2.0)
268
+ rubocop-rails (2.26.0)
279
269
  activesupport (>= 4.2.0)
280
270
  rack (>= 1.1)
281
- rubocop (>= 1.33.0, < 2.0)
282
- ruby-lsp (0.13.2)
283
- language_server-protocol (~> 3.17.0)
284
- prism (>= 0.19.0, < 0.20)
285
- sorbet-runtime (>= 0.5.5685)
286
- ruby-next-core (1.0.0)
271
+ rubocop (>= 1.52.0, < 2.0)
272
+ rubocop-ast (>= 1.31.1, < 2.0)
273
+ ruby-next-core (1.0.3)
287
274
  ruby-progressbar (1.13.0)
288
- ruby2_keywords (0.0.5)
275
+ securerandom (0.3.1)
289
276
  solargraph (0.50.0)
290
277
  backport (~> 1.2)
291
278
  benchmark
@@ -302,49 +289,47 @@ GEM
302
289
  thor (~> 1.0)
303
290
  tilt (~> 2.0)
304
291
  yard (~> 0.9, >= 0.9.24)
305
- solargraph-rails (1.1.0)
306
- activesupport
307
- solargraph
308
- sorbet-runtime (0.5.11158)
309
- standard (1.32.1)
292
+ standard (1.40.0)
310
293
  language_server-protocol (~> 3.17.0.2)
311
294
  lint_roller (~> 1.0)
312
- rubocop (~> 1.57.2)
295
+ rubocop (~> 1.65.0)
313
296
  standard-custom (~> 1.0.0)
314
- standard-performance (~> 1.2)
297
+ standard-performance (~> 1.4)
315
298
  standard-custom (1.0.2)
316
299
  lint_roller (~> 1.0)
317
300
  rubocop (~> 1.50)
318
- standard-performance (1.2.1)
301
+ standard-performance (1.4.0)
319
302
  lint_roller (~> 1.1)
320
- rubocop-performance (~> 1.19.1)
321
- standard-rails (0.2.0)
303
+ rubocop-performance (~> 1.21.0)
304
+ standard-rails (1.2.0)
322
305
  lint_roller (~> 1.0)
323
- rubocop-rails (~> 2.20.2)
324
- stimulus-rails (1.3.0)
325
- railties (>= 6.0.0)
326
- stringio (3.1.0)
327
- tailwindcss-rails (2.1.0-arm64-darwin)
306
+ rubocop-rails (~> 2.26.0)
307
+ stimulus-rails (1.3.4)
328
308
  railties (>= 6.0.0)
329
- thor (1.3.0)
330
- tilt (2.3.0)
309
+ stringio (3.1.1)
310
+ tailwindcss-rails (2.7.3-arm64-darwin)
311
+ railties (>= 7.0.0)
312
+ thor (1.3.2)
313
+ tilt (2.4.0)
331
314
  timeout (0.4.1)
332
- turbo-rails (1.5.0)
315
+ turbo-rails (2.0.6)
333
316
  actionpack (>= 6.0.0)
334
317
  activejob (>= 6.0.0)
335
318
  railties (>= 6.0.0)
336
319
  tzinfo (2.0.6)
337
320
  concurrent-ruby (~> 1.0)
338
321
  unicode-display_width (2.5.0)
322
+ useragent (0.16.10)
339
323
  webrick (1.8.1)
340
324
  websocket-driver (0.7.6)
341
325
  websocket-extensions (>= 0.1.0)
342
326
  websocket-extensions (0.1.5)
343
- yard (0.9.34)
344
- zeitwerk (2.6.12)
327
+ yard (0.9.37)
328
+ zeitwerk (2.6.18)
345
329
 
346
330
  PLATFORMS
347
331
  arm64-darwin-22
332
+ arm64-darwin-24
348
333
 
349
334
  DEPENDENCIES
350
335
  brakeman
@@ -354,11 +339,10 @@ DEPENDENCIES
354
339
  letter_opener
355
340
  maquina!
356
341
  pg
342
+ pg_search
357
343
  propshaft
358
344
  puma
359
- ruby-lsp
360
345
  solargraph
361
- solargraph-rails
362
346
  standard
363
347
  standard-rails
364
348
  tailwindcss-rails
@@ -5,32 +5,45 @@ module Maquina
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- helper_method :signed_in?, :current_user
8
+ before_action :require_authentication
9
+ helper_method :signed_in?, :current_user, :authenticated?
9
10
  end
10
11
 
11
- def authenticate!
12
- load_session
12
+ class_methods do
13
+ def allow_unauthenticated_access(...)
14
+ skip_before_action(:require_authentication, ...)
15
+ end
16
+ end
13
17
 
14
- redirect_to maquina.new_sessions_path if !signed_in?
18
+ def authenticated?
19
+ Maquina::Current.signed_in?
15
20
  end
21
+ alias_method :signed_in?, :authenticated?
16
22
 
17
- def authenticate
18
- load_session if Maquina::Current.active_session.blank?
23
+ def current_user
24
+ Maquina::Current.user
19
25
  end
20
26
 
21
- def signed_in?
22
- load_session if Maquina::Current.active_session.blank?
27
+ def after_authentication_url
28
+ session.delete(:return_to_after_authenticating) || root_url
29
+ end
23
30
 
24
- Maquina::Current.signed_in?
31
+ def require_authentication
32
+ load_session || request_authentication
25
33
  end
26
34
 
27
- def current_user
28
- load_session if Maquina::Current.active_session.blank?
35
+ private
29
36
 
30
- Maquina::Current.user
37
+ def request_authentication
38
+ session[:return_to_after_authenticating] = request.url
39
+
40
+ # TODO: Allow to configure sign in path
41
+ redirect_to maquina.new_sessions_path, format: :html, status: :see_other
31
42
  end
32
43
 
33
- private
44
+ def authenticate
45
+ load_session
46
+ end
34
47
 
35
48
  def load_session
36
49
  active_session_id = session["--active_session"]
@@ -48,5 +61,12 @@ module Maquina
48
61
 
49
62
  Maquina::Current.active_session = active_session
50
63
  end
64
+
65
+ def start_new_session_for(user)
66
+ ActiveSession.create(user: user, user_agent: request.user_agent, remote_addr: request.remote_ip).tap do |active_session|
67
+ session["--active_session"] = active_session.id
68
+ Maquina::Current.active_session = active_session
69
+ end
70
+ end
51
71
  end
52
72
  end
@@ -118,7 +118,7 @@ module Maquina
118
118
  respond_to do |format|
119
119
  if has_errors
120
120
  format.html { render object.persisted? ? :edit : :new }
121
- format.turbo_stream
121
+ # format.turbo_stream
122
122
  format.json { render json: {errors: object.errors.map { |error| {error.attribute => error.message} }} }
123
123
  else
124
124
  format.html { redirect_to collection_path, status: :see_other }
@@ -0,0 +1,43 @@
1
+ module Maquina
2
+ class FirstRunsController < ApplicationController
3
+ allow_unauthenticated_access
4
+
5
+ layout "maquina/sessions"
6
+
7
+ before_action :prevent_repeats
8
+
9
+ def show
10
+ @user = Maquina::User.new
11
+ end
12
+
13
+ def create
14
+ @user = create_user
15
+
16
+ if @user.persisted?
17
+ start_new_session_for(@user)
18
+
19
+ redirect_to maquina.root_path, notice: t("flash.first_runs.create.notice")
20
+ else
21
+ flash.now.alert = t("flash.first_runs.create.alert")
22
+ render :show, status: :unprocessable_entity
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def prevent_repeats
29
+ redirect_to main_app.root_path if Maquina::User.any?
30
+ end
31
+
32
+ def user_params
33
+ params.require(:user).permit(:email, :password)
34
+ end
35
+
36
+ def create_user
37
+ Maquina::User.new(user_params).tap do |user|
38
+ user.management = true
39
+ user.save
40
+ end
41
+ end
42
+ end
43
+ end