hephaestus 0.8.11 → 0.8.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGELOG.md +12 -0
  4. data/README.md +3 -1
  5. data/bin/hephaestus +37 -19
  6. data/lib/hephaestus/app_builder.rb +23 -145
  7. data/lib/hephaestus/app_name.rb +33 -0
  8. data/lib/hephaestus/generators/app_generator.rb +79 -75
  9. data/lib/hephaestus/generators/base.rb +0 -1
  10. data/lib/hephaestus/generators/config_generator.rb +3 -114
  11. data/lib/hephaestus/generators/core_generator.rb +18 -58
  12. data/lib/hephaestus/generators/db_generator.rb +12 -0
  13. data/lib/hephaestus/generators/deployment_generator.rb +3 -8
  14. data/lib/hephaestus/generators/lib_generator.rb +0 -10
  15. data/lib/hephaestus/generators/license_generator.rb +4 -1
  16. data/lib/hephaestus/generators/rubocop_generator.rb +1 -1
  17. data/lib/hephaestus/version.rb +1 -1
  18. data/lib/hephaestus.rb +2 -1
  19. data/templates/Dockerfile +7 -75
  20. data/templates/Gemfile +73 -0
  21. data/templates/Procfile +2 -0
  22. data/templates/app/controllers/app_controller.rb.tt +35 -0
  23. data/templates/app/controllers/application_controller.rb +1 -7
  24. data/templates/app/controllers/concerns/authable.rb.tt +50 -0
  25. data/templates/app/controllers/settings_controller.rb +5 -28
  26. data/templates/app/controllers/yetto_controller.rb +9 -10
  27. data/templates/app/lib/body_parameter/yetto_parameters.rb +8 -29
  28. data/templates/app/lib/{constants/app.rb → constants.rb} +1 -3
  29. data/templates/app/services/{http_service.rb → app_service.rb.tt} +6 -6
  30. data/templates/app/views/settings/new.json.jbuilder.tt +18 -0
  31. data/templates/bin/bundle +115 -0
  32. data/templates/bin/docker-entrypoint +20 -10
  33. data/templates/bin/foreman +27 -0
  34. data/templates/bin/jobs +7 -0
  35. data/templates/bin/rails +6 -0
  36. data/templates/bin/rake +6 -0
  37. data/templates/bin/setup +28 -0
  38. data/templates/bin/tapioca +27 -0
  39. data/templates/config/application.rb.tt +36 -0
  40. data/templates/config/boot.rb +7 -0
  41. data/templates/config/environment.rb +8 -0
  42. data/templates/config/environments/blank.rb +7 -0
  43. data/templates/config/initializers/environment.rb +2 -36
  44. data/templates/config/locales/en.yml +5 -31
  45. data/templates/config/puma.rb +5 -0
  46. data/templates/config/routes.rb.tt +28 -0
  47. data/templates/config.ru +9 -0
  48. data/templates/db/queue_schema.rb +132 -0
  49. data/templates/db/schema.rb +17 -0
  50. data/templates/hephaestus_env.sample +12 -0
  51. data/templates/hephaestus_github/dependabot.yml +27 -0
  52. data/templates/hephaestus_github/workflows/automerge.yml +14 -0
  53. data/templates/hephaestus_github/workflows/deploy.yml +30 -0
  54. data/templates/hephaestus_github/workflows/licenses.yml +17 -0
  55. data/templates/hephaestus_github/workflows/lint.yml +17 -0
  56. data/templates/hephaestus_github/workflows/security.yml +19 -0
  57. data/templates/hephaestus_github/workflows/sorbet.yml +19 -0
  58. data/templates/hephaestus_github/workflows/test.yml.tt +21 -0
  59. data/templates/hephaestus_github/workflows/updater.yml +18 -0
  60. data/templates/hephaestus_vscode/extensions.json +9 -0
  61. data/templates/hephaestus_vscode/launch.json +13 -0
  62. data/templates/hephaestus_vscode/settings.json +58 -0
  63. data/templates/lib/schemas/api/2023-03-06/components/parameters/headers/yetto.json +42 -0
  64. data/templates/lib/schemas/api/2023-03-06/components/parameters/plugInstallation.json +12 -0
  65. data/templates/lib/schemas/api/2023-03-06/components/schemas/plug.json +9 -0
  66. data/templates/lib/schemas/api/2023-03-06/components/schemas/responses.json +64 -0
  67. data/templates/lib/schemas/api/2023-03-06/components/schemas/yetto.json +116 -0
  68. data/templates/lib/schemas/api/2023-03-06/openapi.json +30 -0
  69. data/templates/lib/schemas/api/2023-03-06/paths/app.json +90 -0
  70. data/templates/lib/schemas/api/2023-03-06/paths/yetto/message_created.json +51 -0
  71. data/templates/lib/schemas/api/2023-03-06/paths/yetto/plug_installation_created.json +51 -0
  72. data/templates/script/docker-build-prod.tt +11 -0
  73. data/templates/script/docker-run.tt +8 -0
  74. data/templates/script/edit-credentials +12 -3
  75. data/templates/script/hmac_text +1 -1
  76. data/templates/script/ngrok.tt +7 -0
  77. data/templates/script/server +6 -45
  78. data/templates/test/controllers/app_controller_test.rb.tt +188 -0
  79. data/templates/test/controllers/settings_controller_test.rb.tt +125 -0
  80. data/templates/test/controllers/yetto_controller_test.rb +100 -71
  81. data/templates/test/fixtures/files/plug_installation_settings/valid.json +1 -1
  82. data/templates/test/support/rails.rb +16 -36
  83. data/templates/test/support/webmocks/app_webmock.rb.tt +29 -0
  84. data/templates/test/test_helper.rb +1 -31
  85. data/templates/vendor/fly/{fly-production.toml → fly-production.toml.tt} +24 -11
  86. data/templates/vendor/fly/{fly-staging.toml → fly-staging.toml.tt} +18 -15
  87. metadata +59 -72
  88. data/lib/hephaestus/exit_on_failure.rb +0 -22
  89. data/templates/Gemfile.erb +0 -120
  90. data/templates/Procfile.debug +0 -2
  91. data/templates/Procfile.dev +0 -2
  92. data/templates/app/controllers/app_controller.rb +0 -72
  93. data/templates/app/controllers/concerns/authable.rb +0 -50
  94. data/templates/app/controllers/staff_controller.rb +0 -15
  95. data/templates/app/jobs/update_yetto_job.rb +0 -26
  96. data/templates/app/lib/headers/yetto.rb +0 -19
  97. data/templates/app/lib/headers.rb +0 -5
  98. data/templates/app/lib/path_parameter/settings_parameters.rb +0 -22
  99. data/templates/app/lib/path_parameter/yetto_parameters.rb +0 -28
  100. data/templates/app/lib/path_parameter.rb +0 -8
  101. data/templates/app/lib/plug_app/http.rb +0 -37
  102. data/templates/app/lib/plug_app/middleware/malformed_request.rb +0 -110
  103. data/templates/app/lib/plug_app/middleware/openapi_validation.rb +0 -83
  104. data/templates/app/lib/plug_app/middleware/tracing_attributes.rb +0 -46
  105. data/templates/app/lib/query_parameter.rb +0 -6
  106. data/templates/app/serializers/error_serializer.rb +0 -16
  107. data/templates/app/services/yetto_service.rb +0 -51
  108. data/templates/app/views/settings/new.json.jbuilder +0 -21
  109. data/templates/compose.yml +0 -5
  110. data/templates/config/initializers/000-oj.rb +0 -6
  111. data/templates/config/initializers/cors.rb +0 -19
  112. data/templates/config/initializers/filter_parameter_logging.rb +0 -25
  113. data/templates/config/initializers/inflections.rb +0 -20
  114. data/templates/config/initializers/lograge.rb +0 -25
  115. data/templates/config/initializers/opentelemetry.rb +0 -32
  116. data/templates/config/initializers/sidekiq.rb +0 -11
  117. data/templates/config/initializers/slack_webhook_logger.rb +0 -17
  118. data/templates/config/sidekiq.yml +0 -20
  119. data/templates/script/ngrok +0 -5
  120. data/templates/test/controllers/settings_controller_test.rb +0 -27
  121. data/templates/test/fixtures/plug_installation_settings/invalid.json +0 -3
  122. data/templates/test/fixtures/plug_installation_settings/valid.json +0 -3
  123. data/templates/test/jobs/update_yetto_job_test.rb +0 -26
  124. data/templates/test/support/api.rb +0 -76
  125. data/templates/test/support/webmocks/slack_webmock.rb +0 -24
  126. data/templates/test/support/webmocks/yetto_webmock.rb +0 -119
  127. data/templates/test/support/webmocks.rb +0 -5
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hephaestus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.11
4
+ version: 0.8.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-11 00:00:00.000000000 Z
11
+ date: 2024-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootsnap
@@ -24,7 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- force_ruby_platform: false
28
27
  - !ruby/object:Gem::Dependency
