Skip to content

Commit

Permalink
Merge pull request #2457 from UKGovernmentBEIS/chore/upgrade-to-rails…
Browse files Browse the repository at this point in the history
…-7.0

Upgrade to Rails 7.0
  • Loading branch information
mec authored Dec 18, 2024
2 parents 7a19658 + 4e0a1e3 commit 9d1e663
Show file tree
Hide file tree
Showing 19 changed files with 264 additions and 157 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- Theme colour has changed from blue to a black
- The date and time a user is deactivated is now stored
- Upgrade to Rails 7.0.8.7

## Release 157 - 2024-12-16

Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ gem "pry-rails"
gem "puma", "~> 6.5"
gem "pundit"
gem "rollbar"
gem "rails", "~> 6"
gem "rails", "~> 7.0"
gem "rack-attack"
gem "rollout"
gem "rollout-ui"
Expand All @@ -40,8 +40,8 @@ gem "sidekiq", "~> 7"
gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]
gem "wicked"
gem "strip_attributes"

gem "breadcrumbs_on_rails"
gem "sprockets-rails"

# Authentication
gem "devise"
Expand Down
137 changes: 72 additions & 65 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,65 +1,71 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.7.10)
actionpack (= 6.1.7.10)
activesupport (= 6.1.7.10)
actioncable (7.0.8.7)
actionpack (= 7.0.8.7)
activesupport (= 7.0.8.7)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.10)
actionpack (= 6.1.7.10)
activejob (= 6.1.7.10)
activerecord (= 6.1.7.10)
activestorage (= 6.1.7.10)
activesupport (= 6.1.7.10)
actionmailbox (7.0.8.7)
actionpack (= 7.0.8.7)
activejob (= 7.0.8.7)
activerecord (= 7.0.8.7)
activestorage (= 7.0.8.7)
activesupport (= 7.0.8.7)
mail (>= 2.7.1)
actionmailer (6.1.7.10)
actionpack (= 6.1.7.10)
actionview (= 6.1.7.10)
activejob (= 6.1.7.10)
activesupport (= 6.1.7.10)
net-imap
net-pop
net-smtp
actionmailer (7.0.8.7)
actionpack (= 7.0.8.7)
actionview (= 7.0.8.7)
activejob (= 7.0.8.7)
activesupport (= 7.0.8.7)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (6.1.7.10)
actionview (= 6.1.7.10)
activesupport (= 6.1.7.10)
rack (~> 2.0, >= 2.0.9)
actionpack (7.0.8.7)
actionview (= 7.0.8.7)
activesupport (= 7.0.8.7)
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.10)
actionpack (= 6.1.7.10)
activerecord (= 6.1.7.10)
activestorage (= 6.1.7.10)
activesupport (= 6.1.7.10)
actiontext (7.0.8.7)
actionpack (= 7.0.8.7)
activerecord (= 7.0.8.7)
activestorage (= 7.0.8.7)
activesupport (= 7.0.8.7)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (6.1.7.10)
activesupport (= 6.1.7.10)
actionview (7.0.8.7)
activesupport (= 7.0.8.7)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.7.10)
activesupport (= 6.1.7.10)
activejob (7.0.8.7)
activesupport (= 7.0.8.7)
globalid (>= 0.3.6)
activemodel (6.1.7.10)
activesupport (= 6.1.7.10)
activerecord (6.1.7.10)
activemodel (= 6.1.7.10)
activesupport (= 6.1.7.10)
activestorage (6.1.7.10)
actionpack (= 6.1.7.10)
activejob (= 6.1.7.10)
activerecord (= 6.1.7.10)
activesupport (= 6.1.7.10)
activemodel (7.0.8.7)
activesupport (= 7.0.8.7)
activerecord (7.0.8.7)
activemodel (= 7.0.8.7)
activesupport (= 7.0.8.7)
activestorage (7.0.8.7)
actionpack (= 7.0.8.7)
activejob (= 7.0.8.7)
activerecord (= 7.0.8.7)
activesupport (= 7.0.8.7)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7.10)
activesupport (7.0.8.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
acts_as_tree (2.9.1)
activerecord (>= 3.0.0)
addressable (2.8.6)
Expand Down Expand Up @@ -137,7 +143,7 @@ GEM
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.4.0)
date (3.4.1)
debug_inspector (1.2.0)
devise (4.9.4)
bcrypt (~> 3.0)
Expand Down Expand Up @@ -275,7 +281,7 @@ GEM
mustermann (2.0.2)
ruby2_keywords (~> 0.0.1)
nanoid (2.0.0)
net-imap (0.5.1)
net-imap (0.5.2)
date
net-protocol
net-pop (0.1.2)
Expand Down Expand Up @@ -331,21 +337,20 @@ GEM
rack (< 3)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.1.7.10)
actioncable (= 6.1.7.10)
actionmailbox (= 6.1.7.10)
actionmailer (= 6.1.7.10)
actionpack (= 6.1.7.10)
actiontext (= 6.1.7.10)
actionview (= 6.1.7.10)
activejob (= 6.1.7.10)
activemodel (= 6.1.7.10)
activerecord (= 6.1.7.10)
activestorage (= 6.1.7.10)
activesupport (= 6.1.7.10)
rails (7.0.8.7)
actioncable (= 7.0.8.7)
actionmailbox (= 7.0.8.7)
actionmailer (= 7.0.8.7)
actionpack (= 7.0.8.7)
actiontext (= 7.0.8.7)
actionview (= 7.0.8.7)
activejob (= 7.0.8.7)
activemodel (= 7.0.8.7)
activerecord (= 7.0.8.7)
activestorage (= 7.0.8.7)
activesupport (= 7.0.8.7)
bundler (>= 1.15.0)
railties (= 6.1.7.10)
sprockets-rails (>= 2.0.0)
railties (= 7.0.8.7)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -361,12 +366,13 @@ GEM
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
rails_layout (1.0.42)
railties (6.1.7.10)
actionpack (= 6.1.7.10)
activesupport (= 6.1.7.10)
railties (7.0.8.7)
actionpack (= 7.0.8.7)
activesupport (= 7.0.8.7)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.2.1)
rb-fsevent (0.11.2)
Expand Down Expand Up @@ -415,15 +421,15 @@ GEM
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (6.1.5)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-rails (7.1.0)
actionpack (>= 7.0)
activesupport (>= 7.0)
railties (>= 7.0)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.1)
rspec-support (3.13.2)
rubocop (1.69.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
Expand Down Expand Up @@ -506,7 +512,7 @@ GEM
unicode-display_width (>= 1.1.1, < 3)
thor (1.3.2)
tilt (2.0.11)
timeout (0.4.2)
timeout (0.4.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.6.0)
Expand Down Expand Up @@ -587,7 +593,7 @@ DEPENDENCIES
pundit
pundit-matchers (~> 3.1.2)
rack-attack
rails (~> 6)
rails (~> 7.0)
rails-controller-testing
rails_layout
redis (~> 5)
Expand All @@ -603,6 +609,7 @@ DEPENDENCIES
sidekiq (~> 7)
simplecov (~> 0.22.0)
simplecov-lcov (~> 0.8.0)
sprockets-rails
standard
strip_attributes
tzinfo-data
Expand Down
File renamed without changes.
6 changes: 2 additions & 4 deletions app/models/org_participation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ class OrgParticipation < ApplicationRecord
belongs_to :activity
belongs_to :organisation

attribute :role, :string, default: "implementing"

enum role: {
enum :role, {
partner_organisation: 0,
matched_effort_provider: 1,
external_income_provider: 2,
implementing: 3,
service_owner: 99
}
}, default: :implementing

scope :implementing, -> { where(role: :implementing) }

Expand Down
21 changes: 9 additions & 12 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
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 ==")
Expand All @@ -13,24 +13,21 @@ 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')

# Install JavaScript dependencies
# system! 'bin/yarn'
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')
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
# unless File.exist?("config/database.yml")
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
# 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
32 changes: 19 additions & 13 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

require_relative "boot"

# Include each railties manually, excluding `active_storage/engine` and `action_mailbox`
%w[
active_record/railtie
action_controller/railtie
action_view/railtie
action_mailer/railtie
active_job/railtie
rails/test_unit/railtie
sprockets/railtie
].each do |railtie|
require railtie
rescue LoadError
end
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
# require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
# require "action_mailbox/engine"
# require "action_text/engine"
require "action_view/railtie"
# require "action_cable/engine"
require "rails/test_unit/railtie"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Expand Down Expand Up @@ -76,5 +76,11 @@ class Application < Rails::Application
config.action_dispatch.default_headers["X-XSS-Protection"] = "0"

config.host_authorization = {exclude: ->(request) { request.path =~ /health(_|-)check/ }}

# configure default form builder
config.action_view.default_form_builder = "RodaFormBuilder::FormBuilder"

# Don't use XHR when submitting forms
Rails.application.config.action_view.form_with_generates_remote_forms = false
end
end
5 changes: 4 additions & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
# Show full error reports.
config.consider_all_requests_local = true

# Enable server timing
config.server_timing = true

# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join("tmp", "caching-dev.txt").exist?
if Rails.root.join("tmp/caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true

Expand Down
13 changes: 6 additions & 7 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

config.cache_classes = false
# Turn false under Spring and add config.action_view.cache_template_loading = true.
config.cache_classes = true

config.action_view.cache_template_loading = true

# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Eager loading loads your whole application. When running a single test locally,
# this probably isn't necessary. It's a good idea to do in a continuous integration
# system, or in some way before deploying your code.
config.eager_load = ENV["CI"].present?

# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
Expand Down
Loading

0 comments on commit 9d1e663

Please sign in to comment.