Skip to content

Commit

Permalink
Rails 7 upgrade from 6.1.7.7 to 7.0.8.1 (#1102)
Browse files Browse the repository at this point in the history
* Rails 7 upgrade

* fix rubocop issues

---------

Co-authored-by: nfstern02 <[email protected]>
  • Loading branch information
GcioGregg and nfstern02 authored Apr 23, 2024
1 parent 033851c commit c30e1d7
Show file tree
Hide file tree
Showing 26 changed files with 488 additions and 223 deletions.
7 changes: 2 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ruby '3.3.0'
# Puma was chosen because it handles load of 40+ concurrent users better than Unicorn and Passenger
# Discussion: https://github.com/18F/college-choice/issues/597#issuecomment-139034834
gem 'puma', '~> 6.4.2'
gem 'rails', '~> 6.1.7.7'
gem 'rails', '~> 7.0.8.1'

# Gems with special version/repo needs

Expand Down Expand Up @@ -44,6 +44,7 @@ gem 'activerecord-session_store'

gem 'bootsnap', require: false
gem 'config'
gem 'sprockets-rails' # Rails 7 upgrade - needed for now.

# Use devise for authentication
gem 'devise'
Expand Down Expand Up @@ -116,8 +117,4 @@ group :development do

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', platforms: :ruby

# Include the IANA Time Zone Database on Windows, where Windows doens't ship with a timezone database.
# POSIX systems should have this already, so we're not going to bring it in on other platforms
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
end
136 changes: 71 additions & 65 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,47 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.7.7)
actionpack (= 6.1.7.7)
activesupport (= 6.1.7.7)
actioncable (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.7)
actionpack (= 6.1.7.7)
activejob (= 6.1.7.7)
activerecord (= 6.1.7.7)
activestorage (= 6.1.7.7)
activesupport (= 6.1.7.7)
actionmailbox (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
mail (>= 2.7.1)
actionmailer (6.1.7.7)
actionpack (= 6.1.7.7)
actionview (= 6.1.7.7)
activejob (= 6.1.7.7)
activesupport (= 6.1.7.7)
net-imap
net-pop
net-smtp
actionmailer (7.0.8.1)
actionpack (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activesupport (= 7.0.8.1)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (6.1.7.7)
actionview (= 6.1.7.7)
activesupport (= 6.1.7.7)
rack (~> 2.0, >= 2.0.9)
actionpack (7.0.8.1)
actionview (= 7.0.8.1)
activesupport (= 7.0.8.1)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.7.7)
actionpack (= 6.1.7.7)
activerecord (= 6.1.7.7)
activestorage (= 6.1.7.7)
activesupport (= 6.1.7.7)
actiontext (7.0.8.1)
actionpack (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (6.1.7.7)
activesupport (= 6.1.7.7)
actionview (7.0.8.1)
activesupport (= 7.0.8.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
Expand All @@ -61,14 +68,14 @@ GEM
activemodel (>= 4.1)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (6.1.7.7)
activesupport (= 6.1.7.7)
activejob (7.0.8.1)
activesupport (= 7.0.8.1)
globalid (>= 0.3.6)
activemodel (6.1.7.7)
activesupport (= 6.1.7.7)
activerecord (6.1.7.7)
activemodel (= 6.1.7.7)
activesupport (= 6.1.7.7)
activemodel (7.0.8.1)
activesupport (= 7.0.8.1)
activerecord (7.0.8.1)
activemodel (= 7.0.8.1)
activesupport (= 7.0.8.1)
activerecord-import (1.6.0)
activerecord (>= 4.2)
activerecord-session_store (2.1.0)
Expand All @@ -78,19 +85,18 @@ GEM
multi_json (~> 1.11, >= 1.11.2)
rack (>= 2.0.8, < 4)
railties (>= 6.1)
activestorage (6.1.7.7)
actionpack (= 6.1.7.7)
activejob (= 6.1.7.7)
activerecord (= 6.1.7.7)
activesupport (= 6.1.7.7)
activestorage (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activesupport (= 7.0.8.1)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7.7)
activesupport (7.0.8.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
Expand Down Expand Up @@ -221,9 +227,9 @@ GEM
net-imap
net-pop
net-smtp
marcel (1.0.2)
marcel (1.0.4)
matrix (0.4.2)
method_source (1.0.0)
method_source (1.1.0)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0305)
Expand All @@ -243,15 +249,15 @@ GEM
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0.1)
net-smtp (0.5.0)
net-protocol
newrelic_rpm (9.8.0)
nio4r (2.7.1)
nokogiri (1.16.3-aarch64-linux)
nokogiri (1.16.4-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.3-arm64-darwin)
nokogiri (1.16.4-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.3-x86_64-linux)
nokogiri (1.16.4-x86_64-linux)
racc (~> 1.4)
notiffany (0.1.3)
nenv (~> 0.1)
Expand Down Expand Up @@ -280,21 +286,20 @@ GEM
rack (>= 2.0.0)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.1.7.7)
actioncable (= 6.1.7.7)
actionmailbox (= 6.1.7.7)
actionmailer (= 6.1.7.7)
actionpack (= 6.1.7.7)
actiontext (= 6.1.7.7)
actionview (= 6.1.7.7)
activejob (= 6.1.7.7)
activemodel (= 6.1.7.7)
activerecord (= 6.1.7.7)
activestorage (= 6.1.7.7)
activesupport (= 6.1.7.7)
rails (7.0.8.1)
actioncable (= 7.0.8.1)
actionmailbox (= 7.0.8.1)
actionmailer (= 7.0.8.1)
actionpack (= 7.0.8.1)
actiontext (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activemodel (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
bundler (>= 1.15.0)
railties (= 6.1.7.7)
sprockets-rails (>= 2.0.0)
railties (= 7.0.8.1)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -306,14 +311,15 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (6.1.7.7)
actionpack (= 6.1.7.7)
activesupport (= 6.1.7.7)
railties (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.2.0)
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
Expand Down Expand Up @@ -513,7 +519,7 @@ DEPENDENCIES
puma (~> 6.4.2)
rack (>= 2.2.8.1)
rack-cors
rails (~> 6.1.7.7)
rails (~> 7.0.8.1)
rails-controller-testing
rails-html-sanitizer (>= 1.4.4)
rainbow
Expand All @@ -532,8 +538,8 @@ DEPENDENCIES
simplecov-single_file
sitemap_generator
spring
sprockets-rails
strong_migrations
tzinfo-data
uglifier (>= 1.3.0)
vcr (~> 3.0, >= 3.0.1)
vets_json_schema!
Expand Down
7 changes: 0 additions & 7 deletions app/concerns/default_url_options.rb

This file was deleted.

6 changes: 3 additions & 3 deletions app/controllers/dashboards_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def csv_model(csv_type)
def fetch_api_data(api_upload)
klass = api_upload.csv_type.constantize
populated = klass.respond_to?(:populate) ? klass.populate : false
api_upload.update(ok: populated, completed_at: Time.now.utc.to_s(:db))
api_upload.update(ok: populated, completed_at: Time.now.utc.to_fs(:db))

if populated
message = "#{klass.name}::POPULATE_SUCCESS_MESSAGE".safe_constantize
Expand Down Expand Up @@ -177,7 +177,7 @@ def upload_file(class_nm, csv)
sheets: [{ klass: klass, skip_lines: 0, clean_rows: upload.clean_rows }]
}
klass.load_with_roo(file, file_options).first
upload.update(ok: true, completed_at: Time.now.utc.to_s(:db))
upload.update(ok: true, completed_at: Time.now.utc.to_fs(:db))
flash.notice = 'Successfully fetched & uploaded file' if upload.save!
end
else
Expand All @@ -186,7 +186,7 @@ def upload_file(class_nm, csv)
end
rescue StandardError => e
message = Common::Exceptions::ExceptionHandler.new(e, upload&.csv_type).serialize_error
upload.update(ok: false, completed_at: Time.now.utc.to_s(:db), comment: message)
upload.update(ok: false, completed_at: Time.now.utc.to_fs(:db), comment: message)

Rails.logger.error e
flash.alert = message
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def validate(loaded_data)
.map { |data| data[:klass].name }
error_msg = @group.comment + " There was no saved #{no_saved_data.join(', or ')} data."

@group.update(ok: ok, completed_at: Time.now.utc.to_s(:db), comment: (error_msg unless no_saved_data.none?))
@group.update(ok: ok, completed_at: Time.now.utc.to_fs(:db), comment: (error_msg unless no_saved_data.none?))

raise(StandardError, error_msg + ' Please check the file or selected options.') unless no_saved_data.none?
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/uploads_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def create
alert_messages(data)
data_results = data[:results]

@upload.update(ok: data_results.present? && data_results.ids.present?, completed_at: Time.now.utc.to_s(:db))
@upload.update(ok: data_results.present? && data_results.ids.present?, completed_at: Time.now.utc.to_fs(:db))
error_msg = "There was no saved #{klass} data. Please check the file or \"Skip lines before header\"."
raise(StandardError, error_msg) unless @upload.ok?

Expand Down
2 changes: 1 addition & 1 deletion app/models/caution_flag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class CautionFlag < ApplicationRecord
}

def self.build(version_id, cf_template, clause_sql)
timestamp = Time.now.utc.to_s(:db)
timestamp = Time.now.utc.to_fs(:db)
conn = ApplicationRecord.connection
insert_columns = %i[
institution_id version_id source title description
Expand Down
8 changes: 4 additions & 4 deletions app/models/institution_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def self.run(user)
# rubocop:enable Rails/SkipsModelValidations
end
build_messages = run_insertions(version)
version.update(production: true, completed_at: Time.now.utc.to_s(:db))
version.update(production: true, completed_at: Time.now.utc.to_fs(:db))
GibctSiteMapper.new(ping: true) if production?
Archiver.archive_previous_versions if Settings.archiver.archive
log_info_status PUBLISH_COMPLETE_TEXT
Expand Down Expand Up @@ -127,7 +127,7 @@ def self.initialize_with_weams(version)
log_info_status 'Starting creation of base Institution rows'

columns = Weam::COLS_USED_IN_INSTITUTION.map(&:to_s)
timestamp = Time.now.utc.to_s(:db)
timestamp = Time.now.utc.to_fs(:db)
conn = ApplicationRecord.connection

str = "INSERT INTO institutions (#{columns.join(', ')}, version, created_at, updated_at, version_id) "
Expand Down Expand Up @@ -473,7 +473,7 @@ def self.add_settlement(version_id)

# Create Caution Flags
log_info_status 'Creating Caution Flag rows'
timestamp = Time.now.utc.to_s(:db)
timestamp = Time.now.utc.to_fs(:db)
conn = ApplicationRecord.connection
insert_columns = %i[
institution_id version_id source title description
Expand Down Expand Up @@ -681,7 +681,7 @@ def self.add_vet_tec_provider(version_id)

def self.build_zip_code_rates_from_weams(version_id)
log_info_status 'Creating Zip Code Rate information'
timestamp = Time.now.utc.to_s(:db)
timestamp = Time.now.utc.to_fs(:db)
conn = ApplicationRecord.connection

str = <<-SQL
Expand Down
6 changes: 3 additions & 3 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ def system!(*args)
end

chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file.
# 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.

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 =="
Expand Down
Loading

0 comments on commit c30e1d7

Please sign in to comment.