From 9e1ad466eb727640790fed56d489e81bc63df619 Mon Sep 17 00:00:00 2001 From: jrhoads Date: Tue, 5 Jul 2022 14:05:55 -0400 Subject: [PATCH 01/12] Upgrade rails 6 gems and dependencies --- Gemfile | 4 +- Gemfile.lock | 317 ++++++++++++++++++++++++++------------------------- 2 files changed, 162 insertions(+), 159 deletions(-) diff --git a/Gemfile b/Gemfile index 9859ada0a..b51953976 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,6 @@ gem "aws-sdk-sqs", "~> 1.3" gem "base32-url", "~> 0.3" gem "batch-loader", "~> 1.4", ">= 1.4.1" gem "bcrypt", "~> 3.1.7" -gem "bergamasco", "~> 0.3.10" gem "bolognese", "~> 1.9" gem "bootsnap", "~> 1.4", ">= 1.4.4", require: false gem "cancancan", "~> 2.0" @@ -21,7 +20,6 @@ gem "country_select", "~> 3.1" gem "crawler_detect" gem "dalli", "~> 2.7", ">= 2.7.6" gem "ddtrace", "~> 0.32.0" -gem "departure", "~> 6.2" gem "diffy", "~> 3.2", ">= 3.2.1" gem "dotenv" gem "elasticsearch", "7.5" @@ -62,7 +60,7 @@ gem "premailer", "~> 1.11", ">= 1.11.1" gem "pwqgen.rb", "~> 0.1.0" gem "rack-cors", "~> 1.0", require: "rack/cors" gem "rack-utf8_sanitizer", "~> 1.6" -gem "rails", "~> 5.2.0" +gem "rails", "~> 6.1.6" gem "rake", "~> 12.0" gem "sentry-raven", "~> 2.9" gem "shoryuken", "~> 4.0" diff --git a/Gemfile.lock b/Gemfile.lock index 877a77df4..3ad4e78c1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,52 +3,70 @@ GEM specs: aasm (5.2.0) concurrent-ruby (~> 1.0) - actioncable (5.2.8) - actionpack (= 5.2.8) + actioncable (6.1.6) + actionpack (= 6.1.6) + activesupport (= 6.1.6) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.8) - actionpack (= 5.2.8) - actionview (= 5.2.8) - activejob (= 5.2.8) + actionmailbox (6.1.6) + actionpack (= 6.1.6) + activejob (= 6.1.6) + activerecord (= 6.1.6) + activestorage (= 6.1.6) + activesupport (= 6.1.6) + mail (>= 2.7.1) + actionmailer (6.1.6) + actionpack (= 6.1.6) + actionview (= 6.1.6) + activejob (= 6.1.6) + activesupport (= 6.1.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.8) - actionview (= 5.2.8) - activesupport (= 5.2.8) - rack (~> 2.0, >= 2.0.8) + actionpack (6.1.6) + actionview (= 6.1.6) + activesupport (= 6.1.6) + rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.8) - activesupport (= 5.2.8) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.6) + actionpack (= 6.1.6) + activerecord (= 6.1.6) + activestorage (= 6.1.6) + activesupport (= 6.1.6) + nokogiri (>= 1.8.5) + actionview (6.1.6) + activesupport (= 6.1.6) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - active_model_serializers (0.10.12) - actionpack (>= 4.1, < 6.2) - activemodel (>= 4.1, < 6.2) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + active_model_serializers (0.10.13) + actionpack (>= 4.1, < 7.1) + activemodel (>= 4.1, < 7.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (5.2.8) - activesupport (= 5.2.8) + activejob (6.1.6) + activesupport (= 6.1.6) globalid (>= 0.3.6) - activemodel (5.2.8) - activesupport (= 5.2.8) - activerecord (5.2.8) - activemodel (= 5.2.8) - activesupport (= 5.2.8) - arel (>= 9.0) - activestorage (5.2.8) - actionpack (= 5.2.8) - activerecord (= 5.2.8) - marcel (~> 1.0.0) - activesupport (5.2.8) + activemodel (6.1.6) + activesupport (= 6.1.6) + activerecord (6.1.6) + activemodel (= 6.1.6) + activesupport (= 6.1.6) + activestorage (6.1.6) + actionpack (= 6.1.6) + activejob (= 6.1.6) + activerecord (= 6.1.6) + activesupport (= 6.1.6) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (6.1.6) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) amazing_print (1.4.0) @@ -56,45 +74,34 @@ GEM apollo-federation (1.1.3) google-protobuf (~> 3.7) graphql (>= 1.9.8) - arel (9.0.0) ast (2.4.2) audited (4.10.0) activerecord (>= 4.2, < 6.2) - aws-eventstream (1.1.1) - aws-partitions (1.479.0) - aws-sdk-core (3.117.0) + aws-eventstream (1.2.0) + aws-partitions (1.602.0) + aws-sdk-core (3.131.2) aws-eventstream (~> 1, >= 1.0.2) - aws-partitions (~> 1, >= 1.239.0) + aws-partitions (~> 1, >= 1.525.0) aws-sigv4 (~> 1.1) - jmespath (~> 1.0) - aws-sdk-kms (1.44.0) - aws-sdk-core (~> 3, >= 3.112.0) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.57.0) + aws-sdk-core (~> 3, >= 3.127.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.96.1) - aws-sdk-core (~> 3, >= 3.112.0) + aws-sdk-s3 (1.114.0) + aws-sdk-core (~> 3, >= 3.127.0) aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.4) + aws-sdk-sqs (1.51.1) + aws-sdk-core (~> 3, >= 3.127.0) aws-sigv4 (~> 1.1) - aws-sdk-sqs (1.40.0) - aws-sdk-core (~> 3, >= 3.112.0) - aws-sigv4 (~> 1.1) - aws-sigv4 (1.2.4) + aws-sigv4 (1.5.0) aws-eventstream (~> 1, >= 1.0.2) base32-url (0.5) batch-loader (1.5.0) - bcrypt (3.1.16) + bcrypt (3.1.18) benchmark-perf (0.4.0) benchmark-trend (0.2.0) benchmark_methods (0.7) - bergamasco (0.3.17) - activesupport (>= 4.2.5, < 6) - addressable (>= 2.3.6) - builder (~> 3.2, >= 3.2.2) - loofah (~> 2.0, >= 2.0.3) - multi_json (~> 1.12) - nokogiri (~> 1.6, >= 1.6.8) - oj (>= 2.8.3) - pandoc-ruby (~> 2.0, >= 2.0.0) - safe_yaml (~> 1.0, >= 1.0.4) better_errors (2.9.1) coderay (>= 1.0.0) erubi (>= 1.0.0) @@ -128,16 +135,17 @@ GEM rdf-rdfxml (~> 3.1) rdf-turtle (~> 3.1) thor (>= 0.19) - bootsnap (1.7.5) - msgpack (~> 1.0) + bootsnap (1.12.0) + msgpack (~> 1.2) builder (3.2.4) - bullet (6.1.4) + bullet (6.1.5) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.3) cancancan (2.3.0) - capybara (3.35.3) + capybara (3.36.0) addressable + matrix mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) @@ -154,7 +162,7 @@ GEM climate_control (0.2.0) coderay (1.1.3) colorize (0.8.1) - commonmarker (0.23.4) + commonmarker (0.23.5) concurrent-ruby (1.1.10) connection_pool (2.2.5) countries (2.1.4) @@ -168,14 +176,14 @@ GEM crack (0.4.5) rexml crass (1.0.6) - crawler_detect (1.1.2) + crawler_detect (1.2.1) qonfig (~> 0.24) csl (1.6.0) namae (~> 1.0) rexml csl-styles (1.0.1.11) csl (~> 1.0) - css_parser (1.9.0) + css_parser (1.11.0) addressable dalli (2.7.11) database_cleaner (2.0.1) @@ -187,12 +195,8 @@ GEM ddtrace (0.32.0) msgpack debug_inspector (1.1.0) - departure (6.3.0) - activerecord (>= 5.2.0, <= 6.1) - mysql2 (>= 0.4.0, <= 0.5.3) - railties (>= 5.2.0, <= 6.1) - diff-lcs (1.4.4) - diffy (3.4.0) + diff-lcs (1.5.0) + diffy (3.4.2) docile (1.4.0) docopt (0.6.1) domain_name (0.5.20190701) @@ -215,11 +219,11 @@ GEM elasticsearch-extensions (0.0.33) ansi elasticsearch - elasticsearch-model (7.1.1) + elasticsearch-model (7.2.1) activesupport (> 3) - elasticsearch (> 1) + elasticsearch (~> 7) hashie - elasticsearch-rails (7.1.1) + elasticsearch-rails (7.2.1) elasticsearch-transport (7.5.0) faraday (>= 0.14, < 1) multi_json @@ -246,7 +250,7 @@ GEM faraday (>= 0.15) fast_jsonapi (1.5) activesupport (>= 4.2) - ffi (1.15.3) + ffi (1.15.5) flipper (0.17.2) flipper-active_support_cache_store (0.17.2) activesupport (>= 4.2, < 7) @@ -274,10 +278,10 @@ GEM activerecord (>= 4.0) hashids (~> 1.0) hashids (1.0.6) - hashie (4.1.0) + hashie (5.0.0) htmlentities (4.3.4) http-accept (1.7.0) - http-cookie (1.0.4) + http-cookie (1.0.5) domain_name (~> 0.5) i18n (1.10.0) concurrent-ruby (~> 1.0) @@ -285,7 +289,7 @@ GEM iso-639 (0.3.5) iso8601 (0.9.1) jmespath (1.6.1) - json (2.5.1) + json (2.6.2) json-canonicalization (0.3.0) json-ld (3.2.1) htmlentities (~> 4.3) @@ -301,19 +305,19 @@ GEM jsonlint (0.3.0) oj (~> 3) optimist (~> 3) - jwt (2.2.3) - kaminari (1.2.1) + jwt (2.4.1) + kaminari (1.2.2) activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.1) - kaminari-activerecord (= 1.2.1) - kaminari-core (= 1.2.1) - kaminari-actionview (1.2.1) + kaminari-actionview (= 1.2.2) + kaminari-activerecord (= 1.2.2) + kaminari-core (= 1.2.2) + kaminari-actionview (1.2.2) actionview - kaminari-core (= 1.2.1) - kaminari-activerecord (1.2.1) + kaminari-core (= 1.2.2) + kaminari-activerecord (1.2.2) activerecord - kaminari-core (= 1.2.1) - kaminari-core (1.2.1) + kaminari-core (= 1.2.2) + kaminari-core (1.2.2) kt-paperclip (6.4.1) activemodel (>= 4.2.0) activesupport (>= 4.2.0) @@ -326,6 +330,7 @@ GEM rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) + logger (1.5.1) lograge (0.11.2) actionpack (>= 4) activesupport (>= 4) @@ -357,9 +362,9 @@ GEM oj_mimic_json (~> 1.0, >= 1.0.1) matrix (0.4.2) method_source (1.0.0) - mime-types (3.3.1) + mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2021.0704) + mime-types-data (3.2022.0105) mimemagic (0.3.10) nokogiri (~> 1) rake @@ -369,10 +374,10 @@ GEM minitest (5.16.2) money (6.16.0) i18n (>= 0.6.4, <= 2) - msgpack (1.4.2) + msgpack (1.5.3) multi_json (1.15.0) multipart-post (2.2.3) - mysql2 (0.5.3) + mysql2 (0.5.4) namae (1.1.1) net-http-persistent (4.0.1) connection_pool (~> 2.2) @@ -384,9 +389,8 @@ GEM oj (3.13.15) oj_mimic_json (1.0.1) optimist (3.0.1) - pandoc-ruby (2.1.4) - parallel (1.20.1) - parser (3.0.2.0) + parallel (1.22.1) + parser (3.1.2.0) ast (~> 2.4.1) postrank-uri (1.0.24) addressable (>= 2.4.0) @@ -401,44 +405,46 @@ GEM pwqgen.rb (0.1.0) docopt (~> 0.5) sysrandom - qonfig (0.26.0) + qonfig (0.28.0) racc (1.6.0) rack (2.2.4) rack-accept (0.4.5) rack (>= 0.4) rack-cors (1.1.1) rack (>= 2.0.0) - rack-test (1.1.0) - rack (>= 1.0, < 3) + rack-test (2.0.2) + rack (>= 1.3) rack-utf8_sanitizer (1.7.0) rack (>= 1.0, < 3.0) - rails (5.2.8) - actioncable (= 5.2.8) - actionmailer (= 5.2.8) - actionpack (= 5.2.8) - actionview (= 5.2.8) - activejob (= 5.2.8) - activemodel (= 5.2.8) - activerecord (= 5.2.8) - activestorage (= 5.2.8) - activesupport (= 5.2.8) - bundler (>= 1.3.0) - railties (= 5.2.8) + rails (6.1.6) + actioncable (= 6.1.6) + actionmailbox (= 6.1.6) + actionmailer (= 6.1.6) + actionpack (= 6.1.6) + actiontext (= 6.1.6) + actionview (= 6.1.6) + activejob (= 6.1.6) + activemodel (= 6.1.6) + activerecord (= 6.1.6) + activestorage (= 6.1.6) + activesupport (= 6.1.6) + bundler (>= 1.15.0) + railties (= 6.1.6) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.4.2) + rails-html-sanitizer (1.4.3) loofah (~> 2.3) - railties (5.2.8) - actionpack (= 5.2.8) - activesupport (= 5.2.8) + railties (6.1.6) + actionpack (= 6.1.6) + activesupport (= 6.1.6) method_source - rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) - rainbow (3.0.0) + rake (>= 12.2) + thor (~> 1.0) + rainbow (3.1.1) rake (12.3.3) - rb-fsevent (0.11.0) + rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) rchardet (1.8.0) @@ -467,7 +473,7 @@ GEM rdf (~> 3.2) rexml (~> 3.2) regexp_parser (1.8.2) - request_store (1.5.0) + request_store (1.5.1) rack (>= 1.4) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) @@ -488,8 +494,9 @@ GEM rspec-expectations (3.9.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) - rspec-graphql_matchers (1.3.0) + rspec-graphql_matchers (1.3.1) graphql (>= 1.8, < 2.0) + rspec (~> 3.0) rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) @@ -502,32 +509,31 @@ GEM rspec-mocks (~> 3.9.0) rspec-support (~> 3.9.0) rspec-support (3.9.4) - rubocop (1.18.3) + rubocop (1.31.1) + json (~> 2.3) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.1.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.7.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.18.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.8.0) - parser (>= 3.0.1.1) + rubocop-ast (1.18.0) + parser (>= 3.1.1.0) rubocop-packaging (0.5.1) rubocop (>= 0.89, < 2.0) - rubocop-performance (1.11.4) + rubocop-performance (1.14.2) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.11.3) + rubocop-rails (2.15.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.7.0, < 2.0) - rubocop-rspec (2.4.0) - rubocop (~> 1.0) - rubocop-ast (>= 1.1.0) + rubocop-rspec (2.12.1) + rubocop (~> 1.31) ruby-progressbar (1.11.0) ruby_dep (1.5.0) - safe_yaml (1.0.5) scanf (1.0.0) seedbank (0.5.0) rake (>= 10.0) @@ -539,7 +545,7 @@ GEM thor shoulda-matchers (4.5.1) activesupport (>= 4.2.0) - simple_command (0.1.0) + simple_command (1.0.1) simplecov (0.17.1) docile (~> 1.1) json (>= 1.8, < 3) @@ -549,17 +555,18 @@ GEM slack-notifier (2.4.0) sort_alphabetical (1.1.0) unicode_utils (>= 1.2.2) - sparql (3.1.7) + sparql (3.2.4) builder (~> 3.2) - ebnf (~> 2.1) - rdf (~> 3.1, >= 3.1.14) - rdf-aggregate-repo (~> 3.1) - rdf-xsd (~> 3.1) - sparql-client (~> 3.1, >= 3.1.2) - sxp (~> 1.1) - sparql-client (3.1.2) + ebnf (~> 2.2, >= 2.3.1) + logger (~> 1.5) + rdf (~> 3.2, >= 3.2.8) + rdf-aggregate-repo (~> 3.2) + rdf-xsd (~> 3.2) + sparql-client (~> 3.2, >= 3.2.1) + sxp (~> 1.2, >= 1.2.2) + sparql-client (3.2.1) net-http-persistent (~> 4.0, >= 4.0.1) - rdf (~> 3.1) + rdf (~> 3.2, >= 3.2.6) spring (2.1.1) spring-commands-rspec (1.0.4) spring (>= 0.9.1) @@ -573,10 +580,10 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - string_pattern (2.2.2) + string_pattern (2.2.3) regexp_parser (~> 1.3, >= 1.3.0) - strip_attributes (1.11.0) - activemodel (>= 3.0, < 7.0) + strip_attributes (1.13.0) + activemodel (>= 3.0, < 8.0) sxp (1.2.2) matrix rdf (~> 3.2) @@ -587,27 +594,26 @@ GEM climate_control (>= 0.0.3, < 1.0) test-prof (0.10.2) thor (1.2.1) - thread_safe (0.3.6) tilt (2.0.10) turnout (2.5.0) i18n (>= 0.7, < 2) rack (>= 1.3, < 3) rack-accept (~> 0.4) tilt (>= 1.4, < 3) - tzinfo (1.2.9) - thread_safe (~> 0.1) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) unf (0.1.4) unf_ext - unf_ext (0.0.7.7) - unicode-display_width (2.0.0) + unf_ext (0.0.8.2) + unicode-display_width (2.2.0) unicode-types (1.7.0) unicode_utils (1.4.0) - uniform_notifier (1.14.2) + uniform_notifier (1.16.0) uuid (2.3.9) macaddr (~> 1.0) vcr (5.1.0) - webmock (3.13.0) - addressable (>= 2.3.6) + webmock (3.14.0) + addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) websocket-driver (0.7.5) @@ -615,6 +621,7 @@ GEM websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) + zeitwerk (2.6.0) PLATFORMS ruby @@ -629,7 +636,6 @@ DEPENDENCIES base32-url (~> 0.3) batch-loader (~> 1.4, >= 1.4.1) bcrypt (~> 3.1.7) - bergamasco (~> 0.3.10) better_errors binding_of_caller bolognese (~> 1.9) @@ -645,7 +651,6 @@ DEPENDENCIES dalli (~> 2.7, >= 2.7.6) database_cleaner ddtrace (~> 0.32.0) - departure (~> 6.2) diffy (~> 3.2, >= 3.2.1) dotenv elasticsearch (= 7.5) @@ -693,7 +698,7 @@ DEPENDENCIES pwqgen.rb (~> 0.1.0) rack-cors (~> 1.0) rack-utf8_sanitizer (~> 1.6) - rails (~> 5.2.0) + rails (~> 6.1.6) rake (~> 12.0) rspec-benchmark (~> 0.4.0) rspec-graphql_matchers (~> 1.1) From 00eb53f3a0108c97f7be259386a44cdfbf9b9cbe Mon Sep 17 00:00:00 2001 From: jrhoads Date: Thu, 7 Jul 2022 09:23:26 -0400 Subject: [PATCH 02/12] More Gemfile updates --- Gemfile | 6 +++--- Gemfile.lock | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index b51953976..771cf0669 100644 --- a/Gemfile +++ b/Gemfile @@ -23,8 +23,8 @@ gem "ddtrace", "~> 0.32.0" gem "diffy", "~> 3.2", ">= 3.2.1" gem "dotenv" gem "elasticsearch", "7.5" -gem "elasticsearch-model", "~> 7.1", ">= 7.1.1", require: "elasticsearch/model" -gem "elasticsearch-rails", "~> 7.1", ">= 7.1.1" +gem "elasticsearch-model", "~> 7.1.1", ">= 7.1.1", require: "elasticsearch/model" +gem "elasticsearch-rails", "~> 7.1.1", ">= 7.1.1" gem "elasticsearch-transport", "7.5" gem "equivalent-xml", "~> 0.6.0" gem "facets", require: false @@ -40,6 +40,7 @@ gem "graphql", "1.11.4" gem "graphql-batch", "~> 0.4.1" gem "graphql-cache", "~> 0.6.0" gem "graphql-errors", "~> 0.4.0" +gem "hashid-rails", "~> 1.4" gem "iso-639", "~> 0.3.5" gem "iso8601", "~> 0.9.0" gem "jsonlint", "~> 0.3.0" @@ -112,4 +113,3 @@ group :test do gem "webmock", "~> 3.1" end -gem "hashid-rails", "~> 1.4" diff --git a/Gemfile.lock b/Gemfile.lock index 3ad4e78c1..d849b7da2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -78,7 +78,7 @@ GEM audited (4.10.0) activerecord (>= 4.2, < 6.2) aws-eventstream (1.2.0) - aws-partitions (1.602.0) + aws-partitions (1.603.0) aws-sdk-core (3.131.2) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.525.0) @@ -219,11 +219,11 @@ GEM elasticsearch-extensions (0.0.33) ansi elasticsearch - elasticsearch-model (7.2.1) + elasticsearch-model (7.1.1) activesupport (> 3) - elasticsearch (~> 7) + elasticsearch (> 1) hashie - elasticsearch-rails (7.2.1) + elasticsearch-rails (7.1.1) elasticsearch-transport (7.5.0) faraday (>= 0.14, < 1) multi_json @@ -386,7 +386,7 @@ GEM nokogiri (1.13.6) mini_portile2 (~> 2.8.0) racc (~> 1.4) - oj (3.13.15) + oj (3.13.16) oj_mimic_json (1.0.1) optimist (3.0.1) parallel (1.22.1) @@ -509,7 +509,7 @@ GEM rspec-mocks (~> 3.9.0) rspec-support (~> 3.9.0) rspec-support (3.9.4) - rubocop (1.31.1) + rubocop (1.31.2) json (~> 2.3) parallel (~> 1.10) parser (>= 3.1.0.0) @@ -526,7 +526,7 @@ GEM rubocop-performance (1.14.2) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.15.1) + rubocop-rails (2.15.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.7.0, < 2.0) @@ -655,8 +655,8 @@ DEPENDENCIES dotenv elasticsearch (= 7.5) elasticsearch-extensions (~> 0.0.29) - elasticsearch-model (~> 7.1, >= 7.1.1) - elasticsearch-rails (~> 7.1, >= 7.1.1) + elasticsearch-model (~> 7.1.1, >= 7.1.1) + elasticsearch-rails (~> 7.1.1, >= 7.1.1) elasticsearch-transport (= 7.5) equivalent-xml (~> 0.6.0) facets @@ -729,4 +729,4 @@ DEPENDENCIES webmock (~> 3.1) BUNDLED WITH - 2.3.12 + 2.3.10 From 2d8fdf1d1db0364b968d6b49f4e9e8166a9fc2da Mon Sep 17 00:00:00 2001 From: jrhoads Date: Thu, 7 Jul 2022 13:38:16 -0400 Subject: [PATCH 03/12] Result of rails app:update --- bin/rails | 10 +-- bin/rake | 8 +-- bin/setup | 25 +++---- bin/spring | 16 ++--- .../application_controller_renderer.rb | 8 +++ config/initializers/backtrace_silencers.rb | 8 +-- config/initializers/cors.rb | 20 ++---- .../initializers/filter_parameter_logging.rb | 6 +- .../new_framework_defaults_6_1.rb | 67 +++++++++++++++++++ config/initializers/wrap_parameters.rb | 6 +- config/locales/en.yml | 2 +- config/spring.rb | 14 ++-- ..._to_active_storage_blobs.active_storage.rb | 18 +++++ ..._storage_variant_records.active_storage.rb | 12 ++++ db/schema.rb | 65 ++++++++++-------- 15 files changed, 184 insertions(+), 101 deletions(-) create mode 100644 config/initializers/application_controller_renderer.rb create mode 100644 config/initializers/new_framework_defaults_6_1.rb create mode 100644 db/migrate/20220707142353_add_service_name_to_active_storage_blobs.active_storage.rb create mode 100644 db/migrate/20220707142354_create_active_storage_variant_records.active_storage.rb diff --git a/bin/rails b/bin/rails index e1fc2a9ce..21d3e02d8 100755 --- a/bin/rails +++ b/bin/rails @@ -1,11 +1,5 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -begin - load File.expand_path("spring", __dir__) -rescue LoadError => e - raise unless e.message.include?("spring") -end -APP_PATH = File.expand_path("../config/application", __dir__) +load File.expand_path("spring", __dir__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative "../config/boot" require "rails/commands" diff --git a/bin/rake b/bin/rake index d4e83f82a..7327f471e 100755 --- a/bin/rake +++ b/bin/rake @@ -1,11 +1,5 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -begin - load File.expand_path("spring", __dir__) -rescue LoadError => e - raise unless e.message.include?("spring") -end +load File.expand_path("spring", __dir__) require_relative "../config/boot" require "rake" Rake.application.run diff --git a/bin/setup b/bin/setup index e413f40e3..57923026c 100755 --- a/bin/setup +++ b/bin/setup @@ -1,36 +1,33 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -require "pathname" require "fileutils" -include FileUtils # path to your application root. -APP_ROOT = Pathname.new File.expand_path("..", __dir__) +APP_ROOT = File.expand_path('..', __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end -chdir APP_ROOT do - # This script is a starting point to setup your application. +FileUtils.chdir APP_ROOT do + # This script is a way to set up or update your development environment automatically. + # This script is idempotent, so that you can run it at any time and get an expectable outcome. # Add necessary setup steps to this file. - puts "== Installing dependencies ==" - system! "gem install bundler --conservative" - system("bundle check") || system!("bundle install") + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' + # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" - system! "bin/rails db:setup" + system! 'bin/rails db:prepare' puts "\n== Removing old logs and tempfiles ==" - system! "bin/rails log:clear tmp:clear" + system! 'bin/rails log:clear tmp:clear' puts "\n== Restarting application server ==" - system! "bin/rails restart" + system! 'bin/rails restart' end diff --git a/bin/spring b/bin/spring index 3ad0d069d..b4147e843 100755 --- a/bin/spring +++ b/bin/spring @@ -1,18 +1,14 @@ #!/usr/bin/env ruby -# frozen_string_literal: true - -# This file loads spring without using Bundler, in order to be fast. -# It gets overwritten when you run the `spring binstub` command. - -unless defined?(Spring) - require "rubygems" +if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"]) + gem "bundler" require "bundler" - lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) - spring = lockfile.specs.detect { |spec| spec.name == "spring" } - if spring + # Load Spring without loading other gems in the Gemfile, for speed. + Bundler.locked_gems&.specs&.find { |spec| spec.name == "spring" }&.tap do |spring| Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path gem "spring", spring.version require "spring/binstub" + rescue Gem::LoadError + # Ignore when Spring is not installed. end end diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 000000000..89d2efab2 --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index d0f0d3b5d..33699c309 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -1,8 +1,8 @@ -# frozen_string_literal: true # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } +# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) } -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code +# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". +Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"] diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index d56f84fe4..3b1c1b5ed 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - # Be sure to restart your server when you modify this file. # Avoid CORS issues when API is called from the frontend app. @@ -7,18 +5,12 @@ # Read more: https://github.com/cyu/rack-cors -# Rails.application.config.middleware.insert_before 0, -# Rack::Cors, -# debug: true, -# logger: -# (-> { Rails.logger }) do +# Rails.application.config.middleware.insert_before 0, Rack::Cors do # allow do -# origins Rails.application.config.allowed_cors_origins.deep_dup -# # origins "*" -# resource "*", -# headers: :any, -# expose: %w[X-Credential-Username X-Anonymous-Consumer], -# methods: %i[get post put patch delete options head], -# credentials: true +# origins 'example.com' +# +# resource '*', +# headers: :any, +# methods: [:get, :post, :put, :patch, :delete, :options, :head] # end # end diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 2c112eb67..2899da4ec 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,6 +1,6 @@ -# frozen_string_literal: true - # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += %i[password] +Rails.application.config.filter_parameters += [ + :password, :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn +] diff --git a/config/initializers/new_framework_defaults_6_1.rb b/config/initializers/new_framework_defaults_6_1.rb new file mode 100644 index 000000000..9526b835a --- /dev/null +++ b/config/initializers/new_framework_defaults_6_1.rb @@ -0,0 +1,67 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 6.1 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Support for inversing belongs_to -> has_many Active Record associations. +# Rails.application.config.active_record.has_many_inversing = true + +# Track Active Storage variants in the database. +# Rails.application.config.active_storage.track_variants = true + +# Apply random variation to the delay when retrying failed jobs. +# Rails.application.config.active_job.retry_jitter = 0.15 + +# Stop executing `after_enqueue`/`after_perform` callbacks if +# `before_enqueue`/`before_perform` respectively halts with `throw :abort`. +# Rails.application.config.active_job.skip_after_callbacks_if_terminated = true + +# Specify cookies SameSite protection level: either :none, :lax, or :strict. +# +# This change is not backwards compatible with earlier Rails versions. +# It's best enabled when your entire app is migrated and stable on 6.1. +# Rails.application.config.action_dispatch.cookies_same_site_protection = :lax + +# Generate CSRF tokens that are encoded in URL-safe Base64. +# +# This change is not backwards compatible with earlier Rails versions. +# It's best enabled when your entire app is migrated and stable on 6.1. +# Rails.application.config.action_controller.urlsafe_csrf_tokens = true + +# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an +# UTC offset or a UTC time. +# ActiveSupport.utc_to_local_returns_utc_offset_times = true + +# Change the default HTTP status code to `308` when redirecting non-GET/HEAD +# requests to HTTPS in `ActionDispatch::SSL` middleware. +# Rails.application.config.action_dispatch.ssl_default_redirect_status = 308 + +# Use new connection handling API. For most applications this won't have any +# effect. For applications using multiple databases, this new API provides +# support for granular connection swapping. +# Rails.application.config.active_record.legacy_connection_handling = false + +# Make `form_with` generate non-remote forms by default. +# Rails.application.config.action_view.form_with_generates_remote_forms = false + +# Set the default queue name for the analysis job to the queue adapter default. +# Rails.application.config.active_storage.queues.analysis = nil + +# Set the default queue name for the purge job to the queue adapter default. +# Rails.application.config.active_storage.queues.purge = nil + +# Set the default queue name for the incineration job to the queue adapter default. +# Rails.application.config.action_mailbox.queues.incineration = nil + +# Set the default queue name for the routing job to the queue adapter default. +# Rails.application.config.action_mailbox.queues.routing = nil + +# Set the default queue name for the mail deliver job to the queue adapter default. +# Rails.application.config.action_mailer.deliver_later_queue_name = nil + +# Generate a `Link` header that gives a hint to modern browsers about +# preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`. +# Rails.application.config.action_view.preload_links_header = true diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index bbf59be11..bbfc3961b 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -1,12 +1,12 @@ -# frozen_string_literal: true - # Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) { wrap_parameters format: %i[json] } +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do diff --git a/config/locales/en.yml b/config/locales/en.yml index decc5a857..cf9b342d0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -27,7 +27,7 @@ # 'true': 'foo' # # To learn more, please read the Rails Internationalization guide -# available at http://guides.rubyonrails.org/i18n.html. +# available at https://guides.rubyonrails.org/i18n.html. en: hello: "Hello world" diff --git a/config/spring.rb b/config/spring.rb index c5933e491..db5bf1307 100644 --- a/config/spring.rb +++ b/config/spring.rb @@ -1,8 +1,6 @@ -# frozen_string_literal: true - -%w[ - .ruby-version - .rbenv-vars - tmp/restart.txt - tmp/caching-dev.txt -].each { |path| Spring.watch(path) } +Spring.watch( + ".ruby-version", + ".rbenv-vars", + "tmp/restart.txt", + "tmp/caching-dev.txt" +) diff --git a/db/migrate/20220707142353_add_service_name_to_active_storage_blobs.active_storage.rb b/db/migrate/20220707142353_add_service_name_to_active_storage_blobs.active_storage.rb new file mode 100644 index 000000000..9967a1323 --- /dev/null +++ b/db/migrate/20220707142353_add_service_name_to_active_storage_blobs.active_storage.rb @@ -0,0 +1,18 @@ +# This migration comes from active_storage (originally 20190112182829) +class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] + def up + 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 + remove_column :active_storage_blobs, :service_name + end +end diff --git a/db/migrate/20220707142354_create_active_storage_variant_records.active_storage.rb b/db/migrate/20220707142354_create_active_storage_variant_records.active_storage.rb new file mode 100644 index 000000000..a2862695e --- /dev/null +++ b/db/migrate/20220707142354_create_active_storage_variant_records.active_storage.rb @@ -0,0 +1,12 @@ +# This migration comes from active_storage (originally 20191206030411) +class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] + def change + create_table :active_storage_variant_records do |t| + t.belongs_to :blob, null: false, index: false + 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 +end diff --git a/db/schema.rb b/db/schema.rb index f730af62b..085d64e75 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,20 +1,18 @@ -# frozen_string_literal: true - -# # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_02_18_154500) do - create_table "active_storage_attachments", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| +ActiveRecord::Schema.define(version: 2022_07_07_142354) do + + create_table "active_storage_attachments", charset: "latin1", force: :cascade do |t| t.string "name", limit: 191, null: false t.string "record_type", null: false t.bigint "record_id", null: false @@ -24,7 +22,7 @@ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true end - create_table "active_storage_blobs", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "active_storage_blobs", charset: "latin1", force: :cascade do |t| t.string "key", limit: 191, null: false t.string "filename", limit: 191, null: false t.string "content_type", limit: 191 @@ -32,10 +30,17 @@ t.bigint "byte_size", null: false t.string "checksum", limit: 191, null: false t.datetime "created_at", null: false + t.string "service_name", null: false t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end - create_table "allocator", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "active_storage_variant_records", charset: "utf8mb4", force: :cascade do |t| + t.bigint "blob_id", null: false + t.string "variation_digest", null: false + t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true + end + + create_table "allocator", charset: "utf8", force: :cascade do |t| t.string "system_email", null: false t.datetime "created" t.integer "doi_quota_allowed", null: false @@ -47,7 +52,7 @@ t.string "symbol", null: false t.datetime "updated" t.integer "version" - t.text "comments", limit: 4294967295 + t.text "comments", size: :long t.string "experiments" t.text "description" t.string "region" @@ -84,7 +89,7 @@ t.index ["symbol"], name: "symbol", unique: true end - create_table "audits", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "audits", charset: "latin1", force: :cascade do |t| t.integer "auditable_id" t.string "auditable_type" t.integer "associated_id" @@ -106,7 +111,7 @@ t.index ["user_id", "user_type"], name: "user_index" end - create_table "client_prefixes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "client_prefixes", charset: "utf8", force: :cascade do |t| t.bigint "client_id", null: false t.bigint "prefix_id", null: false t.datetime "created_at" @@ -119,7 +124,7 @@ t.index ["uid"], name: "index_client_prefixes_on_uid", length: 128 end - create_table "contacts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "contacts", charset: "utf8", force: :cascade do |t| t.string "uid", limit: 36 t.bigint "provider_id", null: false t.string "given_name" @@ -131,8 +136,8 @@ t.datetime "deleted_at" end - create_table "datacentre", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| - t.text "comments", limit: 4294967295 + create_table "datacentre", charset: "utf8", force: :cascade do |t| + t.text "comments", size: :long t.string "system_email", null: false t.datetime "created" t.integer "doi_quota_allowed", null: false @@ -170,7 +175,7 @@ t.index ["url"], name: "index_datacentre_on_url", length: 100 end - create_table "dataset", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "dataset", charset: "utf8", force: :cascade do |t| t.datetime "created" t.string "doi", null: false t.binary "is_active", limit: 1, null: false @@ -211,7 +216,7 @@ t.json "subjects" t.string "schema_version", limit: 191 t.json "content_url" - t.binary "xml", limit: 16777215 + t.binary "xml", size: :medium t.json "landing_page" t.string "agency", limit: 191, default: "datacite" t.string "type", limit: 16, default: "DataCiteDoi" @@ -228,7 +233,7 @@ t.index ["url"], name: "index_dataset_on_url", length: 100 end - create_table "events", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| + create_table "events", charset: "utf8mb4", force: :cascade do |t| t.text "uuid", null: false t.text "subj_id", null: false t.text "obj_id" @@ -244,8 +249,8 @@ t.datetime "occurred_at" t.string "message_action", limit: 191, default: "create", null: false t.string "relation_type_id", limit: 191 - t.text "subj", limit: 16777215 - t.text "obj", limit: 16777215 + t.text "subj", size: :medium + t.text "obj", size: :medium t.integer "total", default: 1 t.string "license", limit: 191 t.text "source_doi" @@ -261,7 +266,7 @@ t.index ["uuid"], name: "index_events_on_uuid", unique: true, length: 36 end - create_table "media", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "media", charset: "utf8", force: :cascade do |t| t.datetime "created" t.string "media_type", limit: 80 t.datetime "updated" @@ -273,11 +278,11 @@ t.index ["url"], name: "index_media_on_url", length: 100 end - create_table "metadata", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "metadata", charset: "utf8", force: :cascade do |t| t.datetime "created" t.integer "metadata_version" t.integer "version" - t.binary "xml", limit: 16777215 + t.binary "xml", size: :medium t.bigint "dataset", null: false t.binary "is_converted_by_mds", limit: 1 t.string "namespace" @@ -285,13 +290,13 @@ t.index ["dataset"], name: "FKE52D7B2F4D3D6B1B" end - create_table "prefixes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "prefixes", charset: "utf8", force: :cascade do |t| t.datetime "created_at" t.string "uid", limit: 80, null: false t.index ["uid"], name: "prefix", unique: true end - create_table "provider_prefixes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "provider_prefixes", charset: "utf8", force: :cascade do |t| t.bigint "provider_id", null: false t.bigint "prefix_id", null: false t.datetime "created_at" @@ -302,10 +307,12 @@ t.index ["uid"], name: "index_provider_prefixes_on_uid", length: 128 end - create_table "reference_repositories", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "reference_repositories", charset: "latin1", force: :cascade do |t| t.string "client_id" t.string "re3doi" t.datetime "created_at", null: false t.datetime "updated_at", null: false end + + add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" end From 0b5c8f09e548a9d73531fc08f5fc69c8e4520c76 Mon Sep 17 00:00:00 2001 From: jrhoads Date: Thu, 7 Jul 2022 13:39:24 -0400 Subject: [PATCH 04/12] Appease rubocop --- app/models/reference_repository_denormalizer.rb | 2 +- bin/rails | 4 +++- bin/rake | 2 ++ bin/setup | 16 +++++++++------- bin/spring | 2 ++ .../application_controller_renderer.rb | 1 + config/initializers/backtrace_silencers.rb | 2 ++ config/initializers/cors.rb | 1 + config/initializers/filter_parameter_logging.rb | 2 ++ .../initializers/new_framework_defaults_6_1.rb | 1 + config/initializers/wrap_parameters.rb | 2 ++ config/spring.rb | 2 ++ ...ame_to_active_storage_blobs.active_storage.rb | 2 ++ ...ive_storage_variant_records.active_storage.rb | 2 ++ db/schema.rb | 3 ++- 15 files changed, 34 insertions(+), 10 deletions(-) diff --git a/app/models/reference_repository_denormalizer.rb b/app/models/reference_repository_denormalizer.rb index 991ca4214..014fb4913 100644 --- a/app/models/reference_repository_denormalizer.rb +++ b/app/models/reference_repository_denormalizer.rb @@ -43,7 +43,7 @@ def to_hash provider_id provider_id_and_name year - ].map { |method_name| [ method_name, send(method_name)] }.to_h + ].index_with { |method_name| send(method_name) } end def uid diff --git a/bin/rails b/bin/rails index 21d3e02d8..e4577c49f 100755 --- a/bin/rails +++ b/bin/rails @@ -1,5 +1,7 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + load File.expand_path("spring", __dir__) -APP_PATH = File.expand_path('../config/application', __dir__) +APP_PATH = File.expand_path("../config/application", __dir__) require_relative "../config/boot" require "rails/commands" diff --git a/bin/rake b/bin/rake index 7327f471e..731329cae 100755 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + load File.expand_path("spring", __dir__) require_relative "../config/boot" require "rake" diff --git a/bin/setup b/bin/setup index 57923026c..0e3a3a170 100755 --- a/bin/setup +++ b/bin/setup @@ -1,8 +1,10 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + require "fileutils" # path to your application root. -APP_ROOT = File.expand_path('..', __dir__) +APP_ROOT = File.expand_path("..", __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") @@ -13,9 +15,9 @@ FileUtils.chdir APP_ROOT do # This script is idempotent, so that you can run it at any time and get an expectable outcome. # Add necessary setup steps to this file. - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') + puts "== Installing dependencies ==" + system! "gem install bundler --conservative" + system("bundle check") || system!("bundle install") # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') @@ -23,11 +25,11 @@ FileUtils.chdir APP_ROOT do # end puts "\n== Preparing database ==" - system! 'bin/rails db:prepare' + system! "bin/rails db:prepare" puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' + system! "bin/rails log:clear tmp:clear" puts "\n== Restarting application server ==" - system! 'bin/rails restart' + system! "bin/rails restart" end diff --git a/bin/spring b/bin/spring index b4147e843..ee9de35b0 100755 --- a/bin/spring +++ b/bin/spring @@ -1,4 +1,6 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"]) gem "bundler" require "bundler" diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb index 89d2efab2..f4556db39 100644 --- a/config/initializers/application_controller_renderer.rb +++ b/config/initializers/application_controller_renderer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # ActiveSupport::Reloader.to_prepare do diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 33699c309..74f30e887 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index 3b1c1b5ed..5f68d44d3 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Avoid CORS issues when API is called from the frontend app. diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 2899da4ec..2f55fec59 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. diff --git a/config/initializers/new_framework_defaults_6_1.rb b/config/initializers/new_framework_defaults_6_1.rb index 9526b835a..0b4ce0231 100644 --- a/config/initializers/new_framework_defaults_6_1.rb +++ b/config/initializers/new_framework_defaults_6_1.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # # This file contains migration options to ease your Rails 6.1 upgrade. diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index bbfc3961b..2f3c0db47 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which diff --git a/config/spring.rb b/config/spring.rb index db5bf1307..37a354342 100644 --- a/config/spring.rb +++ b/config/spring.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Spring.watch( ".ruby-version", ".rbenv-vars", diff --git a/db/migrate/20220707142353_add_service_name_to_active_storage_blobs.active_storage.rb b/db/migrate/20220707142353_add_service_name_to_active_storage_blobs.active_storage.rb index 9967a1323..769d427a8 100644 --- a/db/migrate/20220707142353_add_service_name_to_active_storage_blobs.active_storage.rb +++ b/db/migrate/20220707142353_add_service_name_to_active_storage_blobs.active_storage.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This migration comes from active_storage (originally 20190112182829) class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] def up diff --git a/db/migrate/20220707142354_create_active_storage_variant_records.active_storage.rb b/db/migrate/20220707142354_create_active_storage_variant_records.active_storage.rb index a2862695e..3a460ee23 100644 --- a/db/migrate/20220707142354_create_active_storage_variant_records.active_storage.rb +++ b/db/migrate/20220707142354_create_active_storage_variant_records.active_storage.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This migration comes from active_storage (originally 20191206030411) class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] def change diff --git a/db/schema.rb b/db/schema.rb index 085d64e75..25ee71827 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -11,7 +13,6 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 2022_07_07_142354) do - create_table "active_storage_attachments", charset: "latin1", force: :cascade do |t| t.string "name", limit: 191, null: false t.string "record_type", null: false From a9fc852798cc2b609b8bbea7c0108fbe03e9c2ca Mon Sep 17 00:00:00 2001 From: jrhoads Date: Fri, 8 Jul 2022 16:08:14 -0400 Subject: [PATCH 05/12] Enable Zeitwerk. Fix failing routes --- config/application.rb | 3 ++- config/routes.rb | 3 ++- db/schema.rb | 5 ++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config/application.rb b/config/application.rb index c8128384c..12fced0b1 100644 --- a/config/application.rb +++ b/config/application.rb @@ -67,7 +67,7 @@ module Lupo class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 5.2 + config.load_defaults 6.1 # include graphql config.paths.add Rails.root.join("app", "graphql", "types").to_s, @@ -81,6 +81,7 @@ class Application < Rails::Application # Allow middleware to be loaded. (compressed_requests) config.autoload_paths += %W(#{config.root}/lib #{config.root}/lib/middleware) + config.eager_load_paths += %W(#{config.root}/lib #{config.root}/lib/middleware) # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers diff --git a/config/routes.rb b/config/routes.rb index 79ccc8b6f..e141d42d2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -241,7 +241,8 @@ resources :index, path: "/", only: %i[show index], - constraints: { id: /.+/, format: false } + constraints: { id: /.+/}, + format: false root to: "index#index" diff --git a/db/schema.rb b/db/schema.rb index 25ee71827..0cc9df120 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,5 +1,3 @@ -# frozen_string_literal: true - # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -13,6 +11,7 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 2022_07_07_142354) do + create_table "active_storage_attachments", charset: "latin1", force: :cascade do |t| t.string "name", limit: 191, null: false t.string "record_type", null: false @@ -35,7 +34,7 @@ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end - create_table "active_storage_variant_records", charset: "utf8mb4", force: :cascade do |t| + create_table "active_storage_variant_records", charset: "latin1", force: :cascade do |t| t.bigint "blob_id", null: false t.string "variation_digest", null: false t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true From 040450cb83e0112d476c44338fb8e1735a1959f8 Mon Sep 17 00:00:00 2001 From: Mike Bennett Date: Mon, 11 Jul 2022 16:00:42 +0100 Subject: [PATCH 06/12] Fix gzipped request test --- spec/requests/datacite_dois_gzip_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/requests/datacite_dois_gzip_spec.rb b/spec/requests/datacite_dois_gzip_spec.rb index 67f07ccf2..80c9afbb2 100644 --- a/spec/requests/datacite_dois_gzip_spec.rb +++ b/spec/requests/datacite_dois_gzip_spec.rb @@ -37,7 +37,7 @@ let(:headers) do { "CONTENT_TYPE" => "application/gzip", - "HTTP_ACCEPT" => "gzip", + "HTTP_ACCEPT" => "application/vnd.api+json", "HTTP_AUTHORIZATION" => "Bearer " + bearer, "HTTP_CONTENT_ENCODING" => "gzip", } From 7e337e1b98a442593c47399c2f5834c9b055658f Mon Sep 17 00:00:00 2001 From: jrhoads Date: Tue, 19 Jul 2022 15:41:47 -0400 Subject: [PATCH 07/12] Remove duplate error messages in tests --- spec/requests/clients_spec.rb | 7 +++++-- spec/requests/datacite_dois_spec.rb | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/spec/requests/clients_spec.rb b/spec/requests/clients_spec.rb index 35e926ff1..71064a997 100644 --- a/spec/requests/clients_spec.rb +++ b/spec/requests/clients_spec.rb @@ -191,8 +191,11 @@ expect(json["errors"]).to eq( [ - { "source" => "system_email", "title" => "Can't be blank", "uid" => provider.uid + ".imperial" }, - { "source" => "system_email", "title" => "Is invalid", "uid" => provider.uid + ".imperial" }, + { + "source" => "system_email", + "title" => "Can't be blank", + "uid" => provider.uid + ".imperial" + }, ], ) end diff --git a/spec/requests/datacite_dois_spec.rb b/spec/requests/datacite_dois_spec.rb index d55f5a703..e9d1219ad 100644 --- a/spec/requests/datacite_dois_spec.rb +++ b/spec/requests/datacite_dois_spec.rb @@ -2930,7 +2930,9 @@ post "/dois", valid_attributes, headers expect(last_response.status).to eq(422) - expect(json.dig("errors")).to eq([{ "source" => "metadata", "title" => "Is invalid", "uid" => "10.14454/10703" }, { "source" => "metadata", "title" => "Is invalid", "uid" => "10.14454/10703" }]) + expect(json.dig("errors")).to eq([ + { "source" => "metadata", "title" => "Is invalid", "uid" => "10.14454/10703" } + ]) end end From 2ca316971d1fda8a4a79cba35267436864ffce4a Mon Sep 17 00:00:00 2001 From: jrhoads Date: Tue, 19 Jul 2022 15:51:03 -0400 Subject: [PATCH 08/12] Remove another duplate error messages in tests --- spec/requests/repositories_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/requests/repositories_spec.rb b/spec/requests/repositories_spec.rb index 8bf1b8430..9211dd9d0 100644 --- a/spec/requests/repositories_spec.rb +++ b/spec/requests/repositories_spec.rb @@ -306,7 +306,6 @@ expect(json["errors"]).to eq( [ { "source" => "system_email", "title" => "Can't be blank", "uid" => "#{provider.uid}.imperial" }, - { "source" => "system_email", "title" => "Is invalid", "uid" => "#{provider.uid}.imperial" }, ], ) end From d3d0df89033870f376a8f63259dc58286996f30f Mon Sep 17 00:00:00 2001 From: Mike Bennett Date: Wed, 20 Jul 2022 23:32:25 +0100 Subject: [PATCH 09/12] Update cancancan to 3.x --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 771cf0669..0d888c9e6 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ gem "batch-loader", "~> 1.4", ">= 1.4.1" gem "bcrypt", "~> 3.1.7" gem "bolognese", "~> 1.9" gem "bootsnap", "~> 1.4", ">= 1.4.4", require: false -gem "cancancan", "~> 2.0" +gem "cancancan", "~> 3.0" gem "commonmarker", "~> 0.23.4" gem "countries", "~> 2.1", ">= 2.1.2" gem "country_select", "~> 3.1" diff --git a/Gemfile.lock b/Gemfile.lock index d849b7da2..708f69e9c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -142,7 +142,7 @@ GEM activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.3) - cancancan (2.3.0) + cancancan (3.4.0) capybara (3.36.0) addressable matrix @@ -642,7 +642,7 @@ DEPENDENCIES bootsnap (~> 1.4, >= 1.4.4) bullet (~> 6.1) byebug - cancancan (~> 2.0) + cancancan (~> 3.0) capybara commonmarker (~> 0.23.4) countries (~> 2.1, >= 2.1.2) From bab119a55049eac19fcffaa2cb24a621643046c6 Mon Sep 17 00:00:00 2001 From: Mike Bennett Date: Wed, 20 Jul 2022 23:44:21 +0100 Subject: [PATCH 10/12] Fix provider tests broken due to casing --- spec/requests/providers_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/requests/providers_spec.rb b/spec/requests/providers_spec.rb index f1be7a91f..1ec02208d 100644 --- a/spec/requests/providers_spec.rb +++ b/spec/requests/providers_spec.rb @@ -301,7 +301,7 @@ ) expect( json.dig("data", "relationships", "consortium", "data", "id"), - ).to eq(consortium.symbol.downcase) + ).to eq(consortium.symbol) end end @@ -447,7 +447,7 @@ ) expect( json.dig("data", "relationships", "consortium", "data", "id"), - ).to eq(consortium.symbol.downcase) + ).to eq(consortium.symbol) sleep 1 @@ -965,7 +965,7 @@ ) expect( json.dig("data", "relationships", "consortium", "data", "id"), - ).to eq(consortium.symbol.downcase) + ).to eq(consortium.symbol) end end @@ -1017,7 +1017,7 @@ ) expect( json.dig("data", "relationships", "consortium", "data", "id"), - ).to eq(consortium.symbol.downcase) + ).to eq(consortium.symbol) end end From fd1e38986dd44c322ec914defc548a0e2c9002e1 Mon Sep 17 00:00:00 2001 From: Mike Bennett Date: Tue, 2 Aug 2022 10:18:13 +0100 Subject: [PATCH 11/12] Schema.db updates (activestorage tables -> utf8) --- db/schema.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 0cc9df120..b25a4977b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,7 @@ ActiveRecord::Schema.define(version: 2022_07_07_142354) do - create_table "active_storage_attachments", charset: "latin1", force: :cascade do |t| + create_table "active_storage_attachments", charset: "utf8mb4", force: :cascade do |t| t.string "name", limit: 191, null: false t.string "record_type", null: false t.bigint "record_id", null: false @@ -22,7 +22,7 @@ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true end - create_table "active_storage_blobs", charset: "latin1", force: :cascade do |t| + create_table "active_storage_blobs", charset: "utf8mb4", force: :cascade do |t| t.string "key", limit: 191, null: false t.string "filename", limit: 191, null: false t.string "content_type", limit: 191 @@ -34,7 +34,7 @@ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end - create_table "active_storage_variant_records", charset: "latin1", force: :cascade do |t| + create_table "active_storage_variant_records", charset: "utf8mb4", force: :cascade do |t| t.bigint "blob_id", null: false t.string "variation_digest", null: false t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true @@ -89,7 +89,7 @@ t.index ["symbol"], name: "symbol", unique: true end - create_table "audits", charset: "latin1", force: :cascade do |t| + create_table "audits", charset: "utf8mb4", force: :cascade do |t| t.integer "auditable_id" t.string "auditable_type" t.integer "associated_id" @@ -307,7 +307,7 @@ t.index ["uid"], name: "index_provider_prefixes_on_uid", length: 128 end - create_table "reference_repositories", charset: "latin1", force: :cascade do |t| + create_table "reference_repositories", charset: "utf8mb4", force: :cascade do |t| t.string "client_id" t.string "re3doi" t.datetime "created_at", null: false From 2bfd310c7ad440997463b8679ec8dbc1c737f1a1 Mon Sep 17 00:00:00 2001 From: Mike Bennett Date: Tue, 2 Aug 2022 10:21:02 +0100 Subject: [PATCH 12/12] Appease rubocop --- Gemfile | 1 - config/routes.rb | 2 +- db/schema.rb | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 0d888c9e6..40b15f5d5 100644 --- a/Gemfile +++ b/Gemfile @@ -112,4 +112,3 @@ group :test do gem "vcr", "~> 5.1" gem "webmock", "~> 3.1" end - diff --git a/config/routes.rb b/config/routes.rb index e141d42d2..f1b42826f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -241,7 +241,7 @@ resources :index, path: "/", only: %i[show index], - constraints: { id: /.+/}, + constraints: { id: /.+/ }, format: false root to: "index#index" diff --git a/db/schema.rb b/db/schema.rb index b25a4977b..7b7950a34 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -9,9 +11,7 @@ # migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. - ActiveRecord::Schema.define(version: 2022_07_07_142354) do - create_table "active_storage_attachments", charset: "utf8mb4", force: :cascade do |t| t.string "name", limit: 191, null: false t.string "record_type", null: false