sorbet-rails 0.7.32 → 0.7.34

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci-master.yml +1 -1
  3. data/.github/workflows/ci.yml +1 -1
  4. data/.github/workflows/publish-gem.yml +9 -19
  5. data/CONTRIBUTING.md +1 -0
  6. data/Gemfile +4 -0
  7. data/README.md +1 -3
  8. data/Rakefile +27 -1
  9. data/lib/sorbet-rails/active_record_rbi_formatter.rb +4 -4
  10. data/lib/sorbet-rails/model_plugins/active_record_querying.rb +14 -0
  11. data/lib/sorbet-rails/model_rbi_formatter.rb +3 -3
  12. data/lib/sorbet-rails/rails_mixins/active_record_overrides.rb +1 -1
  13. data/lib/sorbet-rails/tasks/rails_rbi.rake +15 -0
  14. data/sorbet-rails.gemspec +2 -2
  15. data/spec/bin/run_all_specs.sh +1 -0
  16. data/spec/generators/rails-template.rb +2 -7
  17. data/spec/rails_helper.rb +2 -0
  18. data/spec/rake_rails_rbi_models_spec.rb +1 -1
  19. data/spec/support/v5.2/Gemfile.lock +76 -67
  20. data/spec/support/v5.2/sorbet_test_cases.rb +8 -0
  21. data/spec/support/v6.0/Gemfile.lock +93 -85
  22. data/spec/support/v6.0/sorbet_test_cases.rb +8 -0
  23. data/spec/support/v6.1/Gemfile +1 -1
  24. data/spec/support/v6.1/Gemfile.lock +115 -108
  25. data/spec/support/v6.1/sorbet_test_cases.rb +8 -0
  26. data/spec/support/v7.0/.gitattributes +7 -0
  27. data/spec/support/v7.0/.gitignore +35 -0
  28. data/spec/support/v7.0/Gemfile +48 -0
  29. data/spec/support/v7.0/Gemfile.lock +218 -0
  30. data/spec/support/v7.0/README.md +24 -0
  31. data/spec/support/v7.0/Rakefile +6 -0
  32. data/spec/support/v7.0/app/assets/images/.keep +0 -0
  33. data/spec/support/v7.0/app/assets/stylesheets/application.css +1 -0
  34. data/spec/support/v7.0/app/controllers/application_controller.rb +3 -0
  35. data/spec/support/v7.0/app/controllers/concerns/.keep +0 -0
  36. data/spec/support/v7.0/app/helpers/application_helper.rb +3 -0
  37. data/spec/support/v7.0/app/helpers/bar_helper.rb +3 -0
  38. data/spec/support/v7.0/app/helpers/baz_helper.rb +3 -0
  39. data/spec/support/v7.0/app/helpers/foo_helper.rb +3 -0
  40. data/spec/support/v7.0/app/jobs/application_job.rb +8 -0
  41. data/spec/support/v7.0/app/jobs/award_house_point_hourglasses.rb +12 -0
  42. data/spec/support/v7.0/app/mailers/application_mailer.rb +5 -0
  43. data/spec/support/v7.0/app/mailers/daily_prophet_mailer.rb +9 -0
  44. data/spec/support/v7.0/app/mailers/hogwarts_acceptance_mailer.rb +29 -0
  45. data/spec/support/v7.0/app/models/application_record.rb +4 -0
  46. data/spec/support/v7.0/app/models/concerns/.keep +0 -0
  47. data/spec/support/v7.0/app/models/concerns/mythical.rb +11 -0
  48. data/spec/support/v7.0/app/models/headmaster.rb +8 -0
  49. data/spec/support/v7.0/app/models/potion.rb +6 -0
  50. data/spec/support/v7.0/app/models/robe.rb +4 -0
  51. data/spec/support/v7.0/app/models/school.rb +5 -0
  52. data/spec/support/v7.0/app/models/spell.rb +5 -0
  53. data/spec/support/v7.0/app/models/spell_book.rb +18 -0
  54. data/spec/support/v7.0/app/models/squib.rb +6 -0
  55. data/spec/support/v7.0/app/models/subject.rb +5 -0
  56. data/spec/support/v7.0/app/models/wand.rb +19 -0
  57. data/spec/support/v7.0/app/models/wizard.rb +65 -0
  58. data/spec/support/v7.0/app/views/layouts/application.html.erb +15 -0
  59. data/spec/support/v7.0/app/views/layouts/mailer.html.erb +13 -0
  60. data/spec/support/v7.0/app/views/layouts/mailer.text.erb +1 -0
  61. data/spec/support/v7.0/bin/bundle +114 -0
  62. data/spec/support/v7.0/bin/rails +4 -0
  63. data/spec/support/v7.0/bin/rake +4 -0
  64. data/spec/support/v7.0/bin/setup +33 -0
  65. data/spec/support/v7.0/config/application.rb +38 -0
  66. data/spec/support/v7.0/config/boot.rb +4 -0
  67. data/spec/support/v7.0/config/database.yml +25 -0
  68. data/spec/support/v7.0/config/environment.rb +6 -0
  69. data/spec/support/v7.0/config/environments/development.rb +69 -0
  70. data/spec/support/v7.0/config/environments/production.rb +83 -0
  71. data/spec/support/v7.0/config/environments/test.rb +61 -0
  72. data/spec/support/v7.0/config/initializers/content_security_policy.rb +26 -0
  73. data/spec/support/v7.0/config/initializers/filter_parameter_logging.rb +9 -0
  74. data/spec/support/v7.0/config/initializers/inflections.rb +17 -0
  75. data/spec/support/v7.0/config/initializers/permissions_policy.rb +12 -0
  76. data/spec/support/v7.0/config/initializers/sorbet_rails.rb +3 -0
  77. data/spec/support/v7.0/config/locales/en.yml +33 -0
  78. data/spec/support/v7.0/config/puma.rb +44 -0
  79. data/spec/support/v7.0/config/routes.rb +8 -0
  80. data/spec/support/v7.0/config/storage.yml +34 -0
  81. data/spec/support/v7.0/config.ru +6 -0
  82. data/spec/support/v7.0/db/migrate/20190620000001_create_wizards.rb +14 -0
  83. data/spec/support/v7.0/db/migrate/20190620000002_create_wands.rb +12 -0
  84. data/spec/support/v7.0/db/migrate/20190620000003_create_spell_books.rb +10 -0
  85. data/spec/support/v7.0/db/migrate/20190620000004_add_more_column_types_to_wands.rb +14 -0
  86. data/spec/support/v7.0/db/migrate/20190620000005_add_broom_to_wizard.rb +6 -0
  87. data/spec/support/v7.0/db/migrate/20190620000006_add_more_enums_to_wizard.rb +9 -0
  88. data/spec/support/v7.0/db/migrate/20190620000007_add_type_to_wizard.rb +6 -0
  89. data/spec/support/v7.0/db/migrate/20190620000008_add_robe_to_wizard.rb +8 -0
  90. data/spec/support/v7.0/db/migrate/20190620000009_add_school.rb +10 -0
  91. data/spec/support/v7.0/db/migrate/20190620000010_add_subject.rb +8 -0
  92. data/spec/support/v7.0/db/migrate/20190620000011_add_subjects_wizards.rb +8 -0
  93. data/spec/support/v7.0/db/migrate/20190620000012_add_spell.rb +8 -0
  94. data/spec/support/v7.0/db/migrate/20190620000013_add_spells_spell_books.rb +8 -0
  95. data/spec/support/v7.0/db/migrate/20190620000014_create_headmasters.rb +9 -0
  96. data/spec/support/v7.0/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
  97. data/spec/support/v7.0/db/schema.rb +98 -0
  98. data/spec/support/v7.0/db/seeds.rb +8 -0
  99. data/spec/support/v7.0/lib/assets/.keep +0 -0
  100. data/spec/support/v7.0/lib/mythical_rbi_plugin.rb +16 -0
  101. data/spec/support/v7.0/lib/tasks/.keep +0 -0
  102. data/spec/support/v7.0/log/.keep +0 -0
  103. data/spec/support/v7.0/sorbet_test_cases.rb +439 -0
  104. data/spec/support/v7.0/storage/.keep +0 -0
  105. data/spec/support/v7.0/tmp/.keep +0 -0
  106. data/spec/support/v7.0/tmp/pids/.keep +0 -0
  107. data/spec/support/v7.0/tmp/storage/.keep +0 -0
  108. data/spec/support/v7.0/vendor/.keep +0 -0
  109. data/spec/test_data/v5.2/expected_active_record_base.rbi +6 -0
  110. data/spec/test_data/v5.2/expected_active_record_relation.rbi +8 -2
  111. data/spec/test_data/v5.2/expected_attachment.rbi +3 -3
  112. data/spec/test_data/v5.2/expected_blob.rbi +3 -3
  113. data/spec/test_data/v5.2/expected_habtm_subjects.rbi +3 -3
  114. data/spec/test_data/v5.2/expected_habtm_wizards.rbi +3 -3
  115. data/spec/test_data/v5.2/expected_headmaster.rbi +3 -3
  116. data/spec/test_data/v5.2/expected_internal_metadata.rbi +3 -3
  117. data/spec/test_data/v5.2/expected_potion.rbi +3 -3
  118. data/spec/test_data/v5.2/expected_robe.rbi +3 -3
  119. data/spec/test_data/v5.2/expected_schema_migration.rbi +3 -3
  120. data/spec/test_data/v5.2/expected_school.rbi +3 -3
  121. data/spec/test_data/v5.2/expected_spell/habtm_spell_books.rbi +3 -3
  122. data/spec/test_data/v5.2/expected_spell.rbi +3 -3
  123. data/spec/test_data/v5.2/expected_spell_book/habtm_spell_books.rbi +3 -3
  124. data/spec/test_data/v5.2/expected_spell_book/habtm_spells.rbi +3 -3
  125. data/spec/test_data/v5.2/expected_spell_book.rbi +3 -3
  126. data/spec/test_data/v5.2/expected_squib.rbi +3 -3
  127. data/spec/test_data/v5.2/expected_subject/habtm_wizards.rbi +3 -3
  128. data/spec/test_data/v5.2/expected_subject.rbi +3 -3
  129. data/spec/test_data/v5.2/expected_wand.rbi +3 -3
  130. data/spec/test_data/v5.2/expected_wizard/habtm_subjects.rbi +3 -3
  131. data/spec/test_data/v5.2/expected_wizard.rbi +3 -3
  132. data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +3 -3
  133. data/spec/test_data/v6.0/expected_active_record_base.rbi +6 -0
  134. data/spec/test_data/v6.0/expected_active_record_relation.rbi +8 -2
  135. data/spec/test_data/v6.0/expected_attachment.rbi +3 -3
  136. data/spec/test_data/v6.0/expected_blob.rbi +3 -3
  137. data/spec/test_data/v6.0/expected_habtm_subjects.rbi +3 -3
  138. data/spec/test_data/v6.0/expected_habtm_wizards.rbi +3 -3
  139. data/spec/test_data/v6.0/expected_headmaster.rbi +3 -3
  140. data/spec/test_data/v6.0/expected_internal_metadata.rbi +3 -3
  141. data/spec/test_data/v6.0/expected_potion.rbi +3 -3
  142. data/spec/test_data/v6.0/expected_robe.rbi +3 -3
  143. data/spec/test_data/v6.0/expected_schema_migration.rbi +3 -3
  144. data/spec/test_data/v6.0/expected_school.rbi +3 -3
  145. data/spec/test_data/v6.0/expected_spell/habtm_spell_books.rbi +3 -3
  146. data/spec/test_data/v6.0/expected_spell.rbi +3 -3
  147. data/spec/test_data/v6.0/expected_spell_book/habtm_spell_books.rbi +3 -3
  148. data/spec/test_data/v6.0/expected_spell_book/habtm_spells.rbi +3 -3
  149. data/spec/test_data/v6.0/expected_spell_book.rbi +3 -3
  150. data/spec/test_data/v6.0/expected_squib.rbi +3 -3
  151. data/spec/test_data/v6.0/expected_subject/habtm_wizards.rbi +3 -3
  152. data/spec/test_data/v6.0/expected_subject.rbi +3 -3
  153. data/spec/test_data/v6.0/expected_wand.rbi +3 -3
  154. data/spec/test_data/v6.0/expected_wizard/habtm_subjects.rbi +3 -3
  155. data/spec/test_data/v6.0/expected_wizard.rbi +3 -3
  156. data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +3 -3
  157. data/spec/test_data/v6.1/expected_active_record_base.rbi +6 -0
  158. data/spec/test_data/v6.1/expected_active_record_relation.rbi +8 -2
  159. data/spec/test_data/v6.1/expected_attachment.rbi +3 -3
  160. data/spec/test_data/v6.1/expected_blob.rbi +3 -3
  161. data/spec/test_data/v6.1/expected_habtm_subjects.rbi +3 -3
  162. data/spec/test_data/v6.1/expected_habtm_wizards.rbi +3 -3
  163. data/spec/test_data/v6.1/expected_headmaster.rbi +3 -3
  164. data/spec/test_data/v6.1/expected_internal_metadata.rbi +3 -3
  165. data/spec/test_data/v6.1/expected_potion.rbi +3 -3
  166. data/spec/test_data/v6.1/expected_record.rbi +3 -3
  167. data/spec/test_data/v6.1/expected_robe.rbi +3 -3
  168. data/spec/test_data/v6.1/expected_schema_migration.rbi +3 -3
  169. data/spec/test_data/v6.1/expected_school.rbi +3 -3
  170. data/spec/test_data/v6.1/expected_spell/habtm_spell_books.rbi +3 -3
  171. data/spec/test_data/v6.1/expected_spell.rbi +3 -3
  172. data/spec/test_data/v6.1/expected_spell_book/habtm_spell_books.rbi +3 -3
  173. data/spec/test_data/v6.1/expected_spell_book/habtm_spells.rbi +3 -3
  174. data/spec/test_data/v6.1/expected_spell_book.rbi +3 -3
  175. data/spec/test_data/v6.1/expected_squib.rbi +3 -3
  176. data/spec/test_data/v6.1/expected_subject/habtm_wizards.rbi +3 -3
  177. data/spec/test_data/v6.1/expected_subject.rbi +3 -3
  178. data/spec/test_data/v6.1/expected_variant_record.rbi +3 -3
  179. data/spec/test_data/v6.1/expected_wand.rbi +3 -3
  180. data/spec/test_data/v6.1/expected_wizard/habtm_subjects.rbi +3 -3
  181. data/spec/test_data/v6.1/expected_wizard.rbi +3 -3
  182. data/spec/test_data/v6.1/expected_wizard_wo_spellbook.rbi +3 -3
  183. data/spec/test_data/v7.0/expected_active_record_base.rbi +119 -0
  184. data/spec/test_data/v7.0/expected_active_record_relation.rbi +180 -0
  185. data/spec/test_data/v7.0/expected_application_job.rbi +20 -0
  186. data/spec/test_data/v7.0/expected_application_mailer.rbi +5 -0
  187. data/spec/test_data/v7.0/expected_attachment.rbi +358 -0
  188. data/spec/test_data/v7.0/expected_award_house_point_hourglasses.rbi +20 -0
  189. data/spec/test_data/v7.0/expected_blob.rbi +394 -0
  190. data/spec/test_data/v7.0/expected_custom_application_job.rbi +21 -0
  191. data/spec/test_data/v7.0/expected_custom_application_mailer.rbi +6 -0
  192. data/spec/test_data/v7.0/expected_custom_award_house_point_hourglasses.rbi +21 -0
  193. data/spec/test_data/v7.0/expected_custom_daily_prophet_mailer.rbi +8 -0
  194. data/spec/test_data/v7.0/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
  195. data/spec/test_data/v7.0/expected_daily_prophet_mailer.rbi +7 -0
  196. data/spec/test_data/v7.0/expected_headmaster.rbi +376 -0
  197. data/spec/test_data/v7.0/expected_helpers.rbi +27 -0
  198. data/spec/test_data/v7.0/expected_helpers_with_application_and_devise_helpers.rbi +34 -0
  199. data/spec/test_data/v7.0/expected_hogwarts_acceptance_mailer.rbi +20 -0
  200. data/spec/test_data/v7.0/expected_internal_metadata.rbi +346 -0
  201. data/spec/test_data/v7.0/expected_no_routes.rbi +4 -0
  202. data/spec/test_data/v7.0/expected_potion.rbi +328 -0
  203. data/spec/test_data/v7.0/expected_record.rbi +307 -0
  204. data/spec/test_data/v7.0/expected_robe.rbi +349 -0
  205. data/spec/test_data/v7.0/expected_routes.rbi +182 -0
  206. data/spec/test_data/v7.0/expected_schema_migration.rbi +319 -0
  207. data/spec/test_data/v7.0/expected_school.rbi +349 -0
  208. data/spec/test_data/v7.0/expected_spell/habtm_spell_books.rbi +367 -0
  209. data/spec/test_data/v7.0/expected_spell.rbi +340 -0
  210. data/spec/test_data/v7.0/expected_spell_book/habtm_spells.rbi +367 -0
  211. data/spec/test_data/v7.0/expected_spell_book.rbi +499 -0
  212. data/spec/test_data/v7.0/expected_squib.rbi +1204 -0
  213. data/spec/test_data/v7.0/expected_srb_tc_output.txt +1 -0
  214. data/spec/test_data/v7.0/expected_subject/habtm_wizards.rbi +367 -0
  215. data/spec/test_data/v7.0/expected_subject.rbi +340 -0
  216. data/spec/test_data/v7.0/expected_variant_record.rbi +382 -0
  217. data/spec/test_data/v7.0/expected_wand.rbi +611 -0
  218. data/spec/test_data/v7.0/expected_wizard/habtm_subjects.rbi +367 -0
  219. data/spec/test_data/v7.0/expected_wizard.rbi +1280 -0
  220. data/spec/test_data/v7.0/expected_wizard_wo_spellbook.rbi +1274 -0
  221. metadata +245 -3
