sorbet-rails 0.7.31 → 0.7.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci-master.yml +1 -1
- data/.github/workflows/ci.yml +1 -1
- data/.github/workflows/publish-gem.yml +9 -19
- data/CONTRIBUTING.md +1 -0
- data/Gemfile +4 -0
- data/README.md +14 -3
- data/Rakefile +27 -1
- data/lib/sorbet-rails/active_record_rbi_formatter.rb +4 -4
- data/lib/sorbet-rails/model_plugins/active_record_querying.rb +27 -0
- data/lib/sorbet-rails/model_rbi_formatter.rb +3 -3
- data/lib/sorbet-rails/rails_mixins/active_record_overrides.rb +1 -1
- data/lib/sorbet-rails/rails_mixins/custom_finder_methods.rb +8 -0
- data/lib/sorbet-rails/tasks/rails_rbi.rake +15 -0
- data/sorbet-rails.gemspec +2 -2
- data/spec/bin/run_all_specs.sh +1 -0
- data/spec/custom_finder_methods_spec.rb +23 -0
- data/spec/generators/rails-template.rb +2 -7
- data/spec/rails_helper.rb +2 -0
- data/spec/rake_rails_rbi_models_spec.rb +1 -1
- data/spec/support/v5.2/Gemfile.lock +76 -67
- data/spec/support/v5.2/sorbet_test_cases.rb +8 -0
- data/spec/support/v6.0/Gemfile.lock +93 -85
- data/spec/support/v6.0/sorbet_test_cases.rb +8 -0
- data/spec/support/v6.1/Gemfile +1 -1
- data/spec/support/v6.1/Gemfile.lock +115 -108
- data/spec/support/v6.1/sorbet_test_cases.rb +11 -0
- data/spec/support/v7.0/.gitattributes +7 -0
- data/spec/support/v7.0/.gitignore +35 -0
- data/spec/support/v7.0/Gemfile +48 -0
- data/spec/support/v7.0/Gemfile.lock +218 -0
- data/spec/support/v7.0/README.md +24 -0
- data/spec/support/v7.0/Rakefile +6 -0
- data/spec/support/v7.0/app/assets/images/.keep +0 -0
- data/spec/support/v7.0/app/assets/stylesheets/application.css +1 -0
- data/spec/support/v7.0/app/controllers/application_controller.rb +3 -0
- data/spec/support/v7.0/app/controllers/concerns/.keep +0 -0
- data/spec/support/v7.0/app/helpers/application_helper.rb +3 -0
- data/spec/support/v7.0/app/helpers/bar_helper.rb +3 -0
- data/spec/support/v7.0/app/helpers/baz_helper.rb +3 -0
- data/spec/support/v7.0/app/helpers/foo_helper.rb +3 -0
- data/spec/support/v7.0/app/jobs/application_job.rb +8 -0
- data/spec/support/v7.0/app/jobs/award_house_point_hourglasses.rb +12 -0
- data/spec/support/v7.0/app/mailers/application_mailer.rb +5 -0
- data/spec/support/v7.0/app/mailers/daily_prophet_mailer.rb +9 -0
- data/spec/support/v7.0/app/mailers/hogwarts_acceptance_mailer.rb +29 -0
- data/spec/support/v7.0/app/models/application_record.rb +4 -0
- data/spec/support/v7.0/app/models/concerns/.keep +0 -0
- data/spec/support/v7.0/app/models/concerns/mythical.rb +11 -0
- data/spec/support/v7.0/app/models/headmaster.rb +8 -0
- data/spec/support/v7.0/app/models/potion.rb +6 -0
- data/spec/support/v7.0/app/models/robe.rb +4 -0
- data/spec/support/v7.0/app/models/school.rb +5 -0
- data/spec/support/v7.0/app/models/spell.rb +5 -0
- data/spec/support/v7.0/app/models/spell_book.rb +18 -0
- data/spec/support/v7.0/app/models/squib.rb +6 -0
- data/spec/support/v7.0/app/models/subject.rb +5 -0
- data/spec/support/v7.0/app/models/wand.rb +19 -0
- data/spec/support/v7.0/app/models/wizard.rb +65 -0
- data/spec/support/v7.0/app/views/layouts/application.html.erb +15 -0
- data/spec/support/v7.0/app/views/layouts/mailer.html.erb +13 -0
- data/spec/support/v7.0/app/views/layouts/mailer.text.erb +1 -0
- data/spec/support/v7.0/bin/bundle +114 -0
- data/spec/support/v7.0/bin/rails +4 -0
- data/spec/support/v7.0/bin/rake +4 -0
- data/spec/support/v7.0/bin/setup +33 -0
- data/spec/support/v7.0/config/application.rb +38 -0
- data/spec/support/v7.0/config/boot.rb +4 -0
- data/spec/support/v7.0/config/database.yml +25 -0
- data/spec/support/v7.0/config/environment.rb +6 -0
- data/spec/support/v7.0/config/environments/development.rb +69 -0
- data/spec/support/v7.0/config/environments/production.rb +83 -0
- data/spec/support/v7.0/config/environments/test.rb +61 -0
- data/spec/support/v7.0/config/initializers/content_security_policy.rb +26 -0
- data/spec/support/v7.0/config/initializers/filter_parameter_logging.rb +9 -0
- data/spec/support/v7.0/config/initializers/inflections.rb +17 -0
- data/spec/support/v7.0/config/initializers/permissions_policy.rb +12 -0
- data/spec/support/v7.0/config/initializers/sorbet_rails.rb +3 -0
- data/spec/support/v7.0/config/locales/en.yml +33 -0
- data/spec/support/v7.0/config/puma.rb +44 -0
- data/spec/support/v7.0/config/routes.rb +8 -0
- data/spec/support/v7.0/config/storage.yml +34 -0
- data/spec/support/v7.0/config.ru +6 -0
- data/spec/support/v7.0/db/migrate/20190620000001_create_wizards.rb +14 -0
- data/spec/support/v7.0/db/migrate/20190620000002_create_wands.rb +12 -0
- data/spec/support/v7.0/db/migrate/20190620000003_create_spell_books.rb +10 -0
- data/spec/support/v7.0/db/migrate/20190620000004_add_more_column_types_to_wands.rb +14 -0
- data/spec/support/v7.0/db/migrate/20190620000005_add_broom_to_wizard.rb +6 -0
- data/spec/support/v7.0/db/migrate/20190620000006_add_more_enums_to_wizard.rb +9 -0
- data/spec/support/v7.0/db/migrate/20190620000007_add_type_to_wizard.rb +6 -0
- data/spec/support/v7.0/db/migrate/20190620000008_add_robe_to_wizard.rb +8 -0
- data/spec/support/v7.0/db/migrate/20190620000009_add_school.rb +10 -0
- data/spec/support/v7.0/db/migrate/20190620000010_add_subject.rb +8 -0
- data/spec/support/v7.0/db/migrate/20190620000011_add_subjects_wizards.rb +8 -0
- data/spec/support/v7.0/db/migrate/20190620000012_add_spell.rb +8 -0
- data/spec/support/v7.0/db/migrate/20190620000013_add_spells_spell_books.rb +8 -0
- data/spec/support/v7.0/db/migrate/20190620000014_create_headmasters.rb +9 -0
- data/spec/support/v7.0/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
- data/spec/support/v7.0/db/schema.rb +98 -0
- data/spec/support/v7.0/db/seeds.rb +8 -0
- data/spec/support/v7.0/lib/assets/.keep +0 -0
- data/spec/support/v7.0/lib/mythical_rbi_plugin.rb +16 -0
- data/spec/support/v7.0/lib/tasks/.keep +0 -0
- data/spec/support/v7.0/log/.keep +0 -0
- data/spec/support/v7.0/sorbet_test_cases.rb +439 -0
- data/spec/support/v7.0/storage/.keep +0 -0
- data/spec/support/v7.0/tmp/.keep +0 -0
- data/spec/support/v7.0/tmp/pids/.keep +0 -0
- data/spec/support/v7.0/tmp/storage/.keep +0 -0
- data/spec/support/v7.0/vendor/.keep +0 -0
- data/spec/test_data/v5.2/expected_active_record_base.rbi +6 -0
- data/spec/test_data/v5.2/expected_active_record_relation.rbi +8 -2
- data/spec/test_data/v5.2/expected_attachment.rbi +3 -3
- data/spec/test_data/v5.2/expected_blob.rbi +3 -3
- data/spec/test_data/v5.2/expected_habtm_subjects.rbi +3 -3
- data/spec/test_data/v5.2/expected_habtm_wizards.rbi +3 -3
- data/spec/test_data/v5.2/expected_headmaster.rbi +3 -3
- data/spec/test_data/v5.2/expected_internal_metadata.rbi +3 -3
- data/spec/test_data/v5.2/expected_potion.rbi +3 -3
- data/spec/test_data/v5.2/expected_robe.rbi +3 -3
- data/spec/test_data/v5.2/expected_schema_migration.rbi +3 -3
- data/spec/test_data/v5.2/expected_school.rbi +3 -3
- data/spec/test_data/v5.2/expected_spell/habtm_spell_books.rbi +3 -3
- data/spec/test_data/v5.2/expected_spell.rbi +3 -3
- data/spec/test_data/v5.2/expected_spell_book/habtm_spell_books.rbi +3 -3
- data/spec/test_data/v5.2/expected_spell_book/habtm_spells.rbi +3 -3
- data/spec/test_data/v5.2/expected_spell_book.rbi +3 -3
- data/spec/test_data/v5.2/expected_squib.rbi +3 -3
- data/spec/test_data/v5.2/expected_subject/habtm_wizards.rbi +3 -3
- data/spec/test_data/v5.2/expected_subject.rbi +3 -3
- data/spec/test_data/v5.2/expected_wand.rbi +3 -3
- data/spec/test_data/v5.2/expected_wizard/habtm_subjects.rbi +3 -3
- data/spec/test_data/v5.2/expected_wizard.rbi +3 -3
- data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +3 -3
- data/spec/test_data/v6.0/expected_active_record_base.rbi +6 -0
- data/spec/test_data/v6.0/expected_active_record_relation.rbi +8 -2
- data/spec/test_data/v6.0/expected_attachment.rbi +3 -3
- data/spec/test_data/v6.0/expected_blob.rbi +3 -3
- data/spec/test_data/v6.0/expected_habtm_subjects.rbi +3 -3
- data/spec/test_data/v6.0/expected_habtm_wizards.rbi +3 -3
- data/spec/test_data/v6.0/expected_headmaster.rbi +3 -3
- data/spec/test_data/v6.0/expected_internal_metadata.rbi +3 -3
- data/spec/test_data/v6.0/expected_potion.rbi +3 -3
- data/spec/test_data/v6.0/expected_robe.rbi +3 -3
- data/spec/test_data/v6.0/expected_schema_migration.rbi +3 -3
- data/spec/test_data/v6.0/expected_school.rbi +3 -3
- data/spec/test_data/v6.0/expected_spell/habtm_spell_books.rbi +3 -3
- data/spec/test_data/v6.0/expected_spell.rbi +3 -3
- data/spec/test_data/v6.0/expected_spell_book/habtm_spell_books.rbi +3 -3
- data/spec/test_data/v6.0/expected_spell_book/habtm_spells.rbi +3 -3
- data/spec/test_data/v6.0/expected_spell_book.rbi +3 -3
- data/spec/test_data/v6.0/expected_squib.rbi +3 -3
- data/spec/test_data/v6.0/expected_subject/habtm_wizards.rbi +3 -3
- data/spec/test_data/v6.0/expected_subject.rbi +3 -3
- data/spec/test_data/v6.0/expected_wand.rbi +3 -3
- data/spec/test_data/v6.0/expected_wizard/habtm_subjects.rbi +3 -3
- data/spec/test_data/v6.0/expected_wizard.rbi +3 -3
- data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +3 -3
- data/spec/test_data/v6.1/expected_active_record_base.rbi +6 -0
- data/spec/test_data/v6.1/expected_active_record_relation.rbi +8 -2
- data/spec/test_data/v6.1/expected_attachment.rbi +9 -3
- data/spec/test_data/v6.1/expected_blob.rbi +9 -3
- data/spec/test_data/v6.1/expected_habtm_subjects.rbi +3 -3
- data/spec/test_data/v6.1/expected_habtm_wizards.rbi +3 -3
- data/spec/test_data/v6.1/expected_headmaster.rbi +9 -3
- data/spec/test_data/v6.1/expected_internal_metadata.rbi +9 -3
- data/spec/test_data/v6.1/expected_potion.rbi +9 -3
- data/spec/test_data/v6.1/expected_record.rbi +9 -3
- data/spec/test_data/v6.1/expected_robe.rbi +9 -3
- data/spec/test_data/v6.1/expected_schema_migration.rbi +9 -3
- data/spec/test_data/v6.1/expected_school.rbi +9 -3
- data/spec/test_data/v6.1/expected_spell/habtm_spell_books.rbi +9 -3
- data/spec/test_data/v6.1/expected_spell.rbi +9 -3
- data/spec/test_data/v6.1/expected_spell_book/habtm_spell_books.rbi +3 -3
- data/spec/test_data/v6.1/expected_spell_book/habtm_spells.rbi +9 -3
- data/spec/test_data/v6.1/expected_spell_book.rbi +9 -3
- data/spec/test_data/v6.1/expected_squib.rbi +9 -3
- data/spec/test_data/v6.1/expected_subject/habtm_wizards.rbi +9 -3
- data/spec/test_data/v6.1/expected_subject.rbi +9 -3
- data/spec/test_data/v6.1/expected_variant_record.rbi +9 -3
- data/spec/test_data/v6.1/expected_wand.rbi +9 -3
- data/spec/test_data/v6.1/expected_wizard/habtm_subjects.rbi +9 -3
- data/spec/test_data/v6.1/expected_wizard.rbi +9 -3
- data/spec/test_data/v6.1/expected_wizard_wo_spellbook.rbi +9 -3
- data/spec/test_data/v7.0/expected_active_record_base.rbi +119 -0
- data/spec/test_data/v7.0/expected_active_record_relation.rbi +180 -0
- data/spec/test_data/v7.0/expected_application_job.rbi +20 -0
- data/spec/test_data/v7.0/expected_application_mailer.rbi +5 -0
- data/spec/test_data/v7.0/expected_attachment.rbi +358 -0
- data/spec/test_data/v7.0/expected_award_house_point_hourglasses.rbi +20 -0
- data/spec/test_data/v7.0/expected_blob.rbi +394 -0
- data/spec/test_data/v7.0/expected_custom_application_job.rbi +21 -0
- data/spec/test_data/v7.0/expected_custom_application_mailer.rbi +6 -0
- data/spec/test_data/v7.0/expected_custom_award_house_point_hourglasses.rbi +21 -0
- data/spec/test_data/v7.0/expected_custom_daily_prophet_mailer.rbi +8 -0
- data/spec/test_data/v7.0/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
- data/spec/test_data/v7.0/expected_daily_prophet_mailer.rbi +7 -0
- data/spec/test_data/v7.0/expected_headmaster.rbi +376 -0
- data/spec/test_data/v7.0/expected_helpers.rbi +27 -0
- data/spec/test_data/v7.0/expected_helpers_with_application_and_devise_helpers.rbi +34 -0
- data/spec/test_data/v7.0/expected_hogwarts_acceptance_mailer.rbi +20 -0
- data/spec/test_data/v7.0/expected_internal_metadata.rbi +346 -0
- data/spec/test_data/v7.0/expected_no_routes.rbi +4 -0
- data/spec/test_data/v7.0/expected_potion.rbi +328 -0
- data/spec/test_data/v7.0/expected_record.rbi +307 -0
- data/spec/test_data/v7.0/expected_robe.rbi +349 -0
- data/spec/test_data/v7.0/expected_routes.rbi +182 -0
- data/spec/test_data/v7.0/expected_schema_migration.rbi +319 -0
- data/spec/test_data/v7.0/expected_school.rbi +349 -0
- data/spec/test_data/v7.0/expected_spell/habtm_spell_books.rbi +367 -0
- data/spec/test_data/v7.0/expected_spell.rbi +340 -0
- data/spec/test_data/v7.0/expected_spell_book/habtm_spells.rbi +367 -0
- data/spec/test_data/v7.0/expected_spell_book.rbi +499 -0
- data/spec/test_data/v7.0/expected_squib.rbi +1204 -0
- data/spec/test_data/v7.0/expected_srb_tc_output.txt +1 -0
- data/spec/test_data/v7.0/expected_subject/habtm_wizards.rbi +367 -0
- data/spec/test_data/v7.0/expected_subject.rbi +340 -0
- data/spec/test_data/v7.0/expected_variant_record.rbi +382 -0
- data/spec/test_data/v7.0/expected_wand.rbi +611 -0
- data/spec/test_data/v7.0/expected_wizard/habtm_subjects.rbi +367 -0
- data/spec/test_data/v7.0/expected_wizard.rbi +1280 -0
- data/spec/test_data/v7.0/expected_wizard_wo_spellbook.rbi +1274 -0
- metadata +245 -3
@@ -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
|
+
* ...
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
/* Application styles */
|
File without changes
|
@@ -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,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
|
File without changes
|
@@ -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,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 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1,114 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
|
13
|
+
m = Module.new do
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def invoked_as_script?
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def env_var_version
|
21
|
+
ENV["BUNDLER_VERSION"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def cli_arg_version
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
+
bundler_version = nil
|
28
|
+
update_index = nil
|
29
|
+
ARGV.each_with_index do |a, i|
|
30
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
+
bundler_version = a
|
32
|
+
end
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
+
bundler_version = $1
|
35
|
+
update_index = i
|
36
|
+
end
|
37
|
+
bundler_version
|
38
|
+
end
|
39
|
+
|
40
|
+
def gemfile
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
43
|
+
|
44
|
+
File.expand_path("../../Gemfile", __FILE__)
|
45
|
+
end
|
46
|
+
|
47
|
+
def lockfile
|
48
|
+
lockfile =
|
49
|
+
case File.basename(gemfile)
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
51
|
+
else "#{gemfile}.lock"
|
52
|
+
end
|
53
|
+
File.expand_path(lockfile)
|
54
|
+
end
|
55
|
+
|
56
|
+
def lockfile_version
|
57
|
+
return unless File.file?(lockfile)
|
58
|
+
lockfile_contents = File.read(lockfile)
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
+
Regexp.last_match(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def bundler_requirement
|
64
|
+
@bundler_requirement ||=
|
65
|
+
env_var_version || cli_arg_version ||
|
66
|
+
bundler_requirement_for(lockfile_version)
|
67
|
+
end
|
68
|
+
|
69
|
+
def bundler_requirement_for(version)
|
70
|
+
return "#{Gem::Requirement.default}.a" unless version
|
71
|
+
|
72
|
+
bundler_gem_version = Gem::Version.new(version)
|
73
|
+
|
74
|
+
requirement = bundler_gem_version.approximate_recommendation
|
75
|
+
|
76
|
+
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
77
|
+
|
78
|
+
requirement += ".a" if bundler_gem_version.prerelease?
|
79
|
+
|
80
|
+
requirement
|
81
|
+
end
|
82
|
+
|
83
|
+
def load_bundler!
|
84
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
85
|
+
|
86
|
+
activate_bundler
|
87
|
+
end
|
88
|
+
|
89
|
+
def activate_bundler
|
90
|
+
gem_error = activation_error_handling do
|
91
|
+
gem "bundler", bundler_requirement
|
92
|
+
end
|
93
|
+
return if gem_error.nil?
|
94
|
+
require_error = activation_error_handling do
|
95
|
+
require "bundler/version"
|
96
|
+
end
|
97
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
98
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
99
|
+
exit 42
|
100
|
+
end
|
101
|
+
|
102
|
+
def activation_error_handling
|
103
|
+
yield
|
104
|
+
nil
|
105
|
+
rescue StandardError, LoadError => e
|
106
|
+
e
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
m.load_bundler!
|
111
|
+
|
112
|
+
if m.invoked_as_script?
|
113
|
+
load Gem.bin_path("bundler", "bundle")
|
114
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
6
|
+
|
7
|
+
def system!(*args)
|
8
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
9
|
+
end
|
10
|
+
|
11
|
+
FileUtils.chdir APP_ROOT do
|
12
|
+
# This script is a way to set up or update your development environment automatically.
|
13
|
+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
14
|
+
# Add necessary setup steps to this file.
|
15
|
+
|
16
|
+
puts "== Installing dependencies =="
|
17
|
+
system! "gem install bundler --conservative"
|
18
|
+
system("bundle check") || system!("bundle install")
|
19
|
+
|
20
|
+
# puts "\n== Copying sample files =="
|
21
|
+
# unless File.exist?("config/database.yml")
|
22
|
+
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
23
|
+
# end
|
24
|
+
|
25
|
+
puts "\n== Preparing database =="
|
26
|
+
system! "bin/rails db:prepare"
|
27
|
+
|
28
|
+
puts "\n== Removing old logs and tempfiles =="
|
29
|
+
system! "bin/rails log:clear tmp:clear"
|
30
|
+
|
31
|
+
puts "\n== Restarting application server =="
|
32
|
+
system! "bin/rails restart"
|
33
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# typed: strict
|
2
|
+
require_relative "boot"
|
3
|
+
|
4
|
+
require "rails"
|
5
|
+
# Pick the frameworks you want:
|
6
|
+
require "active_model/railtie"
|
7
|
+
require "active_job/railtie"
|
8
|
+
require "active_record/railtie"
|
9
|
+
require "active_storage/engine"
|
10
|
+
require "action_controller/railtie"
|
11
|
+
require "action_mailer/railtie"
|
12
|
+
require "action_mailbox/engine"
|
13
|
+
# require "action_text/engine"
|
14
|
+
require "action_view/railtie"
|
15
|
+
# require "action_cable/engine"
|
16
|
+
# require "rails/test_unit/railtie"
|
17
|
+
|
18
|
+
# Require the gems listed in Gemfile, including any gems
|
19
|
+
# you've limited to :test, :development, or :production.
|
20
|
+
Bundler.require(*Rails.groups)
|
21
|
+
|
22
|
+
module V70
|
23
|
+
class Application < Rails::Application
|
24
|
+
# Initialize configuration defaults for originally generated Rails version.
|
25
|
+
config.load_defaults 7.0
|
26
|
+
|
27
|
+
# Configuration for the application, engines, and railties goes here.
|
28
|
+
#
|
29
|
+
# These settings can be overridden in specific environments using the files
|
30
|
+
# in config/environments, which are processed later.
|
31
|
+
#
|
32
|
+
# config.time_zone = "Central Time (US & Canada)"
|
33
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
34
|
+
|
35
|
+
# Don't generate system test files.
|
36
|
+
config.generators.system_tests = nil
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite. Versions 3.8.0 and up are supported.
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem "sqlite3"
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/production.sqlite3
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# typed: strict
|
2
|
+
require "active_support/core_ext/integer/time"
|
3
|
+
|
4
|
+
Rails.application.configure do
|
5
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
6
|
+
|
7
|
+
# In the development environment your application's code is reloaded any time
|
8
|
+
# it changes. This slows down response time but is perfect for development
|
9
|
+
# since you don't have to restart the web server when you make code changes.
|
10
|
+
config.cache_classes = false
|
11
|
+
|
12
|
+
# Do not eager load code on boot.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Show full error reports.
|
16
|
+
config.consider_all_requests_local = true
|
17
|
+
|
18
|
+
# Enable server timing
|
19
|
+
config.server_timing = true
|
20
|
+
|
21
|
+
# Enable/disable caching. By default caching is disabled.
|
22
|
+
# Run rails dev:cache to toggle caching.
|
23
|
+
if Rails.root.join("tmp/caching-dev.txt").exist?
|
24
|
+
config.action_controller.perform_caching = true
|
25
|
+
config.action_controller.enable_fragment_cache_logging = true
|
26
|
+
|
27
|
+
config.cache_store = :memory_store
|
28
|
+
config.public_file_server.headers = {
|
29
|
+
"Cache-Control" => "public, max-age=#{2.days.to_i}"
|
30
|
+
}
|
31
|
+
else
|
32
|
+
config.action_controller.perform_caching = false
|
33
|
+
|
34
|
+
config.cache_store = :null_store
|
35
|
+
end
|
36
|
+
|
37
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
38
|
+
config.active_storage.service = :local
|
39
|
+
|
40
|
+
# Don't care if the mailer can't send.
|
41
|
+
config.action_mailer.raise_delivery_errors = false
|
42
|
+
|
43
|
+
config.action_mailer.perform_caching = false
|
44
|
+
|
45
|
+
# Print deprecation notices to the Rails logger.
|
46
|
+
config.active_support.deprecation = :log
|
47
|
+
|
48
|
+
# Raise exceptions for disallowed deprecations.
|
49
|
+
config.active_support.disallowed_deprecation = :raise
|
50
|
+
|
51
|
+
# Tell Active Support which deprecation messages to disallow.
|
52
|
+
config.active_support.disallowed_deprecation_warnings = []
|
53
|
+
|
54
|
+
# Raise an error on page load if there are pending migrations.
|
55
|
+
config.active_record.migration_error = :page_load
|
56
|
+
|
57
|
+
# Highlight code that triggered database queries in logs.
|
58
|
+
config.active_record.verbose_query_logs = true
|
59
|
+
|
60
|
+
|
61
|
+
# Raises error for missing translations.
|
62
|
+
# config.i18n.raise_on_missing_translations = true
|
63
|
+
|
64
|
+
# Annotate rendered view with file names.
|
65
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
66
|
+
|
67
|
+
# Uncomment if you wish to allow Action Cable access from any origin.
|
68
|
+
# config.action_cable.disable_request_forgery_protection = true
|
69
|
+
end
|