29
28
  name: bundler
30
29
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +52,6 @@ dependencies:
53
52
  - - "~>"
54
53
  - !ruby/object:Gem::Version
55
54
  version: '0.15'
56
- force_ruby_platform: false
57
55
  - !ruby/object:Gem::Dependency
58
56
  name: hiredis
59
57
  requirement: !ruby/object:Gem::Requirement
@@ -68,7 +66,6 @@ dependencies:
68
66
  - - "~>"
69
67
  - !ruby/object:Gem::Version
70
68
  version: '0.6'
71
- force_ruby_platform: false
72
69
  - !ruby/object:Gem::Dependency
73
70
  name: httpsensible
74
71
  requirement: !ruby/object:Gem::Requirement
@@ -83,7 +80,6 @@ dependencies:
83
80
  - - "~>"
84
81
  - !ruby/object:Gem::Version
85
82
  version: '0.3'
86
- force_ruby_platform: false
87
83
  - !ruby/object:Gem::Dependency
88
84
  name: jbuilder
89
85
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +94,6 @@ dependencies:
98
94
  - - "~>"
99
95
  - !ruby/object:Gem::Version
100
96
  version: '2.12'
101
- force_ruby_platform: false
102
97
  - !ruby/object:Gem::Dependency
103
98
  name: jwt
