Skip to content

Commit

Permalink
🔀 AlecK/APPEALS-38443 - Update to Rails 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jcroteau committed Mar 18, 2024
1 parent 4ed40be commit 7404884
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 94 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ gem "omniauth-saml-va", git: "https://github.com/department-of-veterans-affairs/
gem "pg", "~> 0.18", platforms: :ruby
gem "puma", "5.6.4"
gem "rack-cors", ">= 1.0.4"
gem "rails", "5.2.8.1"
gem "rails", "6.0.6.1"
gem "redis-namespace"
gem "redis-rails", "~> 5.0.2"
gem "redis-semaphore"
Expand Down
118 changes: 67 additions & 51 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,61 +85,74 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.8.1)
actionpack (= 5.2.8.1)
actioncable (6.0.6.1)
actionpack (= 6.0.6.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.8.1)
actionpack (= 5.2.8.1)
actionview (= 5.2.8.1)
activejob (= 5.2.8.1)
actionmailbox (6.0.6.1)
actionpack (= 6.0.6.1)
activejob (= 6.0.6.1)
activerecord (= 6.0.6.1)
activestorage (= 6.0.6.1)
activesupport (= 6.0.6.1)
mail (>= 2.7.1)
actionmailer (6.0.6.1)
actionpack (= 6.0.6.1)
actionview (= 6.0.6.1)
activejob (= 6.0.6.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.8.1)
actionview (= 5.2.8.1)
activesupport (= 5.2.8.1)
actionpack (6.0.6.1)
actionview (= 6.0.6.1)
activesupport (= 6.0.6.1)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.8.1)
activesupport (= 5.2.8.1)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.6.1)
actionpack (= 6.0.6.1)
activerecord (= 6.0.6.1)
activestorage (= 6.0.6.1)
activesupport (= 6.0.6.1)
nokogiri (>= 1.8.5)
actionview (6.0.6.1)
activesupport (= 6.0.6.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_model_serializers (0.10.12)
actionpack (>= 4.1, < 6.2)
activemodel (>= 4.1, < 6.2)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (5.2.8.1)
activesupport (= 5.2.8.1)
activejob (6.0.6.1)
activesupport (= 6.0.6.1)
globalid (>= 0.3.6)
activejob_dj_overrides (0.2.0)
delayed_job
rails (>= 4.2)
activemodel (5.2.8.1)
activesupport (= 5.2.8.1)
activerecord (5.2.8.1)
activemodel (= 5.2.8.1)
activesupport (= 5.2.8.1)
arel (>= 9.0)
activestorage (5.2.8.1)
actionpack (= 5.2.8.1)
activerecord (= 5.2.8.1)
marcel (~> 1.0.0)
activesupport (5.2.8.1)
activemodel (6.0.6.1)
activesupport (= 6.0.6.1)
activerecord (6.0.6.1)
activemodel (= 6.0.6.1)
activesupport (= 6.0.6.1)
activestorage (6.0.6.1)
actionpack (= 6.0.6.1)
activejob (= 6.0.6.1)
activerecord (= 6.0.6.1)
marcel (~> 1.0)
activesupport (6.0.6.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
akami (1.3.1)
gyoku (>= 0.4.0)
nokogiri
arel (9.0.0)
ast (2.4.1)
aws-eventstream (1.1.0)
aws-sdk (2.11.632)
Expand Down Expand Up @@ -184,7 +197,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.2.2)
concurrent-ruby (1.2.3)
crack (0.4.5)
rexml
crass (1.0.6)
Expand Down Expand Up @@ -244,7 +257,7 @@ GEM
logstasher (2.1.5)
activesupport (>= 5.2)
request_store
loofah (2.21.3)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
macaddr (1.7.2)
Expand All @@ -265,7 +278,7 @@ GEM
mini_magick (4.11.0)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.20.0)
minitest (5.22.2)
moment_timezone-rails (0.5.14)
momentjs-rails (~> 2.15.1)
momentjs-rails (2.15.1)
Expand All @@ -277,17 +290,17 @@ GEM
ruby2_keywords (~> 0.0.1)
neat (4.0.0)
thor (~> 0.19)
net-imap (0.4.5)
net-imap (0.4.10)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0)
net-smtp (0.4.0.1)
net-protocol
newrelic_rpm (6.14.0)
nio4r (2.5.9)
nio4r (2.7.0)
nokogiri (1.15.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
Expand All @@ -314,25 +327,27 @@ GEM
puma (5.6.4)
nio4r (~> 2.0)
racc (1.7.3)
rack (2.2.8)
rack (2.2.8.1)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-protection (2.2.0)
rack
rack-test (2.1.0)
rack (>= 1.3)
rails (5.2.8.1)
actioncable (= 5.2.8.1)
actionmailer (= 5.2.8.1)
actionpack (= 5.2.8.1)
actionview (= 5.2.8.1)
activejob (= 5.2.8.1)
activemodel (= 5.2.8.1)
activerecord (= 5.2.8.1)
activestorage (= 5.2.8.1)
activesupport (= 5.2.8.1)
rails (6.0.6.1)
actioncable (= 6.0.6.1)
actionmailbox (= 6.0.6.1)
actionmailer (= 6.0.6.1)
actionpack (= 6.0.6.1)
actiontext (= 6.0.6.1)
actionview (= 6.0.6.1)
activejob (= 6.0.6.1)
activemodel (= 6.0.6.1)
activerecord (= 6.0.6.1)
activestorage (= 6.0.6.1)
activesupport (= 6.0.6.1)
bundler (>= 1.3.0)
railties (= 5.2.8.1)
railties (= 6.0.6.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
Expand All @@ -342,14 +357,14 @@ GEM
loofah (~> 2.21)
nokogiri (~> 1.14)
rails_stdout_logging (0.0.5)
railties (5.2.8.1)
actionpack (= 5.2.8.1)
activesupport (= 5.2.8.1)
railties (6.0.6.1)
actionpack (= 6.0.6.1)
activesupport (= 6.0.6.1)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
thor (>= 0.20.3, < 2.0)
rainbow (3.0.0)
rake (13.0.6)
rake (13.1.0)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
Expand Down Expand Up @@ -520,6 +535,7 @@ GEM
xpath (3.2.0)
nokogiri (~> 1.8)
zaru (0.3.0)
zeitwerk (2.6.13)
zero_downtime_migrations (0.0.7)
activerecord

Expand Down Expand Up @@ -562,7 +578,7 @@ DEPENDENCIES
pry-byebug
puma (= 5.6.4)
rack-cors (>= 1.0.4)
rails (= 5.2.8.1)
rails (= 6.0.6.1)
rails_stdout_logging
rb-readline
redis-namespace
Expand Down
4 changes: 2 additions & 2 deletions app/services/image_converter_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ def process
return image if self.class.converted_mime_type(record.mime_type) == record.mime_type

converted_image = convert
record.update_attributes!(conversion_status: :conversion_success)
record.update!(conversion_status: :conversion_success)
converted_image
rescue ImageConverterError
record.update_attributes!(conversion_status: :conversion_failed)
record.update!(conversion_status: :conversion_failed)

image
end
Expand Down
14 changes: 7 additions & 7 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env ruby
require 'fileutils'
include FileUtils

# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)
Expand All @@ -9,28 +8,29 @@ 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 setup or update your development environment automatically.
# This script is idempotent, so that you can run it at anytime 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')

# Install JavaScript dependencies if using Yarn
# Install JavaScript dependencies
system('bin/yarn')

# 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'

puts "\n== Restarting application server =="
system! 'bin/rails restart'
end
end
35 changes: 33 additions & 2 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
module CaseflowEfolder
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
config.load_defaults 6.0
config.autoloader = :classic

# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
Expand Down Expand Up @@ -76,6 +77,36 @@ class Application < Rails::Application
# Default as of 5.2: true
Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = false

# Make Active Record use stable #cache_key alongside new #cache_version method.
# This is needed for recyclable cache keys.
# Default as of 5.2: true
config.active_record.cache_versioning = false


#=======================================================================================
# Rails 6.0 default overrides
#---------------------------------------------------------------------------------------

# Don't force requests from old versions of IE to be UTF-8 encoded.
# Default changed as of 6.0 to false
# This can be changed to the defualt and removed if we no longer support IE5-8 (old browsers)
Rails.application.config.action_view.default_enforce_utf8 = true

# Embed purpose and expiry metadata inside signed and encrypted
# cookies for increased security.
#
# This option is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.0.
# Default change to true as of 6.0
# Remove after stable 6.0
Rails.application.config.action_dispatch.use_cookies_with_metadata = false

# Enable the same cache key to be reused when the object being cached of type
# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count)
# of the relation's cache key into the cache version to support recycling cache key.
# Default as of 6.0: true
Rails.application.config.active_record.collection_cache_versioning = false


#=======================================================================================
# eFolder Specific configs
Expand Down Expand Up @@ -129,4 +160,4 @@ class Application < Rails::Application

config.bgs_environment = ENV["BGS_ENVIRONMENT"] || "beplinktest"
end
end
end
10 changes: 5 additions & 5 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
# Run rails dev:cache to toggle caching.
if Rails.root.join('tmp', 'caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.to_i}"
}

else
config.action_controller.perform_caching = false

end

# Store uploaded files on the local file system (see config/storage.yml for options)
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local

# Don't care if the mailer can't send.
Expand All @@ -50,14 +50,14 @@
# Suppress logger output for asset requests.
config.assets.quiet = true

# Raises error for missing translations
# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true

# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker


#=========================================================================================
# eFolder - Custom Config Settings
# Keep all efolder specific config settings below for clean diff's when upgrading rails
Expand All @@ -74,4 +74,4 @@

config.sqs_create_queues = true
config.sqs_endpoint = 'http://localhost:4566'
end
end
Loading

0 comments on commit 7404884

Please sign in to comment.