Update to Ruby 3.1 and Rails 7.

This commit is contained in:
Achim D. Brucker 2023-10-12 18:01:48 +01:00
parent a5a6032fa2
commit c25355399e
5 changed files with 204 additions and 152 deletions

11
Gemfile
View File

@ -7,9 +7,9 @@ end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.0' gem 'rails', '~> 7.0.Z'
# Use sqlite3 as the database for Active Record # Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.3.0' gem 'sqlite3', '~> 1.4.2'
# Use Puma as the app server # Use Puma as the app server
gem 'puma' gem 'puma'
# Use SCSS for stylesheets # Use SCSS for stylesheets
@ -56,5 +56,8 @@ gem 'bootsnap'
gem 'prawn' gem 'prawn'
gem 'prawn-table' gem 'prawn-table'
gem "rails-html-sanitizer", "= 1.0.3" gem "rails-html-sanitizer", "= 1.4.0"
gem "loofah", "= 2.0.3" gem "loofah", "= 2.16.0"
gem "mimemagic"
gem "matrix", "~> 0.4.2"

View File

@ -1,181 +1,225 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (5.2.2) actioncable (7.0.8)
actionpack (= 5.2.2) actionpack (= 7.0.8)
activesupport (= 7.0.8)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailer (5.2.2) actionmailbox (7.0.8)
actionpack (= 5.2.2) actionpack (= 7.0.8)
actionview (= 5.2.2) activejob (= 7.0.8)
activejob (= 5.2.2) activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
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)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (5.2.2) actionpack (7.0.8)
actionview (= 5.2.2) actionview (= 7.0.8)
activesupport (= 5.2.2) activesupport (= 7.0.8)
rack (~> 2.0) rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (5.2.2) actiontext (7.0.8)
activesupport (= 5.2.2) actionpack (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.8)
activesupport (= 7.0.8)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3) rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (5.2.2) activejob (7.0.8)
activesupport (= 5.2.2) activesupport (= 7.0.8)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (5.2.2) activemodel (7.0.8)
activesupport (= 5.2.2) activesupport (= 7.0.8)
activerecord (5.2.2) activerecord (7.0.8)
activemodel (= 5.2.2) activemodel (= 7.0.8)
activesupport (= 5.2.2) activesupport (= 7.0.8)
arel (>= 9.0) activestorage (7.0.8)
activestorage (5.2.2) actionpack (= 7.0.8)
actionpack (= 5.2.2) activejob (= 7.0.8)
activerecord (= 5.2.2) activerecord (= 7.0.8)
marcel (~> 0.3.1) activesupport (= 7.0.8)
activesupport (5.2.2) marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.8)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 1.6, < 2)
minitest (~> 5.1) minitest (>= 5.1)
tzinfo (~> 1.1) tzinfo (~> 2.0)
arel (9.0.0) bindex (0.8.1)
bindex (0.5.0) bootsnap (1.16.0)
bootsnap (1.3.2) msgpack (~> 1.2)
msgpack (~> 1.0) builder (3.2.4)
builder (3.2.3) byebug (11.1.3)
byebug (10.0.2) coffee-rails (5.0.0)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0) railties (>= 5.2.0)
coffee-script (2.4.1) coffee-script (2.4.1)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.12.2) coffee-script-source (1.12.2)
concurrent-ruby (1.1.4) concurrent-ruby (1.2.2)
erubi (1.8.0) crass (1.0.6)
execjs (2.7.0) date (3.3.3)
ffi (1.10.0) erubi (1.12.0)
globalid (0.4.2) execjs (2.9.1)
activesupport (>= 4.2.0) ffi (1.16.3)
i18n (1.5.3) globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
jbuilder (2.8.0) jbuilder (2.11.5)
activesupport (>= 4.2.0) actionview (>= 5.0.0)
multi_json (>= 1.2) activesupport (>= 5.0.0)
jquery-rails (4.3.3) jquery-rails (4.6.0)
rails-dom-testing (>= 1, < 3) rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0) railties (>= 4.2.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
listen (3.1.5) listen (3.8.0)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.10)
ruby_dep (~> 1.2) loofah (2.16.0)
loofah (2.0.3) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.8.1)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
marcel (0.3.3) net-imap
mimemagic (~> 0.3.2) net-pop
method_source (0.9.2) net-smtp
mimemagic (0.3.3) marcel (1.0.2)
mini_mime (1.0.1) matrix (0.4.2)
mini_portile2 (2.4.0) method_source (1.0.0)
minitest (5.11.3) mimemagic (0.4.3)
msgpack (1.2.6) nokogiri (~> 1)
multi_json (1.13.1) rake
nio4r (2.3.1) mini_mime (1.1.5)
nokogiri (1.10.1) minitest (5.20.0)
mini_portile2 (~> 2.4.0) msgpack (1.7.2)
pdf-core (0.7.0) net-imap (0.4.1)
prawn (2.2.2) date
pdf-core (~> 0.7.0) net-protocol
ttfunk (~> 1.5) net-pop (0.1.2)
net-protocol
net-protocol (0.2.1)
timeout
net-smtp (0.4.0)
net-protocol
nio4r (2.5.9)
nokogiri (1.15.4-x86_64-linux)
racc (~> 1.4)
pdf-core (0.9.0)
prawn (2.4.0)
pdf-core (~> 0.9.0)
ttfunk (~> 1.7)
prawn-table (0.2.2) prawn-table (0.2.2)
prawn (>= 1.3.0, < 3.0.0) prawn (>= 1.3.0, < 3.0.0)
puma (3.12.0) psych (5.1.1)
rack (2.0.6) stringio
rack-test (1.1.0) puma (6.4.0)
rack (>= 1.0, < 3) nio4r (~> 2.0)
rails (5.2.2) racc (1.7.1)
actioncable (= 5.2.2) rack (2.2.8)
actionmailer (= 5.2.2) rack-test (2.1.0)
actionpack (= 5.2.2) rack (>= 1.3)
actionview (= 5.2.2) rails (7.0.8)
activejob (= 5.2.2) actioncable (= 7.0.8)
activemodel (= 5.2.2) actionmailbox (= 7.0.8)
activerecord (= 5.2.2) actionmailer (= 7.0.8)
activestorage (= 5.2.2) actionpack (= 7.0.8)
activesupport (= 5.2.2) actiontext (= 7.0.8)
bundler (>= 1.3.0) actionview (= 7.0.8)
railties (= 5.2.2) activejob (= 7.0.8)
sprockets-rails (>= 2.0.0) activemodel (= 7.0.8)
rails-dom-testing (2.0.3) activerecord (= 7.0.8)
activesupport (>= 4.2.0) activestorage (= 7.0.8)
activesupport (= 7.0.8)
bundler (>= 1.15.0)
railties (= 7.0.8)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3) rails-html-sanitizer (1.4.0)
loofah (~> 2.0) loofah (~> 2.3)
railties (5.2.2) railties (7.0.8)
actionpack (= 5.2.2) actionpack (= 7.0.8)
activesupport (= 5.2.2) activesupport (= 7.0.8)
method_source method_source
rake (>= 0.8.7) rake (>= 12.2)
thor (>= 0.19.0, < 2.0) thor (~> 1.0)
rake (12.3.2) zeitwerk (~> 2.5)
rb-fsevent (0.10.3) rake (13.0.6)
rb-inotify (0.10.0) rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
rdoc (6.1.1) rdoc (6.5.0)
ruby_dep (1.5.0) psych (>= 4.0.0)
sass (3.7.3) sass-rails (6.0.0)
sass-listen (~> 4.0.0) sassc-rails (~> 2.1, >= 2.1.1)
sass-listen (4.0.0) sassc (2.4.0)
rb-fsevent (~> 0.9, >= 0.9.4) ffi (~> 1.9)
rb-inotify (~> 0.9, >= 0.9.7) sassc-rails (2.1.2)
sass-rails (5.0.7) railties (>= 4.0.0)
railties (>= 4.0.0, < 6) sassc (>= 2.0)
sass (~> 3.1) sprockets (> 3.0)
sprockets (>= 2.8, < 4.0) sprockets-rails
sprockets-rails (>= 2.0, < 4.0) tilt
tilt (>= 1.1, < 3) spring (4.1.1)
spring (2.0.2) spring-watcher-listen (2.1.0)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0) spring (>= 4)
sprockets (3.7.2) sprockets (4.2.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (>= 2.2.4, < 4)
sprockets-rails (3.2.1) sprockets-rails (3.4.2)
actionpack (>= 4.0) actionpack (>= 5.2)
activesupport (>= 4.0) activesupport (>= 5.2)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (1.3.13) sqlite3 (1.4.4)
thor (0.20.3) stringio (3.0.8)
thread_safe (0.3.6) thor (1.2.2)
tilt (2.0.9) tilt (2.3.0)
ttfunk (1.5.1) timeout (0.4.0)
turbolinks (5.2.0) ttfunk (1.7.0)
turbolinks (5.2.1)
turbolinks-source (~> 5.2) turbolinks-source (~> 5.2)
turbolinks-source (5.2.0) turbolinks-source (5.2.0)
tzinfo (1.2.5) tzinfo (2.0.6)
thread_safe (~> 0.1) concurrent-ruby (~> 1.0)
uglifier (4.1.20) uglifier (4.2.0)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
web-console (3.7.0) web-console (4.2.1)
actionview (>= 5.0) actionview (>= 6.0.0)
activemodel (>= 5.0) activemodel (>= 6.0.0)
bindex (>= 0.4.0) bindex (>= 0.4.0)
railties (>= 5.0) railties (>= 6.0.0)
websocket-driver (0.7.0) websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3) websocket-extensions (0.1.5)
zeitwerk (2.6.12)
PLATFORMS PLATFORMS
ruby x86_64-linux
DEPENDENCIES DEPENDENCIES
bootsnap bootsnap
@ -184,21 +228,23 @@ DEPENDENCIES
jbuilder jbuilder
jquery-rails jquery-rails
listen listen
loofah (= 2.0.3) loofah (= 2.16.0)
matrix (~> 0.4.2)
mimemagic
prawn prawn
prawn-table prawn-table
puma puma
rails (~> 5.2.0) rails (~> 7.0.Z)
rails-html-sanitizer (= 1.0.3) rails-html-sanitizer (= 1.4.0)
rdoc rdoc
sass-rails sass-rails
spring spring
spring-watcher-listen spring-watcher-listen
sqlite3 (~> 1.3.0) sqlite3 (~> 1.4.2)
turbolinks turbolinks
tzinfo-data tzinfo-data
uglifier uglifier
web-console web-console
BUNDLED WITH BUNDLED WITH
2.0.1 2.3.15