104
99
  requirement: !ruby/object:Gem::Requirement
@@ -113,7 +108,6 @@ dependencies:
113
108
  - - "~>"
114
109
  - !ruby/object:Gem::Version
115
110
  version: '2.8'
116
- force_ruby_platform: false
117
111
  - !ruby/object:Gem::Dependency
118
112
  name: lograge
119
113
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +122,6 @@ dependencies:
128
122
  - - "~>"
129
123
  - !ruby/object:Gem::Version
130
124
  version: '0.14'
131
- force_ruby_platform: false
132
125
  - !ruby/object:Gem::Dependency
133
126
  name: mission_control-jobs
134
127
  requirement: !ruby/object:Gem::Requirement
@@ -143,7 +136,6 @@ dependencies:
143
136
  - - "~>"
144
137
  - !ruby/object:Gem::Version
145
138
  version: '0.5'
146
- force_ruby_platform: false
147
139
  - !ruby/object:Gem::Dependency
148
140
  name: openapi_first
149
141
  requirement: !ruby/object:Gem::Requirement
@@ -158,7 +150,6 @@ dependencies:
158
150
  - - "~>"
159
151
  - !ruby/object:Gem::Version
160
152
  version: '2.0'
161
- force_ruby_platform: false
162
153
  - !ruby/object:Gem::Dependency
163
154
  name: parser
164
155
  requirement: !ruby/object:Gem::Requirement
@@ -173,7 +164,6 @@ dependencies:
173
164
  - - "~>"
174
165
  - !ruby/object:Gem::Version
175
166
  version: '3.0'
176
- force_ruby_platform: false
177
167
  - !ruby/object:Gem::Dependency
178
168
  name: pg
179
169
  requirement: !ruby/object:Gem::Requirement
@@ -188,7 +178,6 @@ dependencies:
188
178
  - - "~>"
189
179
  - !ruby/object:Gem::Version
190
180
  version: '1.5'
191
- force_ruby_platform: false
192
181
  - !ruby/object:Gem::Dependency
193
182
  name: puma
194
183
  requirement: !ruby/object:Gem::Requirement
@@ -203,7 +192,6 @@ dependencies:
203
192
  - - "~>"
204
193
  - !ruby/object:Gem::Version
205
194
  version: '6.4'
206
- force_ruby_platform: false
207
195
  - !ruby/object:Gem::Dependency
208
196
  name: rails
209
197
  requirement: !ruby/object:Gem::Requirement
@@ -218,7 +206,6 @@ dependencies:
218
206
  - - ">="
219
207
  - !ruby/object:Gem::Version
220
208
  version: '8.0'
221
- force_ruby_platform: false
222
209
  - !ruby/object:Gem::Dependency
223
210
  name: rainbow
224
211
  requirement: !ruby/object:Gem::Requirement
@@ -233,7 +220,6 @@ dependencies:
233
220
  - - "~>"
234
221
  - !ruby/object:Gem::Version
235
222
  version: '3.0'
236
- force_ruby_platform: false
237
223
  - !ruby/object:Gem::Dependency
238
224
  name: redis
239
225
  requirement: !ruby/object:Gem::Requirement
@@ -248,7 +234,6 @@ dependencies:
248
234
  - - "~>"
249
235
  - !ruby/object:Gem::Version
250
236
  version: '5.2'
251
- force_ruby_platform: false
252
237
  - !ruby/object:Gem::Dependency
253
238
  name: retriable
254
239
  requirement: !ruby/object:Gem::Requirement