@@ -0,0 +1,35 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-*
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*
16
+ /tmp/*
17
+ !/log/.keep
18
+ !/tmp/.keep
19
+
20
+ # Ignore pidfiles, but keep the directory.
21
+ /tmp/pids/*
22
+ !/tmp/pids/
23
+ !/tmp/pids/.keep
24
+
25
+ # Ignore uploaded files in development.
26
+ /storage/*
27
+ !/storage/.keep
28
+ /tmp/storage/*
29
+ !/tmp/storage/
30
+ !/tmp/storage/.keep
31
+
32
+ /public/assets
33
+
34
+ # Ignore master key for decrypting credentials and more.
35
+ /config/master.key
@@ -0,0 +1,48 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ ruby "3.0.1"
5
+
6
+ # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
7
+ gem "rails", "~> 7.0.3"
8
+
9
+ # Use sqlite3 as the database for Active Record
10
+ gem "sqlite3", "~> 1.4"
11
+
12
+ # Use the Puma web server [https://github.com/puma/puma]
13
+ gem "puma", "~> 5.0"
14
+
15
+ # Build JSON APIs with ease [https://github.com/rails/jbuilder]
16
+ gem "jbuilder"
17
+
18
+ # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
19
+ # gem "kredis"
20
+
21
+ # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
22
+ # gem "bcrypt", "~> 3.1.7"
23
+
24
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
25
+ gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
26
+
27
+ # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
28
+ # gem "image_processing", "~> 1.2"
29
+
30
+ group :development, :test do
31
+ # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
32
+ gem "debug", platforms: %i[ mri mingw x64_mingw ]
33
+ end
34
+
35
+ group :development do
36
+ # Use console on exceptions pages [https://github.com/rails/web-console]
37
+ gem "web-console"
38
+
39
+ # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
40
+ # gem "rack-mini-profiler"
41
+
42
+ # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
43
+ # gem "spring"
44
+ end
45
+
46
+ gem "sorbet-rails", path: "../../../."
47
+ gem "sorbet"
48
+ gem "sorbet-runtime"
@@ -0,0 +1,218 @@
1
+ PATH
2
+ remote: ../../..
3
+ specs:
4
+ sorbet-rails (0.7.33)
5
+ method_source (>= 0.9.2)
6
+ parlour (>= 4.0.1)
7
+ parser (>= 2.7)
8
+ sorbet-coerce (>= 0.2.6)
9
+ sorbet-runtime (>= 0.5.9892)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ actioncable (7.0.3)
15
+ actionpack (= 7.0.3)
16
+ activesupport (= 7.0.3)
17
+ nio4r (~> 2.0)
18
+ websocket-driver (>= 0.6.1)
19
+ actionmailbox (7.0.3)
20
+ actionpack (= 7.0.3)
21
+ activejob (= 7.0.3)
22
+ activerecord (= 7.0.3)
23
+ activestorage (= 7.0.3)
24
+ activesupport (= 7.0.3)
25
+ mail (>= 2.7.1)
26
+ net-imap
27
+ net-pop
28
+ net-smtp
29
+ actionmailer (7.0.3)
30
+ actionpack (= 7.0.3)
31
+ actionview (= 7.0.3)
32
+ activejob (= 7.0.3)
33
+ activesupport (= 7.0.3)
34
+ mail (~> 2.5, >= 2.5.4)
35
+ net-imap
36
+ net-pop
37
+ net-smtp
38
+ rails-dom-testing (~> 2.0)
39
+ actionpack (7.0.3)
40
+ actionview (= 7.0.3)
41
+ activesupport (= 7.0.3)
42
+ rack (~> 2.0, >= 2.2.0)
43
+ rack-test (>= 0.6.3)
44
+ rails-dom-testing (~> 2.0)
45
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
46
+ actiontext (7.0.3)
47
+ actionpack (= 7.0.3)
48
+ activerecord (= 7.0.3)
49
+ activestorage (= 7.0.3)
50
+ activesupport (= 7.0.3)
51
+ globalid (>= 0.6.0)
52
+ nokogiri (>= 1.8.5)
53
+ actionview (7.0.3)
54
+ activesupport (= 7.0.3)
55
+ builder (~> 3.1)
56
+ erubi (~> 1.4)
57
+ rails-dom-testing (~> 2.0)
58
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
59
+ activejob (7.0.3)
60
+ activesupport (= 7.0.3)
61
+ globalid (>= 0.3.6)
62
+ activemodel (7.0.3)
63
+ activesupport (= 7.0.3)
64
+ activerecord (7.0.3)
65
+ activemodel (= 7.0.3)
66
+ activesupport (= 7.0.3)
67
+ activestorage (7.0.3)
68
+ actionpack (= 7.0.3)
69
+ activejob (= 7.0.3)
70
+ activerecord (= 7.0.3)
71
+ activesupport (= 7.0.3)
72
+ marcel (~> 1.0)
73
+ mini_mime (>= 1.1.0)
74
+ activesupport (7.0.3)
75
+ concurrent-ruby (~> 1.0, >= 1.0.2)
76
+ i18n (>= 1.6, < 2)
77
+ minitest (>= 5.1)
78
+ tzinfo (~> 2.0)
79
+ ast (2.4.2)
80
+ bindex (0.8.1)
81
+ builder (3.2.4)
82
+ commander (4.6.0)
83
+ highline (~> 2.0.0)
84
+ concurrent-ruby (1.1.10)
85
+ crass (1.0.6)
86
+ debug (1.5.0)
87
+ irb (>= 1.3.6)
88
+ reline (>= 0.2.7)
89
+ digest (3.1.0)
90
+ erubi (1.10.0)
91
+ globalid (1.0.0)
92
+ activesupport (>= 5.0)
93
+ highline (2.0.3)
94
+ i18n (1.10.0)
95
+ concurrent-ruby (~> 1.0)
96
+ io-console (0.5.11)
97
+ irb (1.4.1)
98
+ reline (>= 0.3.0)
99
+ jbuilder (2.11.5)
100
+ actionview (>= 5.0.0)
101
+ activesupport (>= 5.0.0)
102
+ loofah (2.18.0)
103
+ crass (~> 1.0.2)
104
+ nokogiri (>= 1.5.9)
105
+ mail (2.7.1)
106
+ mini_mime (>= 0.1.1)
107
+ marcel (1.0.2)
108
+ method_source (1.0.0)
109
+ mini_mime (1.1.2)
110
+ minitest (5.16.1)
111
+ net-imap (0.2.3)
112
+ digest
113
+ net-protocol
114
+ strscan
115
+ net-pop (0.1.1)
116
+ digest
117
+ net-protocol
118
+ timeout
119
+ net-protocol (0.1.3)
120
+ timeout
121
+ net-smtp (0.3.1)
122
+ digest
123
+ net-protocol
124
+ timeout
125
+ nio4r (2.5.8)
126
+ nokogiri (1.13.6-x86_64-darwin)
127
+ racc (~> 1.4)
128
+ parlour (8.0.0)
129
+ commander (~> 4.5)
130
+ parser
131
+ rainbow (~> 3.0)
132
+ sorbet-runtime (>= 0.5)
133
+ parser (3.1.2.0)
134
+ ast (~> 2.4.1)
135
+ polyfill (1.9.0)
136
+ puma (5.6.4)
137
+ nio4r (~> 2.0)
138
+ racc (1.6.0)
139
+ rack (2.2.4)
140
+ rack-test (2.0.2)
141
+ rack (>= 1.3)
142
+ rails (7.0.3)
143
+ actioncable (= 7.0.3)
144
+ actionmailbox (= 7.0.3)
145
+ actionmailer (= 7.0.3)
146
+ actionpack (= 7.0.3)
147
+ actiontext (= 7.0.3)
148
+ actionview (= 7.0.3)
149
+ activejob (= 7.0.3)
150
+ activemodel (= 7.0.3)
151
+ activerecord (= 7.0.3)
152
+ activestorage (= 7.0.3)
153
+ activesupport (= 7.0.3)
154
+ bundler (>= 1.15.0)
155
+ railties (= 7.0.3)
156
+ rails-dom-testing (2.0.3)
157
+ activesupport (>= 4.2.0)
158
+ nokogiri (>= 1.6)
159
+ rails-html-sanitizer (1.4.3)
160
+ loofah (~> 2.3)
161
+ railties (7.0.3)
162
+ actionpack (= 7.0.3)
163
+ activesupport (= 7.0.3)
164
+ method_source
165
+ rake (>= 12.2)
166
+ thor (~> 1.0)
167
+ zeitwerk (~> 2.5)
168
+ rainbow (3.1.1)
169
+ rake (13.0.6)
170
+ reline (0.3.1)
171
+ io-console (~> 0.5)
172
+ safe_type (1.1.1)
173
+ sorbet (0.5.10139)
174
+ sorbet-static (= 0.5.10139)
175
+ sorbet-coerce (0.5.0)
176
+ polyfill (~> 1.8)
177
+ safe_type (~> 1.1, >= 1.1.1)
178
+ sorbet-runtime (>= 0.4.4704)
179
+ sorbet-runtime (0.5.10139)
180
+ sorbet-static (0.5.10139-universal-darwin-20)
181
+ sorbet-static (0.5.10139-universal-darwin-21)
182
+ sqlite3 (1.4.4)
183
+ strscan (3.0.3)
184
+ thor (1.2.1)
185
+ timeout (0.3.0)
186
+ tzinfo (2.0.4)
187
+ concurrent-ruby (~> 1.0)
188
+ web-console (4.2.0)
189
+ actionview (>= 6.0.0)
190
+ activemodel (>= 6.0.0)
191
+ bindex (>= 0.4.0)
192
+ railties (>= 6.0.0)
193
+ websocket-driver (0.7.5)
194
+ websocket-extensions (>= 0.1.0)
195
+ websocket-extensions (0.1.5)
196
+ zeitwerk (2.6.0)
197
+
198
+ PLATFORMS
199
+ x86_64-darwin-20
200
+ x86_64-darwin-21
201
+
202
+ DEPENDENCIES
203
+ debug
204
+ jbuilder
205
+ puma (~> 5.0)
206
+ rails (~> 7.0.3)
207
+ sorbet
208
+ sorbet-rails!
209
+ sorbet-runtime
210
+ sqlite3 (~> 1.4)
211
+ tzinfo-data
212
+ web-console
213
+
214
+ RUBY VERSION
215
+ ruby 3.0.1p64
216
+
217
+ BUNDLED WITH
218
+ 2.2.29
@@ -0,0 +1,24 @@
1
+ # README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative "config/application"
5
+
6
+ Rails.application.load_tasks
File without changes
@@ -0,0 +1 @@
1
+ /* Application styles */
@@ -0,0 +1,3 @@
1
+ # typed: ignore
2
+ class ApplicationController < ActionController::Base
3
+ end
File without changes
@@ -0,0 +1,3 @@
1
+ # typed: strict
2
+ module ApplicationHelper
3
+ end
@@ -0,0 +1,3 @@
1
+ # typed: strict
2
+ module BarHelper
3
+ end
@@ -0,0 +1,3 @@
1
+ # typed: strict
2
+ module BazHelper
3
+ end
@@ -0,0 +1,3 @@
1
+ # typed: strict
2
+ module FooHelper
3
+ end
@@ -0,0 +1,8 @@
1
+ # typed: strict
2
+ class ApplicationJob < ActiveJob::Base
3
+ # Automatically retry jobs that encountered a deadlock
4
+ # retry_on ActiveRecord::Deadlocked
5
+
6
+ # Most jobs are safe to ignore if the underlying records are no longer available
7
+ # discard_on ActiveJob::DeserializationError
8
+ end
@@ -0,0 +1,12 @@
1
+ # typed: strict
2
+ # N.B. You imagine the wizards update the point magically somehow?
3
+ # Nope, there is a "goblin" that takes their "give points" request and do it
4
+ # behind the scene.
5
+ class AwardHousePointHourglasses < ApplicationJob
6
+ extend T::Sig
7
+
8
+ sig { params(student: Wizard, point: Integer).void }
9
+ def perform(student:, point:)
10
+ # TODO: award point to student's house
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ # typed: ignore
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: "from@example.com"
4
+ layout "mailer"
5
+ end
@@ -0,0 +1,9 @@
1
+ # typed: ignore
2
+ class DailyProphetMailer < ApplicationMailer
3
+ extend T::Sig
4
+
5
+ sig { params(wizards: T::Array[Wizard], hotnews_only: T::Boolean).void }
6
+ def notify_subscribers(wizards:, hotnews_only:)
7
+ # TODO: mail the latest news to wizards!
8
+ end
9
+ end
@@ -0,0 +1,29 @@
1
+ # typed: ignore
2
+ class HogwartsAcceptanceMailer < ApplicationMailer
3
+ extend T::Sig
4
+
5
+ sig { params(student: Wizard).void }
6
+ def notify(student)
7
+ # TODO: mail acceptance letter to student
8
+ end
9
+
10
+ sig {
11
+ params(
12
+ teacher: Wizard,
13
+ note: String,
14
+ student: Wizard,
15
+ special: T::Boolean,
16
+ ).void
17
+ }
18
+ def notify_teacher(
19
+ teacher,
20
+ note=nil,
21
+ student:,
22
+ special: false
23
+ ) # TODO: let the teacher know when a students accepted offer
24
+ end
25
+
26
+ def notify_retry(student)
27
+ # TODO: send more owls!!
28
+ end
29
+ end
@@ -0,0 +1,4 @@
1
+ # typed: false
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ primary_abstract_class
4
+ end
File without changes
@@ -0,0 +1,11 @@
1
+ # typed: false
2
+ require 'active_support/concern'
3
+ module Mythical
4
+ extend ActiveSupport::Concern
5
+
6
+ class_methods do
7
+ def mythicals
8
+ all.to_a # yeah!
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ # typed: strict
2
+ class Headmaster < ApplicationRecord
3
+ belongs_to :school, required: false
4
+ belongs_to :wizard, optional: true
5
+
6
+ validates :school, presence: true
7
+ validates :wizard_id, presence: true
8
+ end
@@ -0,0 +1,6 @@
1
+ # typed: strict
2
+ # an abstract class that has no table
3
+ class Potion < ApplicationRecord
4
+ self.abstract_class = true
5
+ belongs_to :wizard, required: false
6
+ end
@@ -0,0 +1,4 @@
1
+ # typed: strict
2
+ class Robe < ApplicationRecord
3
+ belongs_to :wizard, required: false
4
+ end
@@ -0,0 +1,5 @@
1
+ # typed: strict
2
+ class School < ApplicationRecord
3
+ has_one :headmaster
4
+ validates :headmaster, presence: true
5
+ end
@@ -0,0 +1,5 @@
1
+ # typed: strict
2
+ class Spell < ApplicationRecord
3
+ # habtm enforced at the DB level
4
+ has_and_belongs_to_many :spell_books
5
+ end
@@ -0,0 +1,18 @@
1
+ # typed: false
2
+ class SpellBook < ApplicationRecord
3
+ validates :name, length: { minimum: 5 }, presence: true
4
+
5
+ # simulate when belongs_to is optional by default, but it is enforced at the DB level
6
+ belongs_to :wizard, optional: true
7
+
8
+ # habtm enforced at the DB level
9
+ has_and_belongs_to_many :spells
10
+
11
+ enum book_type: {
12
+ unclassified: 0,
13
+ biology: 1,
14
+ dark_art: 999,
15
+ }
16
+
17
+ scope :recent, -> { where('created_at > ?', 1.month.ago) }
18
+ end
@@ -0,0 +1,6 @@
1
+ # typed: true
2
+ class Squib < Wizard
3
+ def is_magical
4
+ false
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ # typed: strict
2
+ class Subject < ApplicationRecord
3
+ # habtm which is optional at the db level
4
+ has_and_belongs_to_many :wizards
5
+ end
@@ -0,0 +1,19 @@
1
+ # typed: false
2
+ class Wand < ApplicationRecord
3
+ include Mythical
4
+
5
+ self.skip_time_zone_conversion_for_attributes = [:broken_at]
6
+
7
+ enum core_type: {
8
+ phoenix_feather: 0,
9
+ dragon_heartstring: 1,
10
+ unicorn_tail_hair: 2,
11
+ basilisk_horn: 3,
12
+ }
13
+
14
+ belongs_to :wizard, required: true
15
+
16
+ def wood_type
17
+ 'Type ' + super
18
+ end
19
+ end
@@ -0,0 +1,65 @@
1
+ # typed: false
2
+ class Wizard < ApplicationRecord
3
+ validates :name, length: { minimum: 5 }, presence: true
4
+ # simulate conditional validation
5
+ validates :parent_email, presence: true, if: :Slytherin?
6
+
7
+ typed_enum house: {
8
+ Gryffindor: 0,
9
+ Hufflepuff: 1,
10
+ Ravenclaw: 2,
11
+ Slytherin: 3,
12
+ }
13
+
14
+ # To create conflict with enum
15
+ class Professor; end
16
+
17
+ enum professor: {
18
+ "Severus Snape": 0,
19
+ "Minerva McGonagall": 1,
20
+ "Pomona Sprout": 2,
21
+ "Filius Flitwick": 3,
22
+ "Hagrid": 4,
23
+ "Alastor 'Mad-Eye' Moody": 5,
24
+ }
25
+
26
+ typed_enum broom: {
27
+ nimbus: 'nimbus',
28
+ firebolt: 'firebolt',
29
+ }, _prefix: true
30
+
31
+ typed_enum quidditch_position: {
32
+ keeper: 0,
33
+ seeker: 1,
34
+ beater: 2,
35
+ chaser: 3,
36
+ }, _prefix: :quidditch
37
+
38
+ enum hair_color: {
39
+ brown: 0,
40
+ black: 1,
41
+ blonde: 2,
42
+ }, _suffix: :hair
43
+
44
+ enum eye_color: {
45
+ brown: 0,
46
+ green: 1,
47
+ blue: 2,
48
+ }, _prefix: :color, _suffix: :eyes
49
+
50
+ serialize :owl_results, Hash
51
+ serialize :newt_subjects # no specific data type, uses the default YAML Object coder
52
+ serialize :pets, Array
53
+ serialize :patronus_characteristics, JSON
54
+
55
+ has_one :wand
56
+ has_many :spell_books
57
+ # habtm which is optional at the db level
58
+ has_and_belongs_to_many :subjects
59
+
60
+ # simulate when belongs_to is optional by default
61
+ belongs_to :school, optional: true
62
+
63
+ scope :recent, -> { where('created_at > ?', 1.month.ago) }
64
+
65
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>V70</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <%= csrf_meta_tags %>
7
+ <%= csp_meta_tag %>
8
+
9
+ <%= stylesheet_link_tag "application" %>
10
+ </head>
11
+
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>