diff --git a/.rubocop.yml b/.rubocop.yml index f25f72e2..b5c352f6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,7 +12,9 @@ AllCops: - bin/* - db/schema.rb - node_modules/**/* + - spec/dummy/config/**/* - spec/dummy/db/schema.rb + - spec/dummy/db/migrate/* - spec/dummy/bin/* - templates/* - config/initializers/simple_form_bootstrap.rb @@ -92,3 +94,8 @@ Style/RescueModifier: Style/SafeNavigationChainLength: Max: 3 + +Style/SymbolArray: + Exclude: + - 'Gemfile' + - 'lcms-engine.gemspec' diff --git a/CHANGELOG.md b/CHANGELOG.md index 673f1c41..a2288826 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Bump Rails to 7.2.2.1 - Bump ruby to 3.3.9 - Bump ruby to 3.3.8 - Bump ruby to 3.2.9 diff --git a/Gemfile b/Gemfile index 2aa8b553..448d0838 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gemspec # your gem to rubygems.org. # To use a debugger -# gem 'byebug', group: [:development, :test] +gem 'debug', '>= 1.0.0', group: [:development, :test] gem 'wicked_pdf', github: 'learningtapestry/wicked_pdf', branch: 'puppeteer-support', diff --git a/Gemfile.lock b/Gemfile.lock index 875a7f78..e56ac7f1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,7 +13,7 @@ PATH lcms-engine (0.5.4) active_model_serializers (~> 0.10.10) activejob-retry (~> 0.6.3) - acts-as-taggable-on (~> 9.0) + acts-as-taggable-on (~> 12.0) acts_as_list (~> 1.0) airbrake (~> 13.0) autoprefixer-rails (~> 9.7) @@ -25,7 +25,7 @@ PATH combine_pdf (~> 1.0) concurrent-ruby (= 1.3.4) cssbundling-rails (~> 1.1) - devise (~> 4.7, >= 4.7.1) + devise (~> 4.9) elasticsearch-dsl (~> 0.1.9) elasticsearch-model (~> 7.0) elasticsearch-persistence (~> 7.0) @@ -44,9 +44,10 @@ PATH oj_mimic_json (~> 1.0, >= 1.0.1) pg (~> 1.2, >= 1.2.2) pg_search (~> 2.3, >= 2.3.2) - rack-mini-profiler (~> 2.3, >= 2.3.3) - rails (~> 7.0) - ransack (~> 2.3, >= 2.3.2) + rack (< 3.2) + rack-mini-profiler (~> 4.0.1) + rails (~> 7.2.2, >= 7.2.2.1) + ransack (~> 4.2.1) redis (~> 5.4.1) resque (~> 2.0, >= 2.0.0) resque-scheduler (~> 4.4, >= 4.4.0) @@ -57,7 +58,7 @@ PATH sanitize (~> 6.0.0) sass-rails (~> 6) simple_form (~> 5.2) - sprockets-rails (~> 3.4) + sprockets-rails (~> 3.5, >= 3.5.2) validate_url (~> 1.0, >= 1.0.8) virtus (~> 1.0, >= 1.0.5) will_paginate (~> 4.0) @@ -67,81 +68,88 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8.7) - actionpack (= 7.0.8.7) - activesupport (= 7.0.8.7) + actioncable (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8.7) - actionpack (= 7.0.8.7) - activejob (= 7.0.8.7) - activerecord (= 7.0.8.7) - activestorage (= 7.0.8.7) - activesupport (= 7.0.8.7) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.0.8.7) - actionpack (= 7.0.8.7) - actionview (= 7.0.8.7) - activejob (= 7.0.8.7) - activesupport (= 7.0.8.7) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.8.7) - actionview (= 7.0.8.7) - activesupport (= 7.0.8.7) - rack (~> 2.0, >= 2.2.4) + zeitwerk (~> 2.6) + actionmailbox (7.2.2.1) + actionpack (= 7.2.2.1) + activejob (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) + mail (>= 2.8.0) + actionmailer (7.2.2.1) + actionpack (= 7.2.2.1) + actionview (= 7.2.2.1) + activejob (= 7.2.2.1) + activesupport (= 7.2.2.1) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (7.2.2.1) + actionview (= 7.2.2.1) + activesupport (= 7.2.2.1) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4, < 3.2) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.8.7) - actionpack (= 7.0.8.7) - activerecord (= 7.0.8.7) - activestorage (= 7.0.8.7) - activesupport (= 7.0.8.7) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (7.2.2.1) + actionpack (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8.7) - activesupport (= 7.0.8.7) + actionview (7.2.2.1) + activesupport (= 7.2.2.1) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) active_model_serializers (0.10.15) actionpack (>= 4.1) activemodel (>= 4.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (7.0.8.7) - activesupport (= 7.0.8.7) + activejob (7.2.2.1) + activesupport (= 7.2.2.1) globalid (>= 0.3.6) activejob-retry (0.6.3) activejob (>= 4.2) activesupport (>= 4.2) - activemodel (7.0.8.7) - activesupport (= 7.0.8.7) - activerecord (7.0.8.7) - activemodel (= 7.0.8.7) - activesupport (= 7.0.8.7) - activestorage (7.0.8.7) - actionpack (= 7.0.8.7) - activejob (= 7.0.8.7) - activerecord (= 7.0.8.7) - activesupport (= 7.0.8.7) + activemodel (7.2.2.1) + activesupport (= 7.2.2.1) + activerecord (7.2.2.1) + activemodel (= 7.2.2.1) + activesupport (= 7.2.2.1) + timeout (>= 0.4.0) + activestorage (7.2.2.1) + actionpack (= 7.2.2.1) + activejob (= 7.2.2.1) + activerecord (= 7.2.2.1) + activesupport (= 7.2.2.1) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.8.7) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (7.2.2.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) - acts-as-taggable-on (9.0.1) - activerecord (>= 6.0, < 7.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + acts-as-taggable-on (12.0.0) + activerecord (>= 7.1, < 8.1) + zeitwerk (>= 2.4, < 3.0) acts_as_list (1.2.4) activerecord (>= 6.1) activesupport (>= 6.1) @@ -155,10 +163,10 @@ GEM autoprefixer-rails (9.8.6.5) execjs aws-eventstream (1.4.0) - aws-partitions (1.1140.0) + aws-partitions (1.1141.0) aws-record (2.14.0) aws-sdk-dynamodb (~> 1, >= 1.85.0) - aws-sdk-core (3.228.0) + aws-sdk-core (3.229.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) @@ -166,10 +174,10 @@ GEM bigdecimal jmespath (~> 1, >= 1.6.1) logger - aws-sdk-dynamodb (1.148.0) + aws-sdk-dynamodb (1.149.0) aws-sdk-core (~> 3, >= 3.228.0) aws-sigv4 (~> 1.5) - aws-sdk-kms (1.109.0) + aws-sdk-kms (1.110.0) aws-sdk-core (~> 3, >= 3.228.0) aws-sigv4 (~> 1.5) aws-sdk-rails (3.13.0) @@ -180,17 +188,17 @@ GEM aws-sessionstore-dynamodb (~> 2) concurrent-ruby (>= 1.3.1) railties (>= 5.2.0) - aws-sdk-s3 (1.195.0) + aws-sdk-s3 (1.196.0) aws-sdk-core (~> 3, >= 3.228.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sdk-ses (1.87.0) + aws-sdk-ses (1.88.0) aws-sdk-core (~> 3, >= 3.228.0) aws-sigv4 (~> 1.5) - aws-sdk-sesv2 (1.81.0) + aws-sdk-sesv2 (1.82.0) aws-sdk-core (~> 3, >= 3.228.0) aws-sigv4 (~> 1.5) - aws-sdk-sqs (1.99.0) + aws-sdk-sqs (1.100.0) aws-sdk-core (~> 3, >= 3.228.0) aws-sigv4 (~> 1.5) aws-sessionstore-dynamodb (2.2.0) @@ -205,9 +213,10 @@ GEM thread_safe (~> 0.3, >= 0.3.1) base64 (0.2.0) bcrypt (3.1.20) + benchmark (0.4.1) bigdecimal (3.2.2) builder (3.3.0) - bullet (7.2.0) + bullet (8.0.8) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) capybara (3.40.0) @@ -246,11 +255,14 @@ GEM cssbundling-rails (1.4.3) railties (>= 6.0.0) csv (3.3.5) - database_cleaner (1.99.0) - database_cleaner-active_record (1.99.0) - activerecord - database_cleaner (~> 1.99.0) + database_cleaner-active_record (2.2.2) + activerecord (>= 5.a) + database_cleaner-core (~> 2.0) + database_cleaner-core (2.0.1) date (3.4.1) + debug (1.9.2) + irb (~> 1.10) + reline (>= 0.3.8) declarative (0.0.20) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) @@ -267,6 +279,7 @@ GEM dotenv-rails (2.8.1) dotenv (= 2.8.1) railties (>= 3.2) + drb (2.2.3) elasticsearch (7.17.11) elasticsearch-api (= 7.17.11) elasticsearch-transport (= 7.17.11) @@ -300,8 +313,8 @@ GEM excon (1.2.8) logger execjs (2.10.0) - factory_bot (5.2.0) - activesupport (>= 4.2.0) + factory_bot (6.5.4) + activesupport (>= 6.1.0) faker (2.23.0) i18n (>= 1.8.11, < 2) faraday (2.13.4) @@ -379,6 +392,11 @@ GEM mini_magick (>= 4.9.5, < 6) ruby-vips (>= 2.0.17, < 3) iniparse (1.5.0) + io-console (0.8.1) + irb (1.15.2) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) jbuilder (2.13.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) @@ -416,7 +434,6 @@ GEM net-smtp marcel (1.0.4) matrix (0.4.3) - method_source (1.1.0) mime-types (3.7.0) logger mime-types-data (~> 3.2025, >= 3.2025.0507) @@ -467,12 +484,15 @@ GEM parser (3.3.9.0) ast (~> 2.4.1) racc - pg (1.6.0-aarch64-linux) - pg (1.6.0-arm64-darwin) - pg (1.6.0-x86_64-linux) + pg (1.6.1-aarch64-linux) + pg (1.6.1-arm64-darwin) + pg (1.6.1-x86_64-linux) pg_search (2.3.7) activerecord (>= 6.1) activesupport (>= 6.1) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) prism (1.4.0) psych (5.2.6) date @@ -480,30 +500,34 @@ GEM public_suffix (6.0.2) raabro (1.4.0) racc (1.8.1) - rack (2.2.17) - rack-mini-profiler (2.3.4) + rack (3.1.16) + rack-mini-profiler (4.0.1) rack (>= 1.2.0) - rack-protection (3.2.0) + rack-protection (4.1.1) + base64 (>= 0.1.0) + logger (>= 1.6.0) + rack (>= 3.0.0, < 4) + rack-session (2.1.1) base64 (>= 0.1.0) - rack (~> 2.2, >= 2.2.4) - rack-session (1.0.2) - rack (< 3) + rack (>= 3.0.0) rack-test (2.2.0) rack (>= 1.3) - rails (7.0.8.7) - actioncable (= 7.0.8.7) - actionmailbox (= 7.0.8.7) - actionmailer (= 7.0.8.7) - actionpack (= 7.0.8.7) - actiontext (= 7.0.8.7) - actionview (= 7.0.8.7) - activejob (= 7.0.8.7) - activemodel (= 7.0.8.7) - activerecord (= 7.0.8.7) - activestorage (= 7.0.8.7) - activesupport (= 7.0.8.7) + rackup (2.2.1) + rack (>= 3) + rails (7.2.2.1) + actioncable (= 7.2.2.1) + actionmailbox (= 7.2.2.1) + actionmailer (= 7.2.2.1) + actionpack (= 7.2.2.1) + actiontext (= 7.2.2.1) + actionview (= 7.2.2.1) + activejob (= 7.2.2.1) + activemodel (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) bundler (>= 1.15.0) - railties (= 7.0.8.7) + railties (= 7.2.2.1) rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest @@ -511,18 +535,19 @@ GEM rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) - railties (7.0.8.7) - actionpack (= 7.0.8.7) - activesupport (= 7.0.8.7) - method_source + railties (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) + irb (~> 1.13) + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.3.0) - ransack (2.6.0) - activerecord (>= 6.0.4) - activesupport (>= 6.0.4) + ransack (4.2.1) + activerecord (>= 6.1.5) + activesupport (>= 6.1.5) i18n rb-fsevent (0.11.2) rb-inotify (0.11.1) @@ -542,7 +567,9 @@ GEM connection_pool redis-namespace (1.11.0) redis (>= 4) - regexp_parser (2.10.0) + regexp_parser (2.11.0) + reline (0.6.2) + io-console (~> 0.5) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) @@ -575,14 +602,14 @@ GEM rspec-mocks (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (4.0.2) - actionpack (>= 4.2) - activesupport (>= 4.2) - railties (>= 4.2) - rspec-core (~> 3.10) - rspec-expectations (~> 3.10) - rspec-mocks (~> 3.10) - rspec-support (~> 3.10) + rspec-rails (7.1.1) + actionpack (>= 7.0) + activesupport (>= 7.0) + railties (>= 7.0) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) rspec-support (3.13.4) rubocop (1.79.1) json (~> 2.3) @@ -643,10 +670,12 @@ GEM json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - sinatra (3.2.0) + sinatra (4.1.1) + logger (>= 1.6.0) mustermann (~> 3.0) - rack (~> 2.2, >= 2.2.4) - rack-protection (= 3.2.0) + rack (>= 3.0.0, < 4) + rack-protection (= 4.1.1) + rack-session (>= 2.0.0, < 3) tilt (~> 2.0) spring (3.1.1) spring-commands-rspec (1.0.4) @@ -696,6 +725,7 @@ GEM unicode-emoji (4.0.4) uniform_notifier (1.17.0) uri (1.0.3) + useragent (0.16.11) validate_url (1.0.15) activemodel (>= 3.0.0) public_suffix @@ -731,19 +761,20 @@ PLATFORMS x86_64-linux DEPENDENCIES - bullet (~> 7.0) + bullet (~> 8.0) capybara (~> 3.31) - database_cleaner-active_record (~> 1.8) + database_cleaner-active_record (~> 2.2) + debug (>= 1.0.0) dotenv-rails (~> 2.2) email_spec (= 2.2.0) - factory_bot (~> 5) + factory_bot (~> 6.5) faker (~> 2.1) jsbundling-rails (~> 1.1) lcms-engine! mock_redis (~> 0.44) overcommit (~> 0.57) rbs_rails (~> 0.12) - rspec-rails (~> 4.0.2) + rspec-rails (~> 7.1) rubocop (~> 1.36) sdoc (~> 2) seedbank (~> 0.3) diff --git a/app/models/lcms/engine/document.rb b/app/models/lcms/engine/document.rb index be9d433a..61285951 100644 --- a/app/models/lcms/engine/document.rb +++ b/app/models/lcms/engine/document.rb @@ -17,7 +17,7 @@ class Document < ApplicationRecord before_save :clean_curriculum_metadata before_save :set_resource_from_metadata - serialize :toc, DocTemplate::Objects::TocMetadata + serialize :toc, coder: DocTemplate::Objects::TocMetadata scope :actives, -> { where(active: true) } scope :inactives, -> { where(active: false) } @@ -69,13 +69,13 @@ def activate! self.class.transaction do # de-active all other lessons for this resource self.class.where(resource_id:).where.not(id:).update_all(active: false) - # activate this lesson. PS: use a simple sql update, no callbacks + # activate this lesson. PS: use a simple SQL update, no callbacks update_columns(active: true) end end def assessment? - resource&.assessment? + resource&.assessment? || false end def ela? @@ -93,6 +93,8 @@ def gdoc_material_ids end def materials_anchors + return {} if toc.blank? + {}.tap do |materials_with_anchors| # steep:ignore toc.collect_children.each do |x| x.material_ids.each do |m| @@ -108,7 +110,7 @@ def math? end def ordered_material_ids - toc.ordered_material_ids + Array.wrap(toc&.ordered_material_ids) end def tmp_link(key) @@ -128,7 +130,7 @@ def clean_curriculum_metadata # downcase subjects metadata['subject'] = metadata['subject']&.downcase - # store only the lesson number + # to store only the lesson number # or alphanumeric - needed by OPR type, see https://github.com/learningtapestry/unbounded/issues/557 lesson = metadata['lesson'] metadata['lesson'] = lesson.match(/lesson (\w+)/i).try(:[], 1) || lesson if lesson.present? diff --git a/app/models/lcms/engine/document_part.rb b/app/models/lcms/engine/document_part.rb index a287d684..d3fb1224 100644 --- a/app/models/lcms/engine/document_part.rb +++ b/app/models/lcms/engine/document_part.rb @@ -5,7 +5,7 @@ module Engine class DocumentPart < ApplicationRecord belongs_to :renderer, polymorphic: true - enum context_type: { default: 0, gdoc: 1 } + enum :context_type, { default: 0, gdoc: 1 } default_scope { active } diff --git a/app/models/lcms/engine/reading_assignment_text.rb b/app/models/lcms/engine/reading_assignment_text.rb index 8232cdda..6624e0aa 100644 --- a/app/models/lcms/engine/reading_assignment_text.rb +++ b/app/models/lcms/engine/reading_assignment_text.rb @@ -7,7 +7,7 @@ class ReadingAssignmentText < ApplicationRecord has_many :resources, through: :resource_reading_assignments belongs_to :reading_assignment_author - alias_attribute :author, :reading_assignment_author + alias author reading_assignment_author end end end diff --git a/app/models/lcms/engine/resource.rb b/app/models/lcms/engine/resource.rb index abe16562..1b46f0c0 100644 --- a/app/models/lcms/engine/resource.rb +++ b/app/models/lcms/engine/resource.rb @@ -5,7 +5,7 @@ module Engine class Resource < ApplicationRecord include Filterable - enum resource_type: { + enum :resource_type, { resource: 1, podcast: 2, video: 3, @@ -39,7 +39,7 @@ class Resource < ApplicationRecord # Reading assignments. has_many :resource_reading_assignments, dependent: :destroy - alias_attribute :reading_assignments, :resource_reading_assignments + alias reading_assignments resource_reading_assignments has_many :reading_assignment_texts, through: :resource_reading_assignments # Related resources. diff --git a/app/models/lcms/engine/staff_member.rb b/app/models/lcms/engine/staff_member.rb index 594b2b78..082566ad 100644 --- a/app/models/lcms/engine/staff_member.rb +++ b/app/models/lcms/engine/staff_member.rb @@ -5,7 +5,7 @@ module Engine class StaffMember < ApplicationRecord validates :first_name, :last_name, presence: true validates :bio, length: { maximum: 4096 } - enum staff_type: { staff: 1, board: 2 } + enum :staff_type, { staff: 1, board: 2 } scope :order_by_name, -> { order(:last_name) } scope :order_by_name_with_precedence, -> { order(:order, :last_name) } diff --git a/app/models/lcms/engine/user.rb b/app/models/lcms/engine/user.rb index f33b9dc3..63d9700e 100644 --- a/app/models/lcms/engine/user.rb +++ b/app/models/lcms/engine/user.rb @@ -10,7 +10,7 @@ class User < ApplicationRecord devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, :trackable, :validatable - enum role: { admin: 1, user: 0 } + enum :role, { admin: 1, user: 0 } validates_presence_of :access_code, on: :create, unless: :admin? validates_presence_of :email, :role diff --git a/lcms-engine.gemspec b/lcms-engine.gemspec index 510463ea..19fa3c2c 100644 --- a/lcms-engine.gemspec +++ b/lcms-engine.gemspec @@ -31,7 +31,7 @@ Gem::Specification.new do |s| s.add_dependency 'activejob-retry', '~> 0.6.3' s.add_dependency 'active_model_serializers', '~> 0.10.10' s.add_dependency 'acts_as_list', '~> 1.0' - s.add_dependency 'acts-as-taggable-on', '~> 9.0' + s.add_dependency 'acts-as-taggable-on', '~> 12.0' s.add_dependency 'airbrake', '~> 13.0' s.add_dependency 'autoprefixer-rails', '~> 9.7' s.add_dependency 'aws-sdk-rails', '~> 3.1' @@ -45,7 +45,7 @@ Gem::Specification.new do |s| # there is a breaking change which prevents steep from working properly. s.add_dependency 'concurrent-ruby', '1.3.4' s.add_dependency 'cssbundling-rails', '~> 1.1' - s.add_dependency 'devise', '~> 4.7', '>= 4.7.1' + s.add_dependency 'devise', '~> 4.9' s.add_dependency 'elasticsearch-dsl', '~> 0.1.9' s.add_dependency 'elasticsearch-model', '~> 7.0' s.add_dependency 'elasticsearch-persistence', '~> 7.0' @@ -64,9 +64,11 @@ Gem::Specification.new do |s| s.add_dependency 'oj_mimic_json', '~> 1.0', '>= 1.0.1' s.add_dependency 'pg', '~> 1.2', '>= 1.2.2' s.add_dependency 'pg_search', '~> 2.3', '>= 2.3.2' - s.add_dependency 'rack-mini-profiler', '~> 2.3', '>= 2.3.3' - s.add_dependency 'rails', '~> 7.0' - s.add_dependency 'ransack', '~> 2.3', '>= 2.3.2' + # NOTE: actionpack 7.2.2.1 depends on rack >= 2.2.4, < 3.2 + s.add_dependency 'rack', '< 3.2' + s.add_dependency 'rack-mini-profiler', '~> 4.0.1' + s.add_dependency 'rails', '~> 7.2.2', '>= 7.2.2.1' + s.add_dependency 'ransack', '~> 4.2.1' s.add_dependency 'redis', '~> 5.4.1' s.add_dependency 'resque', '~> 2.0', '>= 2.0.0' s.add_dependency 'resque-scheduler', '~> 4.4', '>= 4.4.0' @@ -77,25 +79,26 @@ Gem::Specification.new do |s| s.add_dependency 'sanitize', '~> 6.0.0' s.add_dependency 'sass-rails', '~> 6' s.add_dependency 'simple_form', '~> 5.2' - s.add_dependency 'sprockets-rails', '~> 3.4' + s.add_dependency 'sprockets-rails', '~> 3.5', '>= 3.5.2' s.add_dependency 'validate_url', '~> 1.0', '>= 1.0.8' s.add_dependency 'virtus', '~> 1.0', '>= 1.0.5' s.add_dependency 'will_paginate', '~> 4.0' s.add_dependency 'will_paginate-bootstrap-style', '~> 0.3' s.add_dependency 'with_advisory_lock', '~> 4.6' - s.add_development_dependency 'bullet', '~> 7.0' + s.add_development_dependency 'bullet', '~> 8.0' s.add_development_dependency 'capybara', '~> 3.31' - s.add_development_dependency 'database_cleaner-active_record', '~> 1.8' + s.add_development_dependency 'database_cleaner-active_record', '~> 2.2' + # s.add_development_dependency 'debug', '>= 1.0.0' s.add_development_dependency 'dotenv-rails', '~> 2.2' s.add_development_dependency 'email_spec', '2.2.0' - s.add_development_dependency 'factory_bot', '~> 5' + s.add_development_dependency 'factory_bot', '~> 6.5' s.add_development_dependency 'faker', '~> 2.1' s.add_development_dependency 'jsbundling-rails', '~> 1.1' s.add_development_dependency 'mock_redis', '~> 0.44' s.add_development_dependency 'overcommit', '~> 0.57' s.add_development_dependency 'rbs_rails', '~> 0.12' - s.add_development_dependency 'rspec-rails', '~> 4.0.2' + s.add_development_dependency 'rspec-rails', '~> 7.1' s.add_development_dependency 'rubocop', '~> 1.36' s.add_development_dependency 'sdoc', '~> 2' s.add_development_dependency 'seedbank', '~> 0.3' diff --git a/lib/lcms/engine/engine.rb b/lib/lcms/engine/engine.rb index bdfb0717..c31a00a4 100644 --- a/lib/lcms/engine/engine.rb +++ b/lib/lcms/engine/engine.rb @@ -13,6 +13,7 @@ require 'virtus' require 'will_paginate' require 'will_paginate-bootstrap-style' +require 'sprockets/railtie' # UI and asset specific gems have to be required for host app to have access to its assets require 'ckeditor' diff --git a/sig/app/models/lcms/engine/reading_assignment_text.rbs b/sig/app/models/lcms/engine/reading_assignment_text.rbs index bd8d11db..13b76be5 100644 --- a/sig/app/models/lcms/engine/reading_assignment_text.rbs +++ b/sig/app/models/lcms/engine/reading_assignment_text.rbs @@ -185,6 +185,9 @@ module Lcms def clear_updated_at_change: () -> void end include GeneratedAttributeMethods + + alias author reading_assignment_author + def resource_reading_assignments: () -> Lcms::Engine::ResourceReadingAssignment::ActiveRecord_Associations_CollectionProxy def resource_reading_assignments=: (Lcms::Engine::ResourceReadingAssignment::ActiveRecord_Associations_CollectionProxy | Array[Lcms::Engine::ResourceReadingAssignment]) -> (Lcms::Engine::ResourceReadingAssignment::ActiveRecord_Associations_CollectionProxy | Array[Lcms::Engine::ResourceReadingAssignment]) def resource_reading_assignment_ids: () -> Array[Integer] diff --git a/sig/app/models/lcms/engine/resource.rbs b/sig/app/models/lcms/engine/resource.rbs index e0f897ab..3ad12384 100644 --- a/sig/app/models/lcms/engine/resource.rbs +++ b/sig/app/models/lcms/engine/resource.rbs @@ -1265,6 +1265,8 @@ module Lcms def parents: -> ActiveRecord_Relation def previous: -> ::Lcms::Engine::Resource? + alias reading_assignments resource_reading_assignments + def tree?: -> untyped def assessment?: -> untyped def media?: -> untyped diff --git a/spec/dummy/.ruby-version b/spec/dummy/.ruby-version index 21b159dc..3b47f2e4 100644 --- a/spec/dummy/.ruby-version +++ b/spec/dummy/.ruby-version @@ -1 +1 @@ -2.5.2 \ No newline at end of file +3.3.9 diff --git a/spec/dummy/bin/rubocop b/spec/dummy/bin/rubocop new file mode 100644 index 00000000..40330c0f --- /dev/null +++ b/spec/dummy/bin/rubocop @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +require "rubygems" +require "bundler/setup" + +# explicit rubocop config increases performance slightly while avoiding config confusion. +ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__)) + +load Gem.bin_path("rubocop", "rubocop") diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index 7aa07add..e62d38e2 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -14,10 +14,13 @@ Bundler.require(*Rails.groups) require 'lcms/engine' +# @see spec/dummy/config/environments/test.rb:38 +require_relative '../lib/custom_deprecation_handler' + module Dummy class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 6.1 + config.load_defaults 7.2 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers diff --git a/spec/dummy/config/cable.yml b/spec/dummy/config/cable.yml new file mode 100644 index 00000000..98367f89 --- /dev/null +++ b/spec/dummy/config/cable.yml @@ -0,0 +1,10 @@ +development: + adapter: async + +test: + adapter: test + +production: + adapter: redis + url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> + channel_prefix: dummy_production diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb index d2c22425..46105dc8 100644 --- a/spec/dummy/config/environments/test.rb +++ b/spec/dummy/config/environments/test.rb @@ -22,7 +22,7 @@ config.action_controller.perform_caching = false # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false + config.action_dispatch.show_exceptions = :none # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false @@ -35,7 +35,12 @@ # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + # NOTE: Use this to raise the deprecation warnings as exceptions + # with extra information. + # config.active_support.deprecation = CustomDeprecationHandler.new # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + + config.log_level = :debug end diff --git a/spec/dummy/config/initializers/permissions_policy.rb b/spec/dummy/config/initializers/permissions_policy.rb new file mode 100644 index 00000000..7db3b957 --- /dev/null +++ b/spec/dummy/config/initializers/permissions_policy.rb @@ -0,0 +1,13 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide HTTP permissions policy. For further +# information see: https://developers.google.com/web/updates/2018/06/feature-policy + +# Rails.application.config.permissions_policy do |policy| +# policy.camera :none +# policy.gyroscope :none +# policy.microphone :none +# policy.usb :none +# policy.fullscreen :self +# policy.payment :self, "https://secure.example.com" +# end diff --git a/spec/dummy/config/storage.yml b/spec/dummy/config/storage.yml new file mode 100644 index 00000000..4942ab66 --- /dev/null +++ b/spec/dummy/config/storage.yml @@ -0,0 +1,34 @@ +test: + service: Disk + root: <%= Rails.root.join("tmp/storage") %> + +local: + service: Disk + root: <%= Rails.root.join("storage") %> + +# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) +# amazon: +# service: S3 +# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> +# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> +# region: us-east-1 +# bucket: your_own_bucket-<%= Rails.env %> + +# Remember not to checkin your GCS keyfile to a repository +# google: +# service: GCS +# project: your_project +# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> +# bucket: your_own_bucket-<%= Rails.env %> + +# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) +# microsoft: +# service: AzureStorage +# storage_account_name: your_account_name +# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> +# container: your_container_name-<%= Rails.env %> + +# mirror: +# service: Mirror +# primary: local +# mirrors: [ amazon, google, microsoft ] diff --git a/spec/dummy/db/migrate/20250805100215_add_service_name_to_active_storage_blobs.active_storage.rb b/spec/dummy/db/migrate/20250805100215_add_service_name_to_active_storage_blobs.active_storage.rb new file mode 100644 index 00000000..a15c6ce8 --- /dev/null +++ b/spec/dummy/db/migrate/20250805100215_add_service_name_to_active_storage_blobs.active_storage.rb @@ -0,0 +1,22 @@ +# This migration comes from active_storage (originally 20190112182829) +class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] + def up + return unless table_exists?(:active_storage_blobs) + + unless column_exists?(:active_storage_blobs, :service_name) + add_column :active_storage_blobs, :service_name, :string + + if configured_service = ActiveStorage::Blob.service.name + ActiveStorage::Blob.unscoped.update_all(service_name: configured_service) + end + + change_column :active_storage_blobs, :service_name, :string, null: false + end + end + + def down + return unless table_exists?(:active_storage_blobs) + + remove_column :active_storage_blobs, :service_name + end +end diff --git a/spec/dummy/db/migrate/20250805100216_create_active_storage_variant_records.active_storage.rb b/spec/dummy/db/migrate/20250805100216_create_active_storage_variant_records.active_storage.rb new file mode 100644 index 00000000..94ac83af --- /dev/null +++ b/spec/dummy/db/migrate/20250805100216_create_active_storage_variant_records.active_storage.rb @@ -0,0 +1,27 @@ +# This migration comes from active_storage (originally 20191206030411) +class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] + def change + return unless table_exists?(:active_storage_blobs) + + # Use Active Record's configured type for primary key + create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t| + t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type + t.string :variation_digest, null: false + + t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + end + + private + def primary_key_type + config = Rails.configuration.generators + config.options[config.orm][:primary_key_type] || :primary_key + end + + def blobs_primary_key_type + pkey_name = connection.primary_key(:active_storage_blobs) + pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name } + pkey_column.bigint? ? :bigint : pkey_column.type + end +end diff --git a/spec/dummy/db/migrate/20250805100217_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb b/spec/dummy/db/migrate/20250805100217_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb new file mode 100644 index 00000000..93c8b85a --- /dev/null +++ b/spec/dummy/db/migrate/20250805100217_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb @@ -0,0 +1,8 @@ +# This migration comes from active_storage (originally 20211119233751) +class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0] + def change + return unless table_exists?(:active_storage_blobs) + + change_column_null(:active_storage_blobs, :checksum, true) + end +end diff --git a/spec/dummy/lib/custom_deprecation_handler.rb b/spec/dummy/lib/custom_deprecation_handler.rb new file mode 100644 index 00000000..1150262c --- /dev/null +++ b/spec/dummy/lib/custom_deprecation_handler.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# +# Handler class for custom deprecation notifications. +# Used to output deprecation call messages to STDERR. +# @see spec/dummy/config/environments/test.rb:38 +# +# rubocop:disable Style/StderrPuts +class CustomDeprecationHandler + def call(message, callstack, _deprecation_horizon, gem_name) + $stderr.puts "[#{Time.now}] #{message}" + $stderr.puts "Gem: #{gem_name}" + $stderr.puts callstack.join("\n") + $stderr.puts '---' + end +end +# rubocop:enable Style/StderrPuts diff --git a/spec/dummy/public/406-unsupported-browser.html b/spec/dummy/public/406-unsupported-browser.html new file mode 100644 index 00000000..7cf1e168 --- /dev/null +++ b/spec/dummy/public/406-unsupported-browser.html @@ -0,0 +1,66 @@ + + +
+Please upgrade your browser to continue.
+