@@ -263,7 +248,6 @@ dependencies:
263
248
  - - "~>"
264
249
  - !ruby/object:Gem::Version
265
250
  version: '3.1'
266
- force_ruby_platform: false
267
251
  - !ruby/object:Gem::Dependency
268
252
  name: slack_webhook_logger
269
253
  requirement: !ruby/object:Gem::Requirement
@@ -278,7 +262,6 @@ dependencies:
278
262
  - - "~>"
279
263
  - !ruby/object:Gem::Version
280
264
  version: '0.6'
281
- force_ruby_platform: false
282
265
  - !ruby/object:Gem::Dependency
283
266
  name: solid_queue
284
267
  requirement: !ruby/object:Gem::Requirement
@@ -293,7 +276,6 @@ dependencies:
293
276
  - - "~>"
294
277
  - !ruby/object:Gem::Version
295
278
  version: '1.0'
296
- force_ruby_platform: false
297
279
  - !ruby/object:Gem::Dependency
298
280
  name: sqlite3
299
281
  requirement: !ruby/object:Gem::Requirement
@@ -308,7 +290,6 @@ dependencies:
308
290
  - - "~>"
309
291
  - !ruby/object:Gem::Version
310
292
  version: '2.0'
311
- force_ruby_platform: false
312
293
  - !ruby/object:Gem::Dependency
313
294
  name: opentelemetry-exporter-otlp
314
295
  requirement: !ruby/object:Gem::Requirement
@@ -323,7 +304,6 @@ dependencies:
323
304
  - - "~>"
324
305
  - !ruby/object:Gem::Version
325
306
  version: '0.26'
326
- force_ruby_platform: false
327
307
  - !ruby/object:Gem::Dependency
328
308
  name: opentelemetry-instrumentation-all
329
309
  requirement: !ruby/object:Gem::Requirement
@@ -338,7 +318,6 @@ dependencies:
338
318
  - - "~>"
339
319
  - !ruby/object:Gem::Version
340
320
  version: '0.63'
341
- force_ruby_platform: false
342
321
  - !ruby/object:Gem::Dependency
343
322
  name: opentelemetry-sdk
344
323
  requirement: !ruby/object:Gem::Requirement
@@ -353,7 +332,6 @@ dependencies:
353
332
  - - "~>"
354
333
  - !ruby/object:Gem::Version
355
334
  version: '1.4'
356
- force_ruby_platform: false
357
335
  - !ruby/object:Gem::Dependency
358
336
  name: opentelemetry-semantic_conventions
359
337
  requirement: !ruby/object:Gem::Requirement
@@ -368,7 +346,6 @@ dependencies:
368
346
  - - "~>"
369
347
  - !ruby/object:Gem::Version
370
348
  version: '1.10'
371
- force_ruby_platform: false
372
349
  - !ruby/object:Gem::Dependency
373
350
  name: propshaft
374
351
  requirement: !ruby/object:Gem::Requirement
@@ -383,7 +360,6 @@ dependencies:
383
360
  - - "~>"
384
361
  - !ruby/object:Gem::Version
385
362
  version: '1.1'
386
- force_ruby_platform: false
387
363
  - !ruby/object:Gem::Dependency
388
364
  name: dotenv-rails
389
365
  requirement: !ruby/object:Gem::Requirement
@@ -452,12 +428,13 @@ files:
452
428
  - lib/hephaestus/actions.rb
453
429
  - lib/hephaestus/actions/strip_comments_action.rb
454
430
  - lib/hephaestus/app_builder.rb
431
+ - lib/hephaestus/app_name.rb
455
432
  - lib/hephaestus/engine.rb
456
- - lib/hephaestus/exit_on_failure.rb
457
433
  - lib/hephaestus/generators/app_generator.rb
458
434
  - lib/hephaestus/generators/base.rb
459
435
  - lib/hephaestus/generators/config_generator.rb
460
436
  - lib/hephaestus/generators/core_generator.rb
437
+ - lib/hephaestus/generators/db_generator.rb
461
438
  - lib/hephaestus/generators/deployment_generator.rb
462
439
  - lib/hephaestus/generators/lib_generator.rb
463
440
  - lib/hephaestus/generators/license_generator.rb
@@ -479,51 +456,55 @@ files:
479
456
  - lib/tasks/rubocop.rake
480
457
  - lib/version.rb
481
458
  - templates/Dockerfile
482
- - templates/Gemfile.erb
483
- - templates/Procfile.debug
484
- - templates/Procfile.dev
459
+ - templates/Gemfile
460
+ - templates/Procfile
485
461
  - templates/README.md.erb
