Skip to content

Commit

Permalink
Upgrade to Rails 7.1 and apply new framework defaults
Browse files Browse the repository at this point in the history
* Remove deprecated options from environments
* Remove deprecation warnings for upcoming Rails 7.2
* Dump schema with new defaults
* Remove outdated (and erroneous) data attribute in view
* Resolve a `NoMethodError` for seeds_spec.rb
  • Loading branch information
MrSerth committed Oct 13, 2023
1 parent 84f844c commit 38f3ad2
Show file tree
Hide file tree
Showing 16 changed files with 194 additions and 133 deletions.
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ gem 'proformaxml', '1.0.0'
gem 'prometheus_exporter'
gem 'puma'
gem 'pundit'
gem 'rails', '~> 7.0.8'
gem 'rails', '~> 7.1.1'
gem 'rails_admin', '< 4.0.0'
gem 'rails-i18n'
gem 'rails-timeago'
gem 'ransack'
# Temporary switch to a Rails 7.1 compatible fork. See https://github.com/activerecord-hackery/ransack/pull/1439
gem 'ransack', github: 'yuki24/ransack', branch: 'rails-7-1'
gem 'rubytree'
gem 'rubyzip'
gem 'sassc-rails'
Expand Down
177 changes: 106 additions & 71 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,74 +1,92 @@
GIT
remote: https://github.com/yuki24/ransack.git
revision: c47fa8cb2a37800e95a670b989845ab5fbc5d02e
branch: rails-7-1
specs:
ransack (4.0.0)
activerecord (>= 6.1.5)
activesupport (>= 6.1.5)
i18n

GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
actioncable (7.1.1)
actionpack (= 7.1.1)
activesupport (= 7.1.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.8)
actionpack (= 7.0.8)
activejob (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
zeitwerk (~> 2.6)
actionmailbox (7.1.1)
actionpack (= 7.1.1)
activejob (= 7.1.1)
activerecord (= 7.1.1)
activestorage (= 7.1.1)
activesupport (= 7.1.1)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.8)
actionpack (= 7.0.8)
actionview (= 7.0.8)
activejob (= 7.0.8)
activesupport (= 7.0.8)
actionmailer (7.1.1)
actionpack (= 7.1.1)
actionview (= 7.1.1)
activejob (= 7.1.1)
activesupport (= 7.1.1)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.8)
actionview (= 7.0.8)
activesupport (= 7.0.8)
rack (~> 2.0, >= 2.2.4)
rails-dom-testing (~> 2.2)
actionpack (7.1.1)
actionview (= 7.1.1)
activesupport (= 7.1.1)
nokogiri (>= 1.8.5)
rack (>= 2.2.4)
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)
actionpack (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.1)
actionpack (= 7.1.1)
activerecord (= 7.1.1)
activestorage (= 7.1.1)
activesupport (= 7.1.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.8)
activesupport (= 7.0.8)
actionview (7.1.1)
activesupport (= 7.1.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.8)
activesupport (= 7.0.8)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.1)
activesupport (= 7.1.1)
globalid (>= 0.3.6)
activemodel (7.0.8)
activesupport (= 7.0.8)
activemodel (7.1.1)
activesupport (= 7.1.1)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activerecord (7.0.8)
activemodel (= 7.0.8)
activesupport (= 7.0.8)
activestorage (7.0.8)
actionpack (= 7.0.8)
activejob (= 7.0.8)
activerecord (= 7.0.8)
activesupport (= 7.0.8)
activerecord (7.1.1)
activemodel (= 7.1.1)
activesupport (= 7.1.1)
timeout (>= 0.4.0)
activestorage (7.1.1)
actionpack (= 7.1.1)
activejob (= 7.1.1)
activerecord (= 7.1.1)
activesupport (= 7.1.1)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.8)
activesupport (7.1.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
Expand All @@ -80,6 +98,7 @@ GEM
erubi (>= 1.0.0)
rack (>= 0.9.0)
rouge (>= 1.0.0)
bigdecimal (3.1.4)
bindex (0.8.1)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
Expand Down Expand Up @@ -131,6 +150,8 @@ GEM
docker-api (2.2.0)
excon (>= 0.47.0)
multi_json
drb (2.1.1)
ruby2_keywords
erubi (1.12.0)
eventmachine (1.2.7)
excon (0.104.0)
Expand Down Expand Up @@ -175,6 +196,10 @@ GEM
oauth (>= 0.4.5)
rexml
influxdb (0.8.1)
io-console (0.6.0)
irb (1.8.2)
rdoc
reline (>= 0.3.8)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -232,6 +257,7 @@ GEM
msgpack (1.7.2)
multi_json (1.15.0)
multi_xml (0.6.0)
mutex_m (0.1.2)
nested_form (0.3.2)
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
Expand Down Expand Up @@ -284,6 +310,8 @@ GEM
pry (>= 0.13, < 0.15)
pry-rails (0.3.9)
pry (>= 0.10.4)
psych (5.1.1)
stringio
public_suffix (5.0.3)
puma (6.4.0)
nio4r (~> 2.0)
Expand All @@ -295,22 +323,27 @@ GEM
rack (>= 1.2.0)
rack-proxy (0.7.7)
rack
rack-session (1.0.1)
rack (< 3)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.8)
actioncable (= 7.0.8)
actionmailbox (= 7.0.8)
actionmailer (= 7.0.8)
actionpack (= 7.0.8)
actiontext (= 7.0.8)
actionview (= 7.0.8)
activejob (= 7.0.8)
activemodel (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
rackup (1.0.0)
rack (< 3)
webrick
rails (7.1.1)
actioncable (= 7.1.1)
actionmailbox (= 7.1.1)
actionmailer (= 7.1.1)
actionpack (= 7.1.1)
actiontext (= 7.1.1)
actionview (= 7.1.1)
activejob (= 7.1.1)
activemodel (= 7.1.1)
activerecord (= 7.1.1)
activestorage (= 7.1.1)
activesupport (= 7.1.1)
bundler (>= 1.15.0)
railties (= 7.0.8)
railties (= 7.1.1)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -334,24 +367,25 @@ GEM
nested_form (~> 0.3)
rails (>= 6.0, < 8)
turbo-rails (~> 1.0)
railties (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
method_source
railties (7.1.1)
actionpack (= 7.1.1)
activesupport (= 7.1.1)
irb
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.0.6)
ransack (4.0.0)
activerecord (>= 6.1.5)
activesupport (>= 6.1.5)
i18n
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rbtree (0.4.6)
rdoc (6.5.0)
psych (>= 4.0.0)
regexp_parser (2.8.2)
reline (0.3.9)
io-console (~> 0.5)
rexml (3.2.6)
rouge (4.1.3)
rspec-collection_matchers (1.2.1)
Expand All @@ -375,7 +409,7 @@ GEM
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.12.1)
rubocop (1.57.0)
rubocop (1.57.1)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
Expand Down Expand Up @@ -471,6 +505,7 @@ GEM
sprockets (>= 3.0.0)
ssrf_filter (1.1.2)
stackprof (0.2.25)
stringio (3.0.8)
telegraf (2.1.1)
influxdb
temple (0.10.3)
Expand Down Expand Up @@ -566,12 +601,12 @@ DEPENDENCIES
puma
pundit
rack-mini-profiler
rails (~> 7.0.8)
rails (~> 7.1.1)
rails-controller-testing
rails-i18n
rails-timeago
rails_admin (< 4.0.0)
ransack
ransack!
rspec-collection_matchers
rspec-github
rspec-rails
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/exercises_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class ExercisesController < ApplicationController
before_action :handle_file_uploads, only: %i[create update]
before_action :set_execution_environments, only: %i[index create edit new update]
before_action :set_exercise_and_authorize,
only: MEMBER_ACTIONS + %i[clone implement working_times intervention search run statistics submit reload feedback
requests_for_comments study_group_dashboard export_external_check export_external_confirm
only: MEMBER_ACTIONS + %i[clone implement working_times intervention statistics submit reload feedback
study_group_dashboard export_external_check export_external_confirm
external_user_statistics]
before_action :collect_set_and_unset_exercise_tags, only: MEMBER_ACTIONS
before_action :set_external_user_and_authorize, only: [:external_user_statistics]
Expand Down Expand Up @@ -43,7 +43,7 @@ def batch_update
authorize!
@exercises = params[:exercises].values.map do |exercise_params|
exercise = Exercise.find(exercise_params.delete(:id))
exercise.update(exercise_params)
exercise.update(exercise_params.permit(:public))
exercise
end
render(json: {exercises: @exercises})
Expand Down
2 changes: 2 additions & 0 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

APP_PATH = File.expand_path('../config/application', __dir__)
require_relative "../config/boot"
require "rails/commands"
6 changes: 4 additions & 2 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "fileutils"

# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)

def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
def system!(*)
system(*, exception: true)
end

FileUtils.chdir APP_ROOT do
Expand Down
18 changes: 6 additions & 12 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
module CodeOcean
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0
config.load_defaults 7.1

# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
# Common ones are `templates`, `generators`, or `middleware`, for example.
config.autoload_lib(ignore: %w[assets tasks templates generators middleware])

# Configuration for the application, engines, and railties goes here.
#
Expand All @@ -30,17 +35,6 @@ class Application < Rails::Application
# config.i18n.default_locale = :de
config.i18n.available_locales = %i[de en]

extra_paths = [
Rails.root.join('lib'),
]

# Add generators, they don't have a module structure that matches their directory structure.
extra_paths << Rails.root.join('lib/generators')

config.add_autoload_paths_to_load_path = false
config.autoload_paths += extra_paths
config.eager_load_paths += extra_paths

config.relative_url_root = ENV.fetch('RAILS_RELATIVE_URL_ROOT', '/').to_s

config.action_cable.mount_path = "#{ENV.fetch('RAILS_RELATIVE_URL_ROOT', '')}/cable"
Expand Down
Loading

0 comments on commit 38f3ad2

Please sign in to comment.