View File

@ -26,7 +26,7 @@ reasonable amount:
* [arachni (1.5.1)](https://github.com/Arachni/arachni) * [arachni (1.5.1)](https://github.com/Arachni/arachni)
* [zaproxy (OSWASP ZAP, 2.7.0)](https://github.com/zaproxy/zaproxy) * [zaproxy (OSWASP ZAP, 2.7.0)](https://github.com/zaproxy/zaproxy)
* [brakeman (4.2.1)](https://github.com/presidentbeef/brakeman) * [brakeman](https://github.com/presidentbeef/brakeman)
## Application Scenario ## Application Scenario
@ -58,7 +58,7 @@ You are Peter, a student and you can log in with `peter` as username and
### Dependencies ### Dependencies
* Ruby 2.5 and [bundler](https://github.com/bundler/bundler) * Ruby 3.1 (and Raild 7) and [bundler](https://github.com/bundler/bundler)
### Checkout ### Checkout
@ -106,6 +106,7 @@ Now, open your browser, go to <http://localhost:3000>, and start exploring!
* [Achim D. Brucker](https://www.brucker.ch/) * [Achim D. Brucker](https://www.brucker.ch/)
* [Michael Herzberg](https://www.mherzberg.de/) * [Michael Herzberg](https://www.mherzberg.de/)
* [Sakine Yalman](http://emps.exeter.ac.uk/computer-science/staff/sy359)
## License ## License

View File

@ -49,7 +49,7 @@ class UsersController < ApplicationController
@user = User.find_by params[:user].permit(:login, :secret_answer) @user = User.find_by params[:user].permit(:login, :secret_answer)
if @user if @user
if params[:user][:password] == params[:user][:password_confirmation] if params[:user][:password] == params[:user][:password_confirmation]
@user.update_attributes(:password => Digest::MD5.hexdigest(params[:user][:password])) @user.update(:password => Digest::MD5.hexdigest(params[:user][:password]))
@user.save @user.save
flash[:success] = "Password changed successfully!" flash[:success] = "Password changed successfully!"
redirect_to root_url redirect_to root_url

View File

@ -2,6 +2,7 @@ require_relative 'boot'
require 'rails/all' require 'rails/all'
Bundler.setup
# Require the gems listed in Gemfile, including any gems # Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production. # you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups) Bundler.require(*Rails.groups)
@ -9,9 +10,9 @@ Bundler.require(*Rails.groups)
module DVGM module DVGM
class Application < Rails::Application class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.0 config.load_defaults 7.0
config.active_record.sqlite3.represent_boolean_as_integer = true #config.active_record.sqlite3.represent_boolean_as_integer = true
# Settings in config/environments/* take precedence over those specified here. # Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers # Application configuration can go into files in config/initializers
@ -20,3 +21,4 @@ module DVGM
config.report_dir = Rails.root.join("public", "reports") config.report_dir = Rails.root.join("public", "reports")
end end
end end