486
- - templates/app/controllers/app_controller.rb
462
+ - templates/app/controllers/app_controller.rb.tt
487
463
  - templates/app/controllers/application_controller.rb
488
- - templates/app/controllers/concerns/authable.rb
464
+ - templates/app/controllers/concerns/authable.rb.tt
489
465
  - templates/app/controllers/root_controller.rb
490
466
  - templates/app/controllers/settings_controller.rb
491
- - templates/app/controllers/staff_controller.rb
492
467
  - templates/app/controllers/yetto_controller.rb
493
468
  - templates/app/jobs/application_job.rb
494
- - templates/app/jobs/update_yetto_job.rb
495
469
  - templates/app/lib/body_parameter.rb
496
470
  - templates/app/lib/body_parameter/yetto_parameters.rb
497
- - templates/app/lib/constants/app.rb
498
- - templates/app/lib/headers.rb
499
- - templates/app/lib/headers/yetto.rb
500
- - templates/app/lib/path_parameter.rb
501
- - templates/app/lib/path_parameter/settings_parameters.rb
502
- - templates/app/lib/path_parameter/yetto_parameters.rb
503
- - templates/app/lib/plug_app/http.rb
504
- - templates/app/lib/plug_app/middleware/malformed_request.rb
505
- - templates/app/lib/plug_app/middleware/openapi_validation.rb
506
- - templates/app/lib/plug_app/middleware/tracing_attributes.rb
507
- - templates/app/lib/query_parameter.rb
508
- - templates/app/serializers/error_serializer.rb
509
- - templates/app/services/http_service.rb
510
- - templates/app/services/yetto_service.rb
511
- - templates/app/views/settings/new.json.jbuilder
471
+ - templates/app/lib/constants.rb
472
+ - templates/app/services/app_service.rb.tt
473
+ - templates/app/views/settings/new.json.jbuilder.tt
474
+ - templates/bin/bundle
512
475
  - templates/bin/docker-entrypoint
513
- - templates/compose.yml
514
- - templates/config/initializers/000-oj.rb
515
- - templates/config/initializers/cors.rb
476
+ - templates/bin/foreman
477
+ - templates/bin/jobs
478
+ - templates/bin/rails
479
+ - templates/bin/rake
480
+ - templates/bin/setup
481
+ - templates/bin/tapioca
482
+ - templates/config.ru
483
+ - templates/config/application.rb.tt
484
+ - templates/config/boot.rb
485
+ - templates/config/environment.rb
486
+ - templates/config/environments/blank.rb
516
487
  - templates/config/initializers/environment.rb
517
- - templates/config/initializers/filter_parameter_logging.rb
518
- - templates/config/initializers/inflections.rb
519
- - templates/config/initializers/lograge.rb
520
- - templates/config/initializers/opentelemetry.rb
521
- - templates/config/initializers/sidekiq.rb
522
- - templates/config/initializers/slack_webhook_logger.rb
523
488
  - templates/config/locales/en.yml
524
489
  - templates/config/locales/settings/en.yml
525
- - templates/config/sidekiq.yml
490
+ - templates/config/puma.rb
491
+ - templates/config/routes.rb.tt
492
+ - templates/db/queue_schema.rb
493
+ - templates/db/schema.rb
494
+ - templates/hephaestus_env.sample
495
+ - templates/hephaestus_github/dependabot.yml
496
+ - templates/hephaestus_github/workflows/automerge.yml
497
+ - templates/hephaestus_github/workflows/deploy.yml
498
+ - templates/hephaestus_github/workflows/licenses.yml
499
+ - templates/hephaestus_github/workflows/lint.yml
500
+ - templates/hephaestus_github/workflows/security.yml
501
+ - templates/hephaestus_github/workflows/sorbet.yml
502
+ - templates/hephaestus_github/workflows/test.yml.tt
503
+ - templates/hephaestus_github/workflows/updater.yml
526
504
  - templates/hephaestus_gitignore
505
+ - templates/hephaestus_vscode/extensions.json
506
+ - templates/hephaestus_vscode/launch.json
507
+ - templates/hephaestus_vscode/settings.json
527
508
  - templates/lib/plug_app/schemas/api/2023-03-06/components/parameters/headers/yetto.json
528
509
  - templates/lib/plug_app/schemas/api/2023-03-06/components/parameters/plugInstallation.json
529
510
  - templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/plug.json
@@ -533,34 +514,40 @@ files:
533
514
  - templates/lib/plug_app/schemas/api/2023-03-06/paths/plug.json
534
515
  - templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/message_created.json
535
516
  - templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/plug_installation_created.json
