diff --git a/Gemfile b/Gemfile index e02b0c2357..72503fe418 100644 --- a/Gemfile +++ b/Gemfile @@ -102,6 +102,10 @@ gem 'jbuilder', '~> 2.0' gem 'parallel' gem 'with_locking' +# Reindexing script +gem 'sequel' +gem 'httpx' + group :development do gem 'capistrano', '~>3.6' gem 'capistrano-passenger', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 28a12e1915..fc57de7f85 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -242,6 +242,7 @@ GEM babel-source (>= 4.0, < 6) execjs (~> 2.0) bcrypt (3.1.18) + bigdecimal (3.1.6) bindex (0.8.1) bixby (5.0.2) rubocop (= 1.28.2) @@ -460,10 +461,10 @@ GEM signet (>= 0.16, < 2.a) hashdiff (1.0.1) hashie (5.0.0) - highline (3.0.1) hooks (0.4.1) uber (~> 0.0.14) htmlentities (4.3.4) + http-2-next (1.0.3) http (5.1.1) addressable (~> 2.8) http-cookie (~> 1.0) @@ -475,6 +476,8 @@ GEM http-form_data (2.3.0) http_logger (0.7.0) httpclient (2.8.3) + httpx (1.2.2) + http-2-next (>= 1.0.3) hydra-access-controls (12.1.0) active-fedora (>= 10.0.0) activesupport (>= 5.2, < 7.1) @@ -542,8 +545,6 @@ GEM rdf-turtle rdf-vocab (>= 0.8) slop - license_header (0.0.4) - highline link_header (0.0.8) listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) @@ -848,6 +849,8 @@ GEM childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) semantic_range (3.0.0) + sequel (5.77.0) + bigdecimal shakapacker (7.0.2) activesupport (>= 5.2) rack-proxy (>= 0.6.1) @@ -1031,6 +1034,7 @@ DEPENDENCIES google-analytics-rails (= 1.1.0) hashdiff (>= 1.0) hooks + httpx hydra-head (~> 12.0) iconv (~> 1.0.6) iiif_manifest (>= 1.4.0) @@ -1040,7 +1044,6 @@ DEPENDENCIES jquery-rails jquery-ui-rails ldp (~> 1.1.0) - license_header listen lograge mail (> 2.8.0.1) @@ -1082,6 +1085,7 @@ DEPENDENCIES samvera-persona (~> 0.4, >= 0.4.1) sass (= 3.4.22) selenium-webdriver + sequel shakapacker shoulda-matchers sidekiq (~> 6.2) diff --git a/config/application.rb b/config/application.rb index ae20001c5c..032119dc35 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,7 +8,7 @@ Bundler.require(*Rails.groups) module Avalon - VERSION = '7.6.0' + VERSION = '7.7.0' class Application < Rails::Application require 'avalon/configuration' diff --git a/lib/tasks/avalon_migrations.rake b/lib/tasks/avalon_migrations.rake index c12b1a0633..ee0cc4a8a7 100644 --- a/lib/tasks/avalon_migrations.rake +++ b/lib/tasks/avalon_migrations.rake @@ -23,5 +23,33 @@ namespace :avalon do collection.save!(validate: false) end end + desc "Migrate legacy IndexedFile captions to ActiveStorage as part of supporting upload of multiple captions files" + task caption_files: :environment do + count = 0 + # Iterate through all caption IndexedFiles + IndexedFile.where("id: */captions").each do |caption_file| + # Retrieve parent master file + master_file_id = caption_file.id.split('/').first + master_file = MasterFile.find(master_file_id) rescue nil + next unless master_file && caption_file.present? + # Grab original file metadata from IndexedFile + filename = caption_file.original_name + content_type = caption_file.mime_type + # Create and populate new SupplementalFile record using original metadata + supplemental_file = SupplementalFile.new(label: filename, tags: ['caption'], language: 'eng') + supplemental_file.file.attach(io: ActiveFedora::FileIO.new(caption_file), filename: filename, content_type: content_type, identify: false) + supplemental_file.save + # Link new SupplementalFile to the MasterFile + master_file.supplemental_files += [supplemental_file] + # Delete legacy caption file + master_file.captions.content = '' + master_file.captions.original_name = '' + master_file.save + + count += 1 + end + + count > 0 ? puts("Successfully updated #{count} records") : puts("All files are already up to date. No records updated.") + end end end diff --git a/package.json b/package.json index b2512fa445..10efefdb09 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "@babel/plugin-proposal-object-rest-spread": "^7.20.7", "@babel/preset-react": "^7.0.0", "@babel/runtime": "7", - "@samvera/ramp": "https://github.com/samvera-labs/ramp.git", + "@samvera/ramp": "^3.0.0", "babel-plugin-macros": "^3.1.0", "babel-plugin-transform-react-remove-prop-types": "^0.4.24", "buffer": "^6.0.3", @@ -33,7 +33,6 @@ "url-search-params-polyfill": "^7.0.1", "util": "^0.12.5", "video.js": "7.21.4", - "videojs-hotkeys": "^0.2.27", "webpack": "5", "webpack-assets-manifest": "5", "webpack-merge": "^5.9.0" diff --git a/yarn.lock b/yarn.lock index 6f979f5187..a5a9623882 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1337,9 +1337,10 @@ estree-walker "^2.0.2" picomatch "^2.3.1" -"@samvera/ramp@https://github.com/samvera-labs/ramp.git": - version "2.0.0" - resolved "https://github.com/samvera-labs/ramp.git#66a4245be7c5dfc0abde3f5eaa23baf40d976d1d" +"@samvera/ramp@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@samvera/ramp/-/ramp-3.0.0.tgz#41251e0fb30ceb86d5d3905d27d9fa8089c193fe" + integrity sha512-Hapi2XJhNUHdye0XyRryBU8DlA51jvE7uDUy+cRflnjxDKMZuO6AqgqrZG0SRraS1ziXa1o5t2awAqzEzRi/KQ== dependencies: "@rollup/plugin-json" "^6.0.1" "@silvermine/videojs-quality-selector" "^1.2.4" @@ -3954,9 +3955,9 @@ make-dir@^3.0.2, make-dir@^3.1.0: semver "^6.0.0" mammoth@^1.4.19: - version "1.6.0" - resolved "https://registry.yarnpkg.com/mammoth/-/mammoth-1.6.0.tgz#3a80e016b3d1374c9404eb841048c70295276532" - integrity sha512-jOwbj6BwJzxCf6jr2l1zmSemniIkLnchvELXnDJCANlJawhzyIKObIq48B8kWEPLgUUh57k7FtEO3DHFQMnjMg== + version "1.7.0" + resolved "https://registry.yarnpkg.com/mammoth/-/mammoth-1.7.0.tgz#e59b2d89a4907595906429c9d3313729d67afca7" + integrity sha512-ptFhft61dqieLffpdpHD7PUS0cX9YvHQIO3n3ejRhj1bi5Na+RL5wovtNHHXAK6Oj554XfGrVcyTuxgegN6umw== dependencies: "@xmldom/xmldom" "^0.8.6" argparse "~1.0.3" @@ -5807,11 +5808,6 @@ videojs-font@3.2.0: resolved "https://registry.yarnpkg.com/videojs-font/-/videojs-font-3.2.0.tgz#212c9d3f4e4ec3fa7345167d64316add35e92232" integrity sha512-g8vHMKK2/JGorSfqAZQUmYYNnXmfec4MLhwtEFS+mMs2IDY398GLysy6BH6K+aS1KMNu/xWZ8Sue/X/mdQPliA== -videojs-hotkeys@^0.2.27: - version "0.2.27" - resolved "https://registry.yarnpkg.com/videojs-hotkeys/-/videojs-hotkeys-0.2.27.tgz#0df97952b9dff0e6cc1cf8a439fed7eac9c73f01" - integrity sha512-pwtm1QocRmzJy1PWQsmFVHyeldYHHpLdeATK3FsFHVMmNpz6CROkAn8TFy2UILr8Ghgq134K8jEKNue8HWpudQ== - videojs-markers-plugin@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/videojs-markers-plugin/-/videojs-markers-plugin-1.0.2.tgz#7e40da152504a0f1be0ee1cf608c7dccc4abf8b3"