diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index fdefa3c5..de8995ca 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -16,10 +16,9 @@ jobs: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.5.8 # Not needed with a .ruby-version file + ruby-version: 3.3.0 bundler-cache: true # runs 'bundle install' and caches installed gems automatically - run: | - gem install bundler --version 1.17.3 -N - bundle _1.17.3_ install -j 12 + bundle install -j 12 bundle exec rubocop --format progress -P diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index feb3fdab..57958291 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest services: postgres: - image: postgres:13 + image: postgres:15 ports: - 5432:5432 env: @@ -27,13 +27,12 @@ jobs: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.5.8 # Not needed with a .ruby-version file + ruby-version: 3.3.0 bundler-cache: true # runs 'bundle install' and caches installed gems automatically - run: | - gem update --system 3.2.3 || true - gem install bundler --version 1.17.3 -N - bundle _1.17.3_ install -j 12 + gem update --system || true + install -j 12 - run: | bundle exec rake db:create @@ -41,4 +40,4 @@ jobs: bundle exec rake db:test:prepare - run: | - bundle exec rspec + bundle exec rspec -b diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ceaf9ed4..75bff208 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,17 +1,17 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2022-05-02 03:13:36 UTC using RuboCop version 1.27.0. +# on 2024-02-16 22:39:17 UTC using RuboCop version 1.60.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 2 +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowSafeAssignment. Lint/AssignmentInCondition: Exclude: - 'app/controllers/passwords_controller.rb' - - 'app/controllers/ticket_requests_controller.rb' # Offense count: 1 Lint/ShadowingOuterLocalVariable: @@ -24,61 +24,247 @@ Lint/UnmodifiedReduceAccumulator: - 'app/helpers/shifts_helper.rb' # Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). Lint/UselessAssignment: Exclude: - 'config/unicorn.rb' -# Offense count: 20 -# Configuration parameters: IgnoredMethods, CountRepeatedAttributes. +# Offense count: 19 +# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: Max: 62 -# Offense count: 21 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. -# IgnoredMethods: refine +# Offense count: 3 +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode. +# AllowedMethods: refine Metrics/BlockLength: - Max: 255 + Max: 55 -# Offense count: 2 +# Offense count: 3 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 157 + Max: 156 -# Offense count: 4 -# Configuration parameters: IgnoredMethods. +# Offense count: 5 +# Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: Max: 13 -# Offense count: 25 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +# Offense count: 24 +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: - Max: 59 + Max: 58 # Offense count: 1 # Configuration parameters: CountComments, CountAsOne. Metrics/ModuleLength: Max: 114 -# Offense count: 3 -# Configuration parameters: IgnoredMethods. +# Offense count: 4 +# Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/PerceivedComplexity: Max: 15 # Offense count: 6 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. -# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to +# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to Naming/MethodParameterName: Exclude: - 'spec/support/factory_bot.rb' - 'spec/support/time_extensions.rb' -# Offense count: 74 +# Offense count: 15 +# Configuration parameters: Prefixes, AllowedPatterns. +# Prefixes: when, with, without +RSpec/ContextWording: + Exclude: + - 'spec/controllers/events_controller_spec.rb' + - 'spec/models/event_spec.rb' + - 'spec/models/ticket_request_spec.rb' + +# Offense count: 1 +# Configuration parameters: IgnoredMetadata. +RSpec/DescribeClass: + Exclude: + - 'spec/lib/fnf/music_submissions_spec.rb' + +# Offense count: 1 +RSpec/ExpectInHook: + Exclude: + - 'spec/lib/fnf/event_reporter_spec.rb' + +# Offense count: 1 +# Configuration parameters: . +# SupportedStyles: have_received, receive +RSpec/MessageSpies: + EnforcedStyle: receive + +# Offense count: 15 +# Configuration parameters: AllowSubject. +RSpec/MultipleMemoizedHelpers: + Max: 11 + +# Offense count: 3 +# Configuration parameters: EnforcedStyle, IgnoreSharedExamples. +# SupportedStyles: always, named_only +RSpec/NamedSubject: + Exclude: + - 'spec/controllers/ticket_requests_controller_spec.rb' + - 'spec/lib/fnf/csv_reader_spec.rb' + - 'spec/models/ticket_request_spec.rb' + +# Offense count: 60 +# Configuration parameters: AllowedGroups. +RSpec/NestedGroups: + Max: 5 + +# Offense count: 52 +# Configuration parameters: AllowedPatterns. +# AllowedPatterns: ^expect_, ^assert_ +RSpec/NoExpectationExample: + Exclude: + - 'spec/controllers/emails_controller_spec.rb' + - 'spec/controllers/events_controller_spec.rb' + - 'spec/controllers/ticket_requests_controller_spec.rb' + - 'spec/lib/fnf/event_reporter_spec.rb' + - 'spec/mailers/payment_mailer_spec.rb' + - 'spec/mailers/ticket_request_mailer_spec.rb' + - 'spec/models/event_spec.rb' + - 'spec/models/ticket_request_spec.rb' + - 'spec/models/user_spec.rb' + +# Offense count: 2 +RSpec/RepeatedExampleGroupBody: + Exclude: + - 'spec/models/event_spec.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +Rails/ApplicationMailer: + Exclude: + - 'app/mailers/eald_payment_mailer.rb' + - 'app/mailers/payment_mailer.rb' + - 'app/mailers/ticket_request_mailer.rb' + +# Offense count: 9 +# Configuration parameters: Database, Include. +# SupportedDatabases: mysql, postgresql +# Include: db/**/*.rb +Rails/BulkChangeTable: + Exclude: + - 'db/migrate/20130226221916_add_user_to_ticket_request.rb' + - 'db/migrate/20130325024448_add_ticket_cost_info_to_event.rb' + - 'db/migrate/20130803212458_add_start_and_end_ticket_sale_times_to_events.rb' + - 'db/migrate/20140428045329_add_role_to_ticket_requests.rb' + - 'db/migrate/20140605045004_extract_address_into_multiple_fields.rb' + - 'db/migrate/20140616030905_change_camping_type_on_ticket_requests.rb' + - 'db/migrate/20160611234315_add_eald_columns.rb' + +# Offense count: 3 +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/HasManyOrHasOneDependent: + Exclude: + - 'app/models/event.rb' + - 'app/models/ticket_request.rb' + - 'app/models/user.rb' + +# Offense count: 3 +# Configuration parameters: Include. +# Include: app/helpers/**/*.rb +Rails/HelperInstanceVariable: + Exclude: + - 'app/helpers/shifts_helper.rb' + +# Offense count: 14 +Rails/I18nLocaleTexts: + Exclude: + - 'app/controllers/home_controller.rb' + - 'app/controllers/jobs_controller.rb' + - 'app/controllers/passwords_controller.rb' + - 'app/controllers/payments_controller.rb' + - 'app/controllers/shifts_controller.rb' + - 'app/controllers/ticket_requests_controller.rb' + - 'app/models/event_admin.rb' + - 'app/models/payment.rb' + - 'app/models/site_admin.rb' + - 'app/models/user.rb' + +# Offense count: 1 +# Configuration parameters: Database, Include. +# SupportedDatabases: mysql +# Include: db/**/*.rb +Rails/NotNullColumn: + Exclude: + - 'db/migrate/20130311213508_add_event_id_to_ticket_request.rb' + +# Offense count: 9 +# Configuration parameters: Include. +# Include: db/**/*.rb +Rails/ReversibleMigration: + Exclude: + - 'db/migrate/20130226221916_add_user_to_ticket_request.rb' + - 'db/migrate/20140515053804_remove_performer_from_ticket_requests.rb' + - 'db/migrate/20140605045004_extract_address_into_multiple_fields.rb' + - 'db/migrate/20140605052627_remove_volunteer_shifts_from_ticket_requests.rb' + - 'db/migrate/20140605053705_remove_ask_how_many_shifts_from_events.rb' + - 'db/migrate/20140605060026_add_camping_type_to_ticket_requests.rb' + - 'db/migrate/20140616030905_change_camping_type_on_ticket_requests.rb' + +# Offense count: 3 +# Configuration parameters: ForbiddenMethods, AllowedMethods. +# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all +Rails/SkipsModelValidations: + Exclude: + - 'app/controllers/application_controller.rb' + - 'app/controllers/ticket_requests_controller.rb' + - 'app/models/user.rb' + +# Offense count: 3 +# Configuration parameters: Include. +# Include: db/**/*.rb +Rails/ThreeStateBooleanColumn: + Exclude: + - 'db/migrate/20140515054433_add_vehicle_camping_requested_to_ticket_requests.rb' + - 'db/migrate/20140616030905_change_camping_type_on_ticket_requests.rb' + - 'db/migrate/20150609064608_add_agrees_terms_to_ticket_requests.rb' + +# Offense count: 1 +# Configuration parameters: TransactionMethods. +Rails/TransactionExitStatement: + Exclude: + - 'app/models/ticket_request.rb' + +# Offense count: 2 +# Configuration parameters: Include. +# Include: app/models/**/*.rb +Rails/UniqueValidationWithoutIndex: + Exclude: + - 'app/models/payment.rb' + - 'app/models/site_admin.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Rake/Desc: + Exclude: + - 'Rakefile' + +# Offense count: 81 # Configuration parameters: AllowedConstants. Style/Documentation: Enabled: false +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Exclude: + - 'app/models/application_record.rb' + # Offense count: 5 -# Configuration parameters: MinBodyLength. +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. Style/GuardClause: Exclude: - 'app/controllers/application_controller.rb' @@ -92,9 +278,9 @@ Style/MissingRespondToMissing: Exclude: - 'spec/support/factory_bot.rb' -# Offense count: 3 -# This cop supports safe auto-correction (--auto-correct). -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# Offense count: 7 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https Layout/LineLength: Max: 174 diff --git a/.ruby-version b/.ruby-version index be94e6f5..15a27998 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.2 +3.3.0 diff --git a/Brewfile b/Brewfile index a45af24a..cf525934 100644 --- a/Brewfile +++ b/Brewfile @@ -56,6 +56,7 @@ brew 'rsync' brew 'ruby-build' brew 'ruby-completion' brew 'shellcheck' +brew 'stripe/stripe-mock/stripe-mock' brew 'tree' brew 'vim' brew 'watch' diff --git a/Brewfile.lock.json b/Brewfile.lock.json index 248fb8c7..ede91c28 100644 --- a/Brewfile.lock.json +++ b/Brewfile.lock.json @@ -939,60 +939,45 @@ } }, "libffi": { - "version": "3.4.4", + "version": "3.4.5", "bottle": { "rebuild": 0, "root_url": "https://ghcr.io/v2/homebrew/core", "files": { "arm64_sonoma": { "cellar": ":any", - "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:35b8d6504f17f98eba5b432a0bf33936d7ca0c5ab1983cefba128621210f69ef", - "sha256": "35b8d6504f17f98eba5b432a0bf33936d7ca0c5ab1983cefba128621210f69ef" + "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:05b449dea2ce5e3f9d0a68557ab04938dc95c179bd33797e8b455efab7861241", + "sha256": "05b449dea2ce5e3f9d0a68557ab04938dc95c179bd33797e8b455efab7861241" }, "arm64_ventura": { "cellar": ":any", - "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:66d9dcb218283c43250b04e507b7b96f0cf18fb1017fcaf811729324d11127f7", - "sha256": "66d9dcb218283c43250b04e507b7b96f0cf18fb1017fcaf811729324d11127f7" + "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:c1f444ded62e9fc4da1179f2f1f18bbf3db6be8d8e3b764f52d3370a6a534ed3", + "sha256": "c1f444ded62e9fc4da1179f2f1f18bbf3db6be8d8e3b764f52d3370a6a534ed3" }, "arm64_monterey": { "cellar": ":any", - "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:e7ea0921a053dc81e818c3893887e819ed26c0e231fd306e05e905b51b9ea902", - "sha256": "e7ea0921a053dc81e818c3893887e819ed26c0e231fd306e05e905b51b9ea902" - }, - "arm64_big_sur": { - "cellar": ":any", - "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:8d44b24963c114512934de23cc776a6190f5bcb65db8e6cc65e1b60122571747", - "sha256": "8d44b24963c114512934de23cc776a6190f5bcb65db8e6cc65e1b60122571747" + "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:971cbcb1d220e448683bbc76c561e03e41610a8ce4065b9be92e2e7e838c4a07", + "sha256": "971cbcb1d220e448683bbc76c561e03e41610a8ce4065b9be92e2e7e838c4a07" }, "sonoma": { "cellar": ":any", - "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:8d52eea700d32139fb1844e58af00397bf9fe0bbe297bcc9c0b7a2a769725419", - "sha256": "8d52eea700d32139fb1844e58af00397bf9fe0bbe297bcc9c0b7a2a769725419" + "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:70c125b86120c56b00f737b46f207da0b46d54233367d36d53ea774562e39c18", + "sha256": "70c125b86120c56b00f737b46f207da0b46d54233367d36d53ea774562e39c18" }, "ventura": { "cellar": ":any", - "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:a86ed7eb1b02a3d44cd6e75977c910466357a1715743f89be94416d000577133", - "sha256": "a86ed7eb1b02a3d44cd6e75977c910466357a1715743f89be94416d000577133" + "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:4aff209ef6d0aadd8dbc6384deb2cb1173bed527e27838142ab2c5b93a647e76", + "sha256": "4aff209ef6d0aadd8dbc6384deb2cb1173bed527e27838142ab2c5b93a647e76" }, "monterey": { "cellar": ":any", - "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:9dd80c4c3d4451cc3216dbf1129a2bddec474aa9266b6bb5c603e0a6cce7605b", - "sha256": "9dd80c4c3d4451cc3216dbf1129a2bddec474aa9266b6bb5c603e0a6cce7605b" - }, - "big_sur": { - "cellar": ":any", - "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:b5c4e2054802f97a68b8f32d9ff2c6782f9a37223cd0a3b3d2175ecf04740a4f", - "sha256": "b5c4e2054802f97a68b8f32d9ff2c6782f9a37223cd0a3b3d2175ecf04740a4f" - }, - "catalina": { - "cellar": ":any", - "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:1f53646211da139b423eb38f923bc38da1de86b7a68bfc2df5351098fe3c67e3", - "sha256": "1f53646211da139b423eb38f923bc38da1de86b7a68bfc2df5351098fe3c67e3" + "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:7c96a49210ba55ce4473d36c2dbd86192ae33f2c267ee47b5ed0e970aea62093", + "sha256": "7c96a49210ba55ce4473d36c2dbd86192ae33f2c267ee47b5ed0e970aea62093" }, "x86_64_linux": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:dcc9412995b5e319f64796a77b1eb8e684f1d1b6b5d7ac824f434ada692e4ff8", - "sha256": "dcc9412995b5e319f64796a77b1eb8e684f1d1b6b5d7ac824f434ada692e4ff8" + "url": "https://ghcr.io/v2/homebrew/core/libffi/blobs/sha256:ad76b74572cf5792f5160938bd6ae8b934f0d021abd300d45feba51dca1313fc", + "sha256": "ad76b74572cf5792f5160938bd6ae8b934f0d021abd300d45feba51dca1313fc" } } } @@ -2443,45 +2428,45 @@ } }, "yamllint": { - "version": "1.34.0", + "version": "1.35.1", "bottle": { "rebuild": 0, "root_url": "https://ghcr.io/v2/homebrew/core", "files": { "arm64_sonoma": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:e2c7af04cad22bf7774b178d359194640840e0120b085f1ff9357dbfeb869c52", - "sha256": "e2c7af04cad22bf7774b178d359194640840e0120b085f1ff9357dbfeb869c52" + "url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:16120f61c559ec5fd83bb28d110b265d7bfeb38fb5f6ae3958b6edddc3836fde", + "sha256": "16120f61c559ec5fd83bb28d110b265d7bfeb38fb5f6ae3958b6edddc3836fde" }, "arm64_ventura": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:d3fa38fc60cb71ac91560aea632134c104520e0f01a06abbd20364211ae1a989", - "sha256": "d3fa38fc60cb71ac91560aea632134c104520e0f01a06abbd20364211ae1a989" + "url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:9ede8ae30ddc0615758e87836e91d84e712616801d17c0ff0ae1ebb737f4ae7f", + "sha256": "9ede8ae30ddc0615758e87836e91d84e712616801d17c0ff0ae1ebb737f4ae7f" }, "arm64_monterey": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:accbbf0eb1134eeceb373cc9bb09052c3a1f28806aa89de212b95ab5c24e6ea9", - "sha256": "accbbf0eb1134eeceb373cc9bb09052c3a1f28806aa89de212b95ab5c24e6ea9" + "url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:ee60920ab2ac09300844b9a0ddadef8b212d331e77ad00a3a8d163ce4651860a", + "sha256": "ee60920ab2ac09300844b9a0ddadef8b212d331e77ad00a3a8d163ce4651860a" }, "sonoma": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:6caee252f7d4768297704a7378f517d53608352aef512fa6da8b0dddd43d20a6", - "sha256": "6caee252f7d4768297704a7378f517d53608352aef512fa6da8b0dddd43d20a6" + "url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:3a9a0bfa4caf102c09649e2c5ef5d8c33da13ffc0390c167ed6b4b35b8715b5f", + "sha256": "3a9a0bfa4caf102c09649e2c5ef5d8c33da13ffc0390c167ed6b4b35b8715b5f" }, "ventura": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:dbbe3c4287f505126715bbf5f36dc98b22d6a6136724fc95f9154fa1578c877a", - "sha256": "dbbe3c4287f505126715bbf5f36dc98b22d6a6136724fc95f9154fa1578c877a" + "url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:8d1074f726fc3dce640a3c19542edcac8bfd67676508c43879ed833d919a12b1", + "sha256": "8d1074f726fc3dce640a3c19542edcac8bfd67676508c43879ed833d919a12b1" }, "monterey": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:6416777b4fc9e8f1e1ebabc9284778918554ad8792f894b322d10ad57ca7acb6", - "sha256": "6416777b4fc9e8f1e1ebabc9284778918554ad8792f894b322d10ad57ca7acb6" + "url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:9c609546ff7edd2d308ec5dc3e49676eeab8eda9ef9211571aadeeeeee74920b", + "sha256": "9c609546ff7edd2d308ec5dc3e49676eeab8eda9ef9211571aadeeeeee74920b" }, "x86_64_linux": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:b1fe6d3f1bf98b489c8d89000d0f69c091ee5d76c3ec46d09d375628368d1a00", - "sha256": "b1fe6d3f1bf98b489c8d89000d0f69c091ee5d76c3ec46d09d375628368d1a00" + "url": "https://ghcr.io/v2/homebrew/core/yamllint/blobs/sha256:8799f333c63d658c4dd6d87113fab523b23b8e41940e869c50e4205609145bb7", + "sha256": "8799f333c63d658c4dd6d87113fab523b23b8e41940e869c50e4205609145bb7" } } } @@ -2531,45 +2516,45 @@ } }, "yq": { - "version": "4.40.7", + "version": "4.41.1", "bottle": { "rebuild": 0, "root_url": "https://ghcr.io/v2/homebrew/core", "files": { "arm64_sonoma": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:ae120bb652a1899b07742773b3f29d092252466e758e11b9936b8adb758ac098", - "sha256": "ae120bb652a1899b07742773b3f29d092252466e758e11b9936b8adb758ac098" + "url": "https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:c5404881e9aba4d22663971dd620f7e8bbd2bbed07d6623ddcb06b8108eb8271", + "sha256": "c5404881e9aba4d22663971dd620f7e8bbd2bbed07d6623ddcb06b8108eb8271" }, "arm64_ventura": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:420e9b4f7662ed6ffcbc01102030f30abd3b11aac811c61a285a74cb8b5b6f7b", - "sha256": "420e9b4f7662ed6ffcbc01102030f30abd3b11aac811c61a285a74cb8b5b6f7b" + "url": "https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:ab37a388dac49f8aa1dee95154cf840cd4c23cd8756cf394dc629e647d908c8d", + "sha256": "ab37a388dac49f8aa1dee95154cf840cd4c23cd8756cf394dc629e647d908c8d" }, "arm64_monterey": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:14882d182eefc14dc8b5697c24ea3e09df40c8ca45fb70536a17601f68ab0def", - "sha256": "14882d182eefc14dc8b5697c24ea3e09df40c8ca45fb70536a17601f68ab0def" + "url": "https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:8580ba4cd20a0d5610dd253d91689d1fdacb5eb792ec2115713921524b8eb4ad", + "sha256": "8580ba4cd20a0d5610dd253d91689d1fdacb5eb792ec2115713921524b8eb4ad" }, "sonoma": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:5b6c8d4678f9807cade82cddbb54365b3f79ffc6ff5d3ce995ebb6684a66d104", - "sha256": "5b6c8d4678f9807cade82cddbb54365b3f79ffc6ff5d3ce995ebb6684a66d104" + "url": "https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:db2d0b23fcae3685db08dc78b67c592166ec4311f6058aad40fd984face94e60", + "sha256": "db2d0b23fcae3685db08dc78b67c592166ec4311f6058aad40fd984face94e60" }, "ventura": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:43812cc640af7a5b695a34a1ccea048e40212864d054cd2177cdd2afbcfe502c", - "sha256": "43812cc640af7a5b695a34a1ccea048e40212864d054cd2177cdd2afbcfe502c" + "url": "https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:823638d8a82d905fcd00c7e88b12cfe6ada9e9e4a9ea627cfb37d55965648354", + "sha256": "823638d8a82d905fcd00c7e88b12cfe6ada9e9e4a9ea627cfb37d55965648354" }, "monterey": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:eef56bff54c49fce95472e0ad7ff3343c9b591d50c56bb2a3c5dfa929c10112e", - "sha256": "eef56bff54c49fce95472e0ad7ff3343c9b591d50c56bb2a3c5dfa929c10112e" + "url": "https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:87ff086af7864d8419c519642079d6923cbc7931250faa39dd0df44a58ffcaf9", + "sha256": "87ff086af7864d8419c519642079d6923cbc7931250faa39dd0df44a58ffcaf9" }, "x86_64_linux": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:4ad8aad7eaf0269ce1bca1996c958e3d96465748a34b86bd5993fed07b306003", - "sha256": "4ad8aad7eaf0269ce1bca1996c958e3d96465748a34b86bd5993fed07b306003" + "url": "https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:2c42c4894c4508bd6af2551dd07e5fe5646fe0ecb25d0a96931a263b5a46fdc1", + "sha256": "2c42c4894c4508bd6af2551dd07e5fe5646fe0ecb25d0a96931a263b5a46fdc1" } } } @@ -2705,6 +2690,10 @@ } } } + }, + "stripe/stripe-mock/stripe-mock": { + "version": "0.182.0", + "bottle": false } }, "cask": { @@ -2967,7 +2956,7 @@ } }, "font-victor-mono": { - "version": "1.5.5", + "version": "1.5.6", "options": { "full_name": "font-victor-mono" } diff --git a/Gemfile b/Gemfile index 066aaa77..373df874 100644 --- a/Gemfile +++ b/Gemfile @@ -36,6 +36,7 @@ gem 'twitter-bootstrap-rails' gem 'uglifier' gem 'ventable' gem 'yard' +gem 'annotate' group :development, :test do gem 'codecov' @@ -48,7 +49,6 @@ group :development, :test do end group :development do - gem 'annotate' gem 'asciidoctor' gem 'capistrano', '< 3' end diff --git a/Gemfile.lock b/Gemfile.lock index 53ed558b..1b129b0b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -204,7 +204,7 @@ GEM parser (3.3.0.5) ast (~> 2.4.1) racc - pg (1.5.4) + pg (1.5.5) protected_attributes_continued (1.9.0) activemodel (>= 5.0) psych (5.1.2) @@ -347,7 +347,7 @@ GEM sprockets (>= 3.0.0) ssrf_filter (1.1.2) stringio (3.1.0) - stripe (10.8.0) + stripe (10.9.0) stripe-ruby-mock (2.5.8) dante (>= 0.2.0) multi_json (~> 1.0) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 504a5dbf..10a4cba8 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,4 +1,3 @@ - class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end diff --git a/app/models/eald_payment.rb b/app/models/eald_payment.rb index ad655c9d..de764a29 100644 --- a/app/models/eald_payment.rb +++ b/app/models/eald_payment.rb @@ -1,5 +1,24 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: eald_payments +# +# id :bigint not null, primary key +# amount_charged_cents :integer not null +# early_arrival_passes :integer default(0), not null +# email :string(255) not null +# late_departure_passes :integer default(0), not null +# name :string(255) not null +# created_at :datetime not null +# updated_at :datetime not null +# event_id :bigint +# stripe_charge_id :string not null +# +# Indexes +# +# index_eald_payments_on_event_id (event_id) +# # Payment for early arrival/late departures passes. # # We only associate this with an event, as we want to treat these separately diff --git a/app/models/event.rb b/app/models/event.rb index dc069476..edd35be5 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -1,5 +1,33 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: events +# +# id :bigint not null, primary key +# adult_ticket_price :decimal(8, 2) +# allow_donations :boolean default(FALSE), not null +# allow_financial_assistance :boolean default(FALSE), not null +# cabin_price :decimal(8, 2) +# early_arrival_price :decimal(8, 2) default(0.0) +# end_time :datetime +# kid_ticket_price :decimal(8, 2) +# late_departure_price :decimal(8, 2) default(0.0) +# max_adult_tickets_per_request :integer +# max_cabin_requests :integer +# max_cabins_per_request :integer +# max_kid_tickets_per_request :integer +# name :string +# photo :string +# require_mailing_address :boolean default(FALSE), not null +# start_time :datetime +# ticket_requests_end_time :datetime +# ticket_sales_end_time :datetime +# ticket_sales_start_time :datetime +# tickets_require_approval :boolean default(TRUE), not null +# created_at :datetime not null +# updated_at :datetime not null +# # Core object containing all information related to an actual event being held. class Event < ApplicationRecord has_many :event_admins diff --git a/app/models/event_admin.rb b/app/models/event_admin.rb index bfd635ef..408a2c09 100644 --- a/app/models/event_admin.rb +++ b/app/models/event_admin.rb @@ -1,5 +1,22 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: event_admins +# +# id :bigint not null, primary key +# created_at :datetime not null +# updated_at :datetime not null +# event_id :bigint +# user_id :bigint +# +# Indexes +# +# index_event_admins_on_event_id (event_id) +# index_event_admins_on_event_id_and_user_id (event_id,user_id) UNIQUE +# index_event_admins_on_user_id (user_id) +# index_event_admins_on_user_id_only (user_id) +# class EventAdmin < ApplicationRecord attr_accessible :event_id, :user_id diff --git a/app/models/job.rb b/app/models/job.rb index cddd2830..26f3557f 100644 --- a/app/models/job.rb +++ b/app/models/job.rb @@ -1,5 +1,20 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: jobs +# +# id :bigint not null, primary key +# description :string(512) not null +# name :string(100) not null +# created_at :datetime not null +# updated_at :datetime not null +# event_id :bigint not null +# +# Indexes +# +# index_jobs_on_event_id (event_id) +# class Job < ApplicationRecord belongs_to :event has_many :time_slots, dependent: :destroy diff --git a/app/models/payment.rb b/app/models/payment.rb index 83d85d2b..61b95272 100644 --- a/app/models/payment.rb +++ b/app/models/payment.rb @@ -1,5 +1,17 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: payments +# +# id :bigint not null, primary key +# explanation :string +# status :string(1) default("P"), not null +# created_at :datetime not null +# updated_at :datetime not null +# stripe_charge_id :string(255) +# ticket_request_id :integer not null +# class Payment < ApplicationRecord include PaymentsHelper diff --git a/app/models/price_rule.rb b/app/models/price_rule.rb index c1b011d3..f5ba5445 100644 --- a/app/models/price_rule.rb +++ b/app/models/price_rule.rb @@ -1,5 +1,21 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: price_rules +# +# id :bigint not null, primary key +# price :decimal(8, 2) +# trigger_value :integer +# type :string +# created_at :datetime not null +# updated_at :datetime not null +# event_id :bigint +# +# Indexes +# +# index_price_rules_on_event_id (event_id) +# class PriceRule < ApplicationRecord belongs_to :event diff --git a/app/models/price_rule/kids_equal_to.rb b/app/models/price_rule/kids_equal_to.rb index 3f90457d..93521fbb 100644 --- a/app/models/price_rule/kids_equal_to.rb +++ b/app/models/price_rule/kids_equal_to.rb @@ -1,5 +1,21 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: price_rules +# +# id :bigint not null, primary key +# price :decimal(8, 2) +# trigger_value :integer +# type :string +# created_at :datetime not null +# updated_at :datetime not null +# event_id :bigint +# +# Indexes +# +# index_price_rules_on_event_id (event_id) +# # Applied when a ticket request has indicated that they are bringing a specific # number of kids. class PriceRule diff --git a/app/models/shift.rb b/app/models/shift.rb index 149633d4..867e45e4 100644 --- a/app/models/shift.rb +++ b/app/models/shift.rb @@ -1,5 +1,21 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: shifts +# +# id :bigint not null, primary key +# name :string(70) +# created_at :datetime not null +# updated_at :datetime not null +# time_slot_id :bigint not null +# user_id :bigint not null +# +# Indexes +# +# index_shifts_on_time_slot_id (time_slot_id) +# index_shifts_on_user_id (user_id) +# class Shift < ApplicationRecord belongs_to :time_slot belongs_to :user diff --git a/app/models/site_admin.rb b/app/models/site_admin.rb index e4439035..45fe38e3 100644 --- a/app/models/site_admin.rb +++ b/app/models/site_admin.rb @@ -1,5 +1,14 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: site_admins +# +# id :bigint not null, primary key +# created_at :datetime not null +# updated_at :datetime not null +# user_id :integer not null +# class SiteAdmin < ApplicationRecord attr_accessible :user_id diff --git a/app/models/ticket_request.rb b/app/models/ticket_request.rb index 2b4d6c13..ba3437a2 100644 --- a/app/models/ticket_request.rb +++ b/app/models/ticket_request.rb @@ -1,5 +1,39 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: ticket_requests +# +# id :bigint not null, primary key +# address_line1 :string(200) +# address_line2 :string(200) +# admin_notes :string(512) +# adults :integer default(1), not null +# agrees_to_terms :boolean +# cabins :integer default(0), not null +# car_camping :boolean +# car_camping_explanation :string(200) +# city :string(50) +# country_code :string(4) +# donation :decimal(8, 2) default(0.0) +# early_arrival_passes :integer default(0), not null +# guests :text +# kids :integer default(0), not null +# late_departure_passes :integer default(0), not null +# needs_assistance :boolean default(FALSE), not null +# notes :string(500) +# previous_contribution :string(250) +# role :string default("volunteer"), not null +# role_explanation :string(200) +# special_price :decimal(8, 2) +# state :string(50) +# status :string(1) not null +# zip_code :string(32) +# created_at :datetime not null +# updated_at :datetime not null +# event_id :integer not null +# user_id :integer not null +# # Individual request for one or more tickets. # This is intended to capture as much information as possible about the ticket, # as well as the state of the request. diff --git a/app/models/time_slot.rb b/app/models/time_slot.rb index b919d022..a1b22068 100644 --- a/app/models/time_slot.rb +++ b/app/models/time_slot.rb @@ -1,5 +1,21 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: time_slots +# +# id :bigint not null, primary key +# end_time :datetime not null +# slots :integer not null +# start_time :datetime not null +# created_at :datetime not null +# updated_at :datetime not null +# job_id :bigint not null +# +# Indexes +# +# index_time_slots_on_job_id (job_id) +# class TimeSlot < ApplicationRecord belongs_to :job has_many :shifts, dependent: :destroy diff --git a/app/models/user.rb b/app/models/user.rb index c5c6951a..6e08938e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,5 +1,39 @@ # frozen_string_literal: true +# == Schema Information +# +# Table name: users +# +# id :bigint not null, primary key +# authentication_token :string(64) +# confirmation_sent_at :datetime +# confirmation_token :string +# confirmed_at :datetime +# current_sign_in_at :datetime +# current_sign_in_ip :string +# email :string not null +# encrypted_password :string not null +# failed_attempts :integer default(0) +# last_sign_in_at :datetime +# last_sign_in_ip :string +# locked_at :datetime +# name :string(70) not null +# remember_created_at :datetime +# reset_password_sent_at :datetime +# reset_password_token :string +# sign_in_count :integer default(0) +# unconfirmed_email :string +# unlock_token :string +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_users_on_confirmation_token (confirmation_token) UNIQUE +# index_users_on_email (email) UNIQUE +# index_users_on_reset_password_token (reset_password_token) UNIQUE +# index_users_on_unlock_token (unlock_token) UNIQUE +# require 'securerandom' # A real-life living breathing human. diff --git a/bin/boot-up b/bin/boot-up index f4df534f..2ead1114 100755 --- a/bin/boot-up +++ b/bin/boot-up @@ -16,226 +16,9 @@ export BASHMATIC_HOME="${BASHMATIC_HOME:-"${HOME}/.bashmatic"}" source "${BASHMATIC_HOME}/init.sh" >/dev/null 2>&1 output.constrain-screen-width 100 -export default_bundler_version="1.17.3" -export python_version="2.7.18" -export python_major_version="$(echo "${python_version}" | cut -d '.' -f 1)" - -export ruby_version="$(cat .ruby-version | tr -d '\n')" - -function ensure-postgresql() { - [[ -n "$( ps -ef | grep "[p]ostg" )" ]] && pg_isready >/dev/null && { - success "PostgreSQL is already running." - return 0 - } - - (command -v brew >/dev/null) && { - run.set-all continue-on-error - - h1 "Installing and starting PostgreSQL using Homebrew..." - - run "brew install postgresql@14" - run "brew link postgresql@14" - run "brew services start postgresql@14" - - sleep 3 - - pg_isready && success "Database is UP." - pg_isready || { - error "Unable to start PostgreSQL. Please install it manually" \ - "from: https://www.postgresql.org/download/" - open "https://www.postgresql.org/download/" - exit 1 - } - - run "createuser -s postgres -U ${USER}" - run "createuser -s root -U ${USER}" - } -} - -function ensure-stripe-mock() { - run.set-all continue-on-error - run "brew install stripe/stripe-mock/stripe-mock" - run "brew upgrade stripe-mock" - run "brew services start stripe-mock" -} - -function ensure-python() { - local local_python_version - local -a version_parts - run.set-all continue-on-error - command -v python >/dev/null && { - version_parts=( $(python -c 'import sys; print(sys.version_info[0])' | tr '.' ' ') ) - } - - local_python_version="${version_parts[0]}" - - if [[ ${local_python_version} -eq ${python_major_version} ]]; then - success "Python ${python_version} is already installed." - return 0 - else - h1 "Installing Python ${python_version} using pyenv..." - command -v pyenv >/dev/null || run "brew install pyenv" - eval "$(pyenv init -)" - run "pyenv install -s ${python_version}" - run "pyenv global ${python_version}" - fi -} - -function ensure-ruby-via-ruby-install() { - run "brew install ruby-install --formulae" - export CFLAGS="-Wno-error=implicit-function-declaration" - run "mkdir -p ${HOME}/.rbenv/versions" - run "ruby-install --install-dir ${HOME}/.rbenv/versions ${ruby_version} -- --enable-shared" -} - - -function ensure-ruby-via-rbenv() { - export CFLAGS="-Wno-error=implicit-function-declaration" - run "rbenv install -s ${ruby_version}" -} - -function ensure-ruby() { - h2 "Ensuring Ruby & Gems are Installed..." - if command -v rbenv >/dev/null; then - run "brew upgrade rbenv ruby-build" - else - run "brew install rbenv ruby-build" - fi - - eval "$(rbenv init -)" - - local bundler_version=$(gem.gemfile.bundler-version) - test -z "${bundler_version}" && bundler_version="${default_bundler_version}" - - if ${use_ruby_install}; then - ensure-ruby-via-ruby-install - else - ensure-ruby-via-rbenv - fi -} - - -function ensure-bundle() { - h2 "Installing Dependent Gems..." - run "gem install bundler --version ${bundler_version} -N" - - run "bundle config set --local path 'vendor/bundle'" - run "bundle config pg --with-pg-config=$(command -v pg_config)" - run "bundle config libv8 --with-system-v8" - run "bundle config therubyracer --with-v8-dir=$(brew --prefix)/opt/v8@3.15" - run "bundle check || bundle install -j 12 || bundler update --bundler && bundle install" - - h2 "Creating Databases & Running Tests" - run "bundle exec rake db:create" - run "bundle exec rake db:migrate db:seed" - run "bundle exec rake db:test:prepare" - run.set-next show-output-on - run "bundle exec rspec" -} - -function puma-pids() { - # shellcheck disable=SC2009 - ps -ef | grep "[p]uma" | cut -d ' ' -f 4 -} - -function puma-running() { - netstat -an | grep LISTEN | grep -q 3000 -} - -# shellcheck disable=SC2207 -function kill-puma() { - local counter=0 - while puma-running; do - counter=$((counter + 1)) - if [[ ${counter} -gt 10 ]]; then - .err "Too many attempts to kill puma, please whack it manually." - exit 1 - fi - local -a pids=($(puma-pids)) - if [[ ${#pids[@]} -gt 0 ]]; then - set +e - kill -TERM "${pids[@]}" - sleep 5 - pids=($(puma-pids)) - [[ ${#pids[@]} -gt 0 ]] && { - kill -KILL "${pids[@]}" - sleep 2 - } - fi - done -} - -function .err() { - printf -- "\n${bakred} 🖕 ${clr}${txtred}${clr} ${txtred}${clr}${bakred} %s ${clr}${txtred}${clr}\n" "$*" -} - -function .inf() { - printf -- "${bakgrn} ️✔︎ ${clr}${txtgrn}${clr} ${txtylw}%s....${clr}\n" "$*" -} - -function setup() { - export MAKE_ENV=".make.env" - cat <>"${MAKE_ENV}" -export RUBYOPT="-W0" -export MALLOC_ARENA_MAX=2 -EOF - - eval "$(cat "${MAKE_ENV}")" - - local v8pkg="$(brew list | grep v8)" - [[ -z "${v8pkg}" || ${v8pkg} == "v8" ]] && brew uninstall v8 >/dev/null 2>&1 - - run "brew list | grep -q v8@3.15 || brew install v8@3.15 2>/dev/null" - - ensure-postgresql || exit 1 - ensure-ruby || exit 4 - ensure-python || exit 3 - ensure-bundle || exit 5 - ensure-stripe-mock || exit 6 - return 0 -} - -function main() { - setup - - if [[ -z "${RAILS_ENV}" ]]; then - .err "RAILS_ENV must be set prior to calling this script." - echo - .inf "To boot the application via the 'make' target, run one of the: " - echo - .inf ' make development boot' - .inf ' make staging boot' - .inf ' make production boot' - echo - exit 1 - else - .inf "Starting with RAILS_ENV=${RAILS_ENV}" - fi - - puma-running && { - .err "It appears that port 3000 is taken by something..." - exit 1 - } - .inf "Starting Puma on port 3000" - (sleep 8 && open "http://127.0.0.1:3000") & - run.set-next show-output-on - run "bundle exec puma -C config/puma.rb" - rm -f "${MAKE_ENV}" -} - -export use_ruby_install=false - -[[ "$1" == "-h" || "$1" == "--help" ]] && { - echo "Usage: $0 [--source] [--ruby-install]" - echo - echo " --source - load the source code of this script but don't run main()" - echo " --ruby-install - Use ruby-install to build ruby instead of rbenv" - echo - exit 0 -} - -[[ "$*" =~ "--ruby-install" ]] && use_ruby_install=true - -[[ "$1" == "--source" ]] || main "$@" - - +run "brew bundle --no-upgrade --no-lock" +run "rbenv install -s $(cat .ruby-version)" +run "mkdir -p .bundle" +run "cp development/config/config.Darwin.arm64 .bundle/config" +run "bundle install -j 12" +run "bin/rails db:migrate" diff --git a/config/environments/development.rb b/config/environments/development.rb index fd940bf3..debf91f5 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -13,7 +13,7 @@ config.autoloader = :zeitwerk - # config.eager_load = false + config.eager_load = false # Show full error reports and disable caching config.consider_all_requests_local = true diff --git a/config/environments/test.rb b/config/environments/test.rb index ed58c357..2e15c540 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -9,7 +9,7 @@ # and recreated between test runs. Don't rely on the data there! config.cache_classes = false - config.eager_load = true + config.eager_load = false # Prepend all log lines with the following tags config.log_tags = [->(_req) { DateTime.now }, :uuid] diff --git a/config/initializers/auto_annotate_models.rb b/config/initializers/auto_annotate_models.rb new file mode 100644 index 00000000..dc98c888 --- /dev/null +++ b/config/initializers/auto_annotate_models.rb @@ -0,0 +1,47 @@ +Annotate.set_defaults( + 'active_admin' => 'false', + 'additional_file_patterns' => [], + 'routes' => 'false', + 'models' => 'true', + 'position_in_routes' => 'before', + 'position_in_class' => 'before', + 'position_in_test' => 'before', + 'position_in_fixture' => 'before', + 'position_in_factory' => 'before', + 'position_in_serializer' => 'before', + 'show_foreign_keys' => 'true', + 'show_complete_foreign_keys' => 'false', + 'show_indexes' => 'true', + 'simple_indexes' => 'false', + 'model_dir' => 'app/models', + 'root_dir' => '', + 'include_version' => 'false', + 'require' => '', + 'exclude_tests' => 'false', + 'exclude_fixtures' => 'false', + 'exclude_factories' => 'false', + 'exclude_serializers' => 'false', + 'exclude_scaffolds' => 'true', + 'exclude_controllers' => 'true', + 'exclude_helpers' => 'true', + 'exclude_sti_subclasses' => 'false', + 'ignore_model_sub_dir' => 'false', + 'ignore_columns' => nil, + 'ignore_routes' => nil, + 'ignore_unknown_models' => 'false', + 'hide_limit_column_types' => 'integer,bigint,boolean', + 'hide_default_column_types' => 'json,jsonb,hstore', + 'skip_on_db_migrate' => 'false', + 'format_bare' => 'true', + 'format_rdoc' => 'false', + 'format_yard' => 'false', + 'format_markdown' => 'false', + 'sort' => 'false', + 'force' => 'false', + 'frozen' => 'false', + 'classified_sort' => 'true', + 'trace' => 'false', + 'wrapper_open' => nil, + 'wrapper_close' => nil, + 'with_comment' => 'true' +) diff --git a/development/config/config.Darwin.arm64 b/development/config/config.Darwin.arm64 new file mode 100644 index 00000000..6bd584b8 --- /dev/null +++ b/development/config/config.Darwin.arm64 @@ -0,0 +1,9 @@ +--- +BUNDLE_JOBS: "12" +BUNDLE_BUILD__PG: "--with-pg-config=/opt/homebrew/opt/postgresql@15/bin/pg_config" +BUNDLE_BUILD__LIBV8: "--with-system-v8" +BUNDLE_BUILD__FFI: "--with-v8-dir=/opt/homebrew/opt/v8" +BUNDLE_BUILD__THERUBYRACER: "--with-v8-dir=/opt/homebrew/opt/v8" +BUNDLE_ENTERPRISE__CONTRIBSYS__COM: "c07fa39b:1c6f45bc" +BUNDLE_BUILD: "--with-cflags=-Wno-error=implicit-function-declaration --with-cppflags=-Wno-warning=compound-token-split-by-macro" +BUNDLE_GEMFILE: "Gemfile" diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake new file mode 100644 index 00000000..e96283ea --- /dev/null +++ b/lib/tasks/auto_annotate_models.rake @@ -0,0 +1,59 @@ +# NOTE: only doing this in development as some production environments (Heroku) +# NOTE: are sensitive to local FS writes, and besides -- it's just not proper +# NOTE: to have a dev-mode tool do its thing in production. +if Rails.env.development? + require 'annotate' + task :set_annotation_options do + # You can override any of these by setting an environment variable of the + # same name. + Annotate.set_defaults( + 'active_admin' => 'false', + 'additional_file_patterns' => [], + 'routes' => 'false', + 'models' => 'true', + 'position_in_routes' => 'before', + 'position_in_class' => 'before', + 'position_in_test' => 'before', + 'position_in_fixture' => 'before', + 'position_in_factory' => 'before', + 'position_in_serializer' => 'before', + 'show_foreign_keys' => 'true', + 'show_complete_foreign_keys' => 'false', + 'show_indexes' => 'true', + 'simple_indexes' => 'false', + 'model_dir' => 'app/models', + 'root_dir' => '', + 'include_version' => 'false', + 'require' => '', + 'exclude_tests' => 'false', + 'exclude_fixtures' => 'false', + 'exclude_factories' => 'false', + 'exclude_serializers' => 'false', + 'exclude_scaffolds' => 'true', + 'exclude_controllers' => 'true', + 'exclude_helpers' => 'true', + 'exclude_sti_subclasses' => 'false', + 'ignore_model_sub_dir' => 'false', + 'ignore_columns' => nil, + 'ignore_routes' => nil, + 'ignore_unknown_models' => 'false', + 'hide_limit_column_types' => 'integer,bigint,boolean', + 'hide_default_column_types' => 'json,jsonb,hstore', + 'skip_on_db_migrate' => 'false', + 'format_bare' => 'true', + 'format_rdoc' => 'false', + 'format_yard' => 'false', + 'format_markdown' => 'false', + 'sort' => 'false', + 'force' => 'false', + 'frozen' => 'false', + 'classified_sort' => 'true', + 'trace' => 'false', + 'wrapper_open' => nil, + 'wrapper_close' => nil, + 'with_comment' => 'true' + ) + end + + Annotate.load_tasks +end diff --git a/spec/controllers/emails_controller_spec.rb b/spec/controllers/emails_controller_spec.rb index 7ed216f5..0675d5dd 100644 --- a/spec/controllers/emails_controller_spec.rb +++ b/spec/controllers/emails_controller_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'spec_helper' - describe EmailsController do describe 'GET #index' do let(:email) { nil } diff --git a/spec/controllers/events_controller_spec.rb b/spec/controllers/events_controller_spec.rb index 054ec99d..54b35aad 100644 --- a/spec/controllers/events_controller_spec.rb +++ b/spec/controllers/events_controller_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'spec_helper' - describe EventsController do let(:event) { Event.make! } let(:viewer) { nil } diff --git a/spec/controllers/ticket_requests_controller_spec.rb b/spec/controllers/ticket_requests_controller_spec.rb index c888c552..04c37c23 100644 --- a/spec/controllers/ticket_requests_controller_spec.rb +++ b/spec/controllers/ticket_requests_controller_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'spec_helper' - describe TicketRequestsController do let(:viewer) { nil } diff --git a/spec/factories/event.rb b/spec/factories/event.rb index 9dbeb40c..070bb842 100644 --- a/spec/factories/event.rb +++ b/spec/factories/event.rb @@ -6,7 +6,7 @@ start_time { 1.year.from_now } end_time { 1.year.from_now + 1.day } - adult_ticket_price { Random.rand(0..100) } + adult_ticket_price { Random.rand(100) } kid_ticket_price { nil } cabin_price { nil } max_adult_tickets_per_request { Random.rand(1..4) } @@ -20,7 +20,7 @@ trait :cabins_available do cabin_price { Random.rand(100) } - max_cabins_per_request { Random.rand(1..1) } + max_cabins_per_request { Random.rand(1...1) } end end end diff --git a/spec/lib/fnf/csv_reader_spec.rb b/spec/lib/fnf/csv_reader_spec.rb index 4f7832b8..61076de1 100644 --- a/spec/lib/fnf/csv_reader_spec.rb +++ b/spec/lib/fnf/csv_reader_spec.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require 'spec_helper' require 'fnf/csv_reader' module FnF diff --git a/spec/lib/fnf/event_reporter_spec.rb b/spec/lib/fnf/event_reporter_spec.rb index 73efd744..1f7ec137 100644 --- a/spec/lib/fnf/event_reporter_spec.rb +++ b/spec/lib/fnf/event_reporter_spec.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require 'spec_helper' require 'fnf/csv_reader' module FnF diff --git a/spec/lib/fnf/events/events_spec.rb b/spec/lib/fnf/events/events_spec.rb index 660d0274..2b3dd2a1 100644 --- a/spec/lib/fnf/events/events_spec.rb +++ b/spec/lib/fnf/events/events_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'spec_helper' - class Worker @events = {} diff --git a/spec/lib/fnf/html_generator_spec.rb b/spec/lib/fnf/html_generator_spec.rb index 323d0e01..a2f436b1 100644 --- a/spec/lib/fnf/html_generator_spec.rb +++ b/spec/lib/fnf/html_generator_spec.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require 'spec_helper' require 'fnf/html_generator' module FnF diff --git a/spec/lib/fnf/music_submissions_spec.rb b/spec/lib/fnf/music_submissions_spec.rb index be93982e..db5e5d61 100644 --- a/spec/lib/fnf/music_submissions_spec.rb +++ b/spec/lib/fnf/music_submissions_spec.rb @@ -2,7 +2,6 @@ require 'rspec' require 'tempfile' -require 'spec_helper' RSpec.describe 'bin/music-submissions' do subject { File.read(result) } diff --git a/spec/mailers/payment_mailer_spec.rb b/spec/mailers/payment_mailer_spec.rb index 2715a7b5..a962853f 100644 --- a/spec/mailers/payment_mailer_spec.rb +++ b/spec/mailers/payment_mailer_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'spec_helper' - describe PaymentMailer do let(:user) { User.make! } let(:event) { Event.make! name: 'Test Event' } diff --git a/spec/mailers/ticket_request_mailer_spec.rb b/spec/mailers/ticket_request_mailer_spec.rb index ac6ce4d0..ba9b7139 100644 --- a/spec/mailers/ticket_request_mailer_spec.rb +++ b/spec/mailers/ticket_request_mailer_spec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'spec_helper' - describe TicketRequestMailer do let(:user) { User.make! } let(:event) { Event.make! name: 'Test Event' } diff --git a/spec/models/event_admin_spec.rb b/spec/models/event_admin_spec.rb index 9df7716b..606bf59e 100644 --- a/spec/models/event_admin_spec.rb +++ b/spec/models/event_admin_spec.rb @@ -1,7 +1,22 @@ # frozen_string_literal: true -require 'spec_helper' - +# == Schema Information +# +# Table name: event_admins +# +# id :bigint not null, primary key +# created_at :datetime not null +# updated_at :datetime not null +# event_id :bigint +# user_id :bigint +# +# Indexes +# +# index_event_admins_on_event_id (event_id) +# index_event_admins_on_event_id_and_user_id (event_id,user_id) UNIQUE +# index_event_admins_on_user_id (user_id) +# index_event_admins_on_user_id_only (user_id) +# describe EventAdmin do describe 'validations' do describe '#user' do diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index 0bbb33b4..61383f39 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -1,7 +1,33 @@ # frozen_string_literal: true -require 'spec_helper' - +# == Schema Information +# +# Table name: events +# +# id :bigint not null, primary key +# adult_ticket_price :decimal(8, 2) +# allow_donations :boolean default(FALSE), not null +# allow_financial_assistance :boolean default(FALSE), not null +# cabin_price :decimal(8, 2) +# early_arrival_price :decimal(8, 2) default(0.0) +# end_time :datetime +# kid_ticket_price :decimal(8, 2) +# late_departure_price :decimal(8, 2) default(0.0) +# max_adult_tickets_per_request :integer +# max_cabin_requests :integer +# max_cabins_per_request :integer +# max_kid_tickets_per_request :integer +# name :string +# photo :string +# require_mailing_address :boolean default(FALSE), not null +# start_time :datetime +# ticket_requests_end_time :datetime +# ticket_sales_end_time :datetime +# ticket_sales_start_time :datetime +# tickets_require_approval :boolean default(TRUE), not null +# created_at :datetime not null +# updated_at :datetime not null +# describe Event do it 'has a valid factory' do described_class.make.should be_valid diff --git a/spec/models/site_admin_spec.rb b/spec/models/site_admin_spec.rb index 1a6f95eb..20c2aa20 100644 --- a/spec/models/site_admin_spec.rb +++ b/spec/models/site_admin_spec.rb @@ -1,7 +1,14 @@ # frozen_string_literal: true -require 'spec_helper' - +# == Schema Information +# +# Table name: site_admins +# +# id :bigint not null, primary key +# created_at :datetime not null +# updated_at :datetime not null +# user_id :integer not null +# describe SiteAdmin do describe 'validations' do describe '#user' do diff --git a/spec/models/ticket_request_spec.rb b/spec/models/ticket_request_spec.rb index 4adc305b..3bcb8073 100644 --- a/spec/models/ticket_request_spec.rb +++ b/spec/models/ticket_request_spec.rb @@ -1,7 +1,39 @@ # frozen_string_literal: true -require 'spec_helper' - +# == Schema Information +# +# Table name: ticket_requests +# +# id :bigint not null, primary key +# address_line1 :string(200) +# address_line2 :string(200) +# admin_notes :string(512) +# adults :integer default(1), not null +# agrees_to_terms :boolean +# cabins :integer default(0), not null +# car_camping :boolean +# car_camping_explanation :string(200) +# city :string(50) +# country_code :string(4) +# donation :decimal(8, 2) default(0.0) +# early_arrival_passes :integer default(0), not null +# guests :text +# kids :integer default(0), not null +# late_departure_passes :integer default(0), not null +# needs_assistance :boolean default(FALSE), not null +# notes :string(500) +# previous_contribution :string(250) +# role :string default("volunteer"), not null +# role_explanation :string(200) +# special_price :decimal(8, 2) +# state :string(50) +# status :string(1) not null +# zip_code :string(32) +# created_at :datetime not null +# updated_at :datetime not null +# event_id :integer not null +# user_id :integer not null +# describe TicketRequest do describe 'validations' do subject { ticket_request } diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 7cc2ccf4..0d4887fe 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,7 +1,39 @@ # frozen_string_literal: true -require 'spec_helper' - +# == Schema Information +# +# Table name: users +# +# id :bigint not null, primary key +# authentication_token :string(64) +# confirmation_sent_at :datetime +# confirmation_token :string +# confirmed_at :datetime +# current_sign_in_at :datetime +# current_sign_in_ip :string +# email :string not null +# encrypted_password :string not null +# failed_attempts :integer default(0) +# last_sign_in_at :datetime +# last_sign_in_ip :string +# locked_at :datetime +# name :string(70) not null +# remember_created_at :datetime +# reset_password_sent_at :datetime +# reset_password_token :string +# sign_in_count :integer default(0) +# unconfirmed_email :string +# unlock_token :string +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_users_on_confirmation_token (confirmation_token) UNIQUE +# index_users_on_email (email) UNIQUE +# index_users_on_reset_password_token (reset_password_token) UNIQUE +# index_users_on_unlock_token (unlock_token) UNIQUE +# describe User do it 'has a valid factory' do described_class.make.should be_valid diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a82ad594..d32a41b2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,7 +3,6 @@ ENV['RAILS_ENV'] = 'test' require 'simplecov' -require 'codecov' if ENV['CODECOV_TOKEN'] SimpleCov.start 'rails' require File.expand_path('../config/environment', __dir__)