517
+ - templates/lib/schemas/api/2023-03-06/components/parameters/headers/yetto.json
518
+ - templates/lib/schemas/api/2023-03-06/components/parameters/plugInstallation.json
519
+ - templates/lib/schemas/api/2023-03-06/components/schemas/plug.json
520
+ - templates/lib/schemas/api/2023-03-06/components/schemas/responses.json
521
+ - templates/lib/schemas/api/2023-03-06/components/schemas/yetto.json
522
+ - templates/lib/schemas/api/2023-03-06/openapi.json
523
+ - templates/lib/schemas/api/2023-03-06/paths/app.json
524
+ - templates/lib/schemas/api/2023-03-06/paths/yetto/message_created.json
525
+ - templates/lib/schemas/api/2023-03-06/paths/yetto/plug_installation_created.json
536
526
  - templates/lib/tasks/test_tasks.rake
537
527
  - templates/script/ci
528
+ - templates/script/docker-build-prod.tt
529
+ - templates/script/docker-run.tt
538
530
  - templates/script/edit-credentials
539
531
  - templates/script/hmac_text
540
532
  - templates/script/licenses
541
- - templates/script/ngrok
533
+ - templates/script/ngrok.tt
542
534
  - templates/script/server
543
535
  - templates/script/sorbet
544
536
  - templates/script/test
545
537
  - templates/sorbet/custom.rbi
538
+ - templates/test/controllers/app_controller_test.rb.tt
546
539
  - templates/test/controllers/application_controller_test.rb
547
540
  - templates/test/controllers/root_controller_test.rb
548
- - templates/test/controllers/settings_controller_test.rb
541
+ - templates/test/controllers/settings_controller_test.rb.tt
549
542
  - templates/test/controllers/yetto_controller_test.rb
550
543
  - templates/test/fixtures/files/fake_pem_file/fake.pem
551
544
  - templates/test/fixtures/files/plug_installation_settings/invalid.json
552
545
  - templates/test/fixtures/files/plug_installation_settings/valid.json
553
- - templates/test/fixtures/plug_installation_settings/invalid.json
554
- - templates/test/fixtures/plug_installation_settings/valid.json
555
- - templates/test/jobs/update_yetto_job_test.rb
556
- - templates/test/support/api.rb
557
546
  - templates/test/support/rails.rb
558
- - templates/test/support/webmocks.rb
559
- - templates/test/support/webmocks/slack_webmock.rb
560
- - templates/test/support/webmocks/yetto_webmock.rb
547
+ - templates/test/support/webmocks/app_webmock.rb.tt
561
548
  - templates/test/test_helper.rb
562
- - templates/vendor/fly/fly-production.toml
563
- - templates/vendor/fly/fly-staging.toml
549
+ - templates/vendor/fly/fly-production.toml.tt
550
+ - templates/vendor/fly/fly-staging.toml.tt
564
551
  homepage: http://github.com/yettoapp/hephaestus
565
552
  licenses:
566
553
  - MIT
@@ -575,14 +562,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
575
562
  requirements:
576
563
  - - ">="
577
564
  - !ruby/object:Gem::Version
578
- version: 3.3.0
565
+ version: 3.3.6
579
566
  required_rubygems_version: !ruby/object:Gem::Requirement
580
567
  requirements:
581
568
  - - ">="
582
569
  - !ruby/object:Gem::Version
583
570
  version: 3.4.7
584
571
  requirements: []
585
- rubygems_version: 3.5.3
572
+ rubygems_version: 3.5.22
586
573
  signing_key:
587
574
  specification_version: 4
588
575
  summary: Generate a Rails app that can be used to create plugs for Yetto.
@@ -1,22 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- require "active_support/concern"
5
- require "English"
6
-
7
- module Hephaestus
8
- module ExitOnFailure
9
- extend ActiveSupport::Concern
10
-
11
- def bundle_command(*)
12
- super
13
- exit(false) if $CHILD_STATUS.exitstatus.nonzero? # rubocop:disable Rails/Exit
14
- end
15
-
16
- module ClassMethods
17
- def exit_on_failure?
18
- true
19
- end
20
- end
21
- end
22
- end
@@ -1,120 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
- git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
-
6
- ruby File.read(".ruby-version").strip
7
-
8
- # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
9
- gem "rails", "~> 7.0"
10
-
11
- # Use the Puma web server [https://github.com/puma/puma]
12
- gem "puma", "~> 6.3"
13
-
14
- # for making kick-ass http queries
15
- gem "httpsensible", "~> 0.1"
16
-
17
- # Build JSON APIs with ease [https://github.com/rails/jbuilder]
18
- gem "jbuilder", "~> 2.11"
19
-
20
- # Use Redis adapter to run Action Cable in production
21
- gem "redis", "~> 5.0"
22
-
23
- # Use hiredis to get better performance than the "redis" gem
24
- gem "hiredis", "~> 0.6"
25
-
26
- # better loggin'
27
- gem "lograge", "~> 0.12"
28
-
29
- # provides middleware to make OpenAPI parsing simpler
30
- gem "openapi_first", "~> 1.0"
31
-
32
- # For Honeycomb.io
33
- gem "opentelemetry-sdk", "~> 1.2"
34
- gem "opentelemetry-exporter-otlp", "~> 0.25"
35
- gem "opentelemetry-semantic_conventions", "~> 1.10"
36
-
37
- gem "opentelemetry-instrumentation-rack", "~> 0.23"
38
- gem "opentelemetry-instrumentation-rails", "~> 0.27"
39
- gem "opentelemetry-instrumentation-concurrent_ruby", "~> 0.21"
40
-
41
- gem "opentelemetry-instrumentation-net_http", "~> 0.22"
42
-
43
- gem "opentelemetry-instrumentation-active_job", "~> 0.5"
44
- gem "opentelemetry-instrumentation-redis", "~> 0.25"
45
- gem "opentelemetry-instrumentation-sidekiq", "~> 0.23"
46
-
47
- # massively improved JSON parsing
48
- gem "oj", "~> 3.16"
49
-
50
- # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
51
- gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
52
-
53
- # Reduces boot times through caching; required in config/boot.rb
54
- gem "bootsnap", require: false
55
-
56
- gem "safety_dance", "~> 1.0"
57
-
58
- # Use Sidekiq for the jobs queue
59
- gem "sidekiq", "~> 7.1"
60
-
61
- # sends logs to Slack
62
- gem "slack_webhook_logger", "~> 0.5"
63
-
64
- group :development, :test do
65
- # better debug output with `ap`
66
- gem "amazing_print"
67
-
68
- # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
69
- gem "debug", platforms: [:mri, :mingw, :x64_mingw], require: false
70
-
71
- gem "faker", "~> 3.0"
72
- gem "rubocop", require: false
73
- gem "rubocop-standard", require: false
74
- end
75
-
76
- group :development do
77
- gem "dotenv-rails"
78
-
79
- gem "foreman", "~> 0.87"
80
-
81
- gem "licensed", "~> 4.4"
82
-
83
- gem "ruby-lsp", "~> 0.6", require: false
84
-
85
- gem "spoom"
86
- gem "sorbet"
87
- gem "tapioca", require: false
88
- gem "webrick"
89
- end
90
- gem "sorbet-runtime"
91
-
92
- group :test do
93
- gem "simplecov", "~> 0.18", require: false
94
- gem "simplecov-console", "~> 0.7", require: false
95
-
96
- # track down flakey tests
97
- gem "minitest-bisect"
98
-
99
- # mocking lib
100
- gem "mocha"
101
-
102
- # allow easier middleware testing
103
- gem "rack-test", "~> 2.0"
104
-
105
- # navigate website
106
- gem "selenium-webdriver"
107
-
108
- # jump around through time
109
- gem "timecop", "~> 0.9"
110
-
111
- # prevents real http requests
112
- gem "webmock", "~> 3.8"
113
- end
114
-
115
- group :ci do
116
- gem "brakeman", "~> 6.0"
117
- gem "bundle-audit", "~> 0.1"
118
- end
119
-
120
- gem "hephaestus", group: [:development, :test]
@@ -1,2 +0,0 @@
1
- web: rdbg -n -O -c -- bin/rails server -p 6661
2
- worker: bundle exec sidekiq -c 2
@@ -1,2 +0,0 @@
1
- web: bin/rails server -p 6661
2
- worker: bundle exec sidekiq -c 2
@@ -1,72 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- class AppController < ApplicationController
5
- include Authable
6
-
7
- include Constants::PlugApp
8
- include PathParameter::AppParameters
9
- include BodyParameter::AppParameters
10
-
11
- before_action :from_app?
12
-
13
- # Inbound message from ${App}
14
- def webhook
15
- # Error if necessary parameters from ${App} are missing
16
- return bad_request unless has_inbound_app_params?
17
-
18
- response = YettoService.get_plug_installation(pparam_organization_id, pparam_inbox_id, pparam_plug_installation_id)
19
-
20
- # Error if Yetto is down
21
- return service_unavailable(response) if response.unavailable?
22
-
23
- plug_installation = response.parse_json_body
24
- installed_on_inbox = plug_installation.fetch("installed_on_inbox", {})
25
-
26
- organization = installed_on_inbox.fetch("organization", {})
27
-
28
- # Bail if the organization is not active
29
- return forbidden unless organization.fetch("status", "") == "active"
30
-
31
- plug_id = plug_installation.fetch("plug", {}).fetch("id", "")
32
- inbox_id = installed_on_inbox.fetch("id", "")
33
- organization_id = organization.fetch("id", "")
34
-
35
- return bad_request if plug_id.blank? || inbox_id.blank?
36
-
37
- # Send the message to Yetto
38
- update_data = {
39
- type: "create_message",
40
- inbox: { id: inbox_id },
41
- organization: { id: organization_id },
42
- payload: {
43
- creator: {
44
- id: plug_id,
45
- },
46
- message: {
47
- title: title,
48
- text_content: text_body,
49
- is_public: true,
50
- author: {
51
- version: "2023-03-06",
52
- name: from_email,
53
- },
54
- attachments: bparam_attachments,
55
- metadata: {
56
- cc_addresses: cc_addresses,
57
- postmark_message_id: bparam_message_id,
58
- email_message_id: email_message_id,
59
- },
60
- },
61
- },
62
- }
63
-
64
- UpdateYettoJob.perform_later(update_data)
65
-
66
- created
67
- end
68
-
69
- def process_inbound
70
- no_content
71
- end
72
- end
@@ -1,50 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- module Authable
5
- extend T::Sig
6
-
7
- include ActionDispatch::Http::Cache::Response
8
-
9
- include ActionController::Helpers::ClassMethods
10
- include ActionController::HttpAuthentication::Basic::ControllerMethods
11
- include BodyParameter::YettoParameters
12
-
13
- SHA256_DIGEST = OpenSSL::Digest.new("sha256")
14
-
15
- sig { void }
16
- def from__app_?
17
- state = params.fetch(:state, "")
18
- _, _, gh_nonce, _, _, _, _ = parse_state(state)
19
-
20
- return false if ActiveSupport::SecurityUtils.secure_compare((gh_nonce || ""), PLUG_APP_NONCE)
21
-
22
- self.status = PlugApp::HTTP::BAD_REQUEST_I
23
- self.response_body = ::ErrorSerializer.format(PlugApp::HTTP::BAD_REQUEST)
24
-
25
- return true if response.status == 200
26
-
27
- # status is annoyingly set to 401, but we want
28
- # to hide that an issue exists
29
- self.status = PlugApp::HTTP::BAD_REQUEST_I
30
- self.response_body = ::ErrorSerializer.format(PlugApp::HTTP::BAD_REQUEST)
31
- end
32
-
33
- sig { void }
34
- def from_yetto?
35
- return bad_request if request.headers.blank?
36
-
37
- yetto_signature = request.headers.fetch(Headers::Yetto::HEADER_SIGNATURE, "")
38
-
39
- return bad_request unless yetto_signature.start_with?("sha256=")
40
-
41
- hmac_header = yetto_signature.split("sha256=").last
42
- body = request.env.fetch("RAW_POST_DATA", "")
43
-
44
- calculated_hmac = OpenSSL::HMAC.hexdigest(SHA256_DIGEST, SIGNING_SECRET, body)
45
-
46
- return true if ActiveSupport::SecurityUtils.secure_compare(calculated_hmac, hmac_header)
47
-
48
- bad_request
49
- end
50
- end
@@ -1,15 +0,0 @@
1
- # typed: strict
2
- # frozen_string_literal: true
3
-
4
- class StaffController < ApplicationController
5
- extend T::Sig
6
-
7
- class << self
8
- extend T::Sig
9
-
10
- sig { params(request: ActionDispatch::Request).returns(T::Boolean) }
11
- def staff_request?(request)
12
- false
13
- end
14
- end
15
- end
@@ -1,26 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- # Send updated data to Yetto to store in the database
5
- # This can be used to update installation data or message data
6
-
7
- class UpdateYettoJob < ApplicationJob
8
- queue_as :update_yetto
9
-
10
- def perform(params)
11
- type = params.delete(:type)
12
-
13
- params.fetch(:inbox, {}).fetch(:id, nil)
14
- plug_installation_id = params.fetch(:plug_installation, {}).fetch(:id, nil)
15
- message_id = params.fetch(:message, {}).fetch(:id, nil)
16
-
17
- case type
18
- when "update_plug_installation"
19
- YettoService.update_plug_installation(plug_installation_id, params)
20
- when "create_message_reply"
21
- YettoService.create_message_reply(message_id, plug_installation_id, params)
22
- when "add_message_metadata"
23
- YettoService.update_message(message_id, plug_installation_id, params)
24
- end
25
- end
26
- end