From 0592d77949210e3053f15e778aa8876d1ca10a0a Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Thu, 10 Feb 2022 16:53:26 +0100 Subject: [PATCH 01/29] Install bundler and foreman for Ruby 3.1 --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 85d2a80a..276b87a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ FROM registry.opensuse.org/opensuse/infrastructure/dale/containers/osem/base:latest ARG CONTAINER_USERID +ENV NOKOGIRI_USE_SYSTEM_LIBRARIES=1 # Configure our user RUN usermod -u $CONTAINER_USERID osem @@ -12,13 +13,15 @@ COPY Gemfile /osem/ COPY Gemfile.lock /osem/ RUN chown -R osem /osem -# Add our files +# Install bundler & foreman +RUN gem.ruby3.1 install bundler -v "$(grep -A 1 "BUNDLED WITH" /osem/Gemfile.lock | tail -n 1)"; \ + gem.ruby3.1 install foreman + +# Continue as user USER osem WORKDIR /osem/ -# Install bundler & foreman -RUN sudo gem install bundler:1.17.3 foreman # Install our bundle -RUN export NOKOGIRI_USE_SYSTEM_LIBRARIES=1; bundle install --jobs=3 --retry=3 +RUN bundle install --jobs=3 --retry=3 CMD ["foreman", "start"] From 28caa143e8a4b4518c7d63b990260c57c5e58331 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Thu, 10 Feb 2022 16:57:53 +0100 Subject: [PATCH 02/29] Switch bundle to Ruby 3.1 and next to Rails 7 --- .ruby-version | 2 +- Gemfile | 4 +- Gemfile.lock | 55 +++++----- Gemfile.next.lock | 259 ++++++++++++++++++++++++++-------------------- 4 files changed, 176 insertions(+), 144 deletions(-) diff --git a/.ruby-version b/.ruby-version index 30f69e8c..fd2a0186 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.5.9 +3.1.0 diff --git a/Gemfile b/Gemfile index 9c966d32..991df83d 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ end source 'https://rubygems.org' -ruby ENV['OSEM_RUBY_VERSION'] || '2.5.9' +ruby ENV['OSEM_RUBY_VERSION'] || '3.1.0' # rails-assets requires >= 1.8.4 if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.8.4') @@ -14,7 +14,7 @@ end # as web framework if next? - gem 'rails', '~> 6' + gem 'rails', '~> 7' else gem 'rails', '~> 5.2' end diff --git a/Gemfile.lock b/Gemfile.lock index 680e8037..2e84b18d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,29 @@ +GEM + remote: https://rails-assets.org/ + specs: + rails-assets-bootstrap (3.3.6) + rails-assets-jquery (>= 1.9.1, < 3) + rails-assets-bootstrap-markdown (2.10.0) + rails-assets-bootstrap (~> 3) + rails-assets-bootstrap-select (1.13.3) + rails-assets-bootstrap (>= 3.0.0) + rails-assets-jquery (>= 1.9.1, < 4) + rails-assets-date.format (1.2.3) + rails-assets-holderjs (2.9.6) + rails-assets-jquery (2.2.4) + rails-assets-jquery-smooth-scroll (2.2.0) + rails-assets-jquery (>= 1.7.0) + rails-assets-markdown (0.5.0) + rails-assets-momentjs (2.22.2) + rails-assets-spectrum (1.8.0) + rails-assets-jquery (>= 1.7.2) + rails-assets-tinycolor (1.4.1) + rails-assets-to-markdown (3.1.1) + rails-assets-trianglify (1.2.0) + rails-assets-waypoints (4.0.1) + GEM remote: https://rubygems.org/ - remote: https://rails-assets.org/ specs: Ascii85 (1.1.0) actioncable (5.2.6) @@ -197,7 +220,7 @@ GEM ffi (1.15.4) font-awesome-rails (4.7.0.7) railties (>= 3.2, < 7) - formatador (0.3.0) + formatador (1.1.0) formtastic (3.1.5) actionpack (>= 3.2.13) formtastic-bootstrap (3.1.1) @@ -285,7 +308,7 @@ GEM actionmailer (>= 3.2) letter_opener (~> 1.0) railties (>= 3.2) - listen (3.7.0) + listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) loofah (2.12.0) @@ -423,26 +446,6 @@ GEM bundler (>= 1.3.0) railties (= 5.2.6) sprockets-rails (>= 2.0.0) - rails-assets-bootstrap (3.3.6) - rails-assets-jquery (>= 1.9.1, < 3) - rails-assets-bootstrap-markdown (2.10.0) - rails-assets-bootstrap (~> 3) - rails-assets-bootstrap-select (1.13.3) - rails-assets-bootstrap (>= 3.0.0) - rails-assets-jquery (>= 1.9.1, < 4) - rails-assets-date.format (1.2.3) - rails-assets-holderjs (2.9.6) - rails-assets-jquery (2.2.4) - rails-assets-jquery-smooth-scroll (2.2.0) - rails-assets-jquery (>= 1.7.0) - rails-assets-markdown (0.5.0) - rails-assets-momentjs (2.22.2) - rails-assets-spectrum (1.8.0) - rails-assets-jquery (>= 1.7.2) - rails-assets-tinycolor (1.4.1) - rails-assets-to-markdown (3.1.1) - rails-assets-trianglify (1.2.0) - rails-assets-waypoints (4.0.1) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -581,7 +584,7 @@ GEM activesupport (>= 4.2.0) sort_alphabetical (1.1.0) unicode_utils (>= 1.2.2) - spring (2.1.1) + spring (4.0.0) spring-commands-rspec (1.0.4) spring (>= 0.9.1) sprockets (3.7.2) @@ -762,7 +765,7 @@ DEPENDENCIES whenever RUBY VERSION - ruby 2.5.9p229 + ruby 3.1.0 BUNDLED WITH - 1.17.3 + 2.3.3 diff --git a/Gemfile.next.lock b/Gemfile.next.lock index fe03953a..61837968 100644 --- a/Gemfile.next.lock +++ b/Gemfile.next.lock @@ -1,76 +1,105 @@ GEM - remote: https://rubygems.org/ remote: https://rails-assets.org/ + specs: + rails-assets-bootstrap (3.4.1) + rails-assets-jquery (>= 1.9.1, < 4) + rails-assets-bootstrap-markdown (2.10.0) + rails-assets-bootstrap (~> 3) + rails-assets-bootstrap-select (1.13.10) + rails-assets-bootstrap (>= 3.0.0) + rails-assets-jquery (>= 1.9.1, < 4) + rails-assets-date.format (1.2.3) + rails-assets-holderjs (2.9.6) + rails-assets-jquery (3.4.1) + rails-assets-jquery-smooth-scroll (2.2.0) + rails-assets-jquery (>= 1.7.0) + rails-assets-markdown (0.5.0) + rails-assets-momentjs (2.22.2) + rails-assets-spectrum (1.8.0) + rails-assets-jquery (>= 1.7.2) + rails-assets-tinycolor (1.4.1) + rails-assets-to-markdown (3.1.1) + rails-assets-trianglify (1.2.0) + rails-assets-waypoints (4.0.1) + +GEM + remote: https://rubygems.org/ specs: Ascii85 (1.1.0) - actioncable (6.1.4) - actionpack (= 6.1.4) - activesupport (= 6.1.4) + actioncable (7.0.1) + actionpack (= 7.0.1) + activesupport (= 7.0.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.4) - actionpack (= 6.1.4) - activejob (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) + actionmailbox (7.0.1) + actionpack (= 7.0.1) + activejob (= 7.0.1) + activerecord (= 7.0.1) + activestorage (= 7.0.1) + activesupport (= 7.0.1) mail (>= 2.7.1) - actionmailer (6.1.4) - actionpack (= 6.1.4) - actionview (= 6.1.4) - activejob (= 6.1.4) - activesupport (= 6.1.4) + net-imap + net-pop + net-smtp + actionmailer (7.0.1) + actionpack (= 7.0.1) + actionview (= 7.0.1) + activejob (= 7.0.1) + activesupport (= 7.0.1) mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp rails-dom-testing (~> 2.0) - actionpack (6.1.4) - actionview (= 6.1.4) - activesupport (= 6.1.4) - rack (~> 2.0, >= 2.0.9) + actionpack (7.0.1) + actionview (= 7.0.1) + activesupport (= 7.0.1) + rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.4) - actionpack (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) + actiontext (7.0.1) + actionpack (= 7.0.1) + activerecord (= 7.0.1) + activestorage (= 7.0.1) + activesupport (= 7.0.1) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.4) - activesupport (= 6.1.4) + actionview (7.0.1) + activesupport (= 7.0.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - active_model_serializers (0.10.12) - actionpack (>= 4.1, < 6.2) - activemodel (>= 4.1, < 6.2) + active_model_serializers (0.10.13) + actionpack (>= 4.1, < 7.1) + activemodel (>= 4.1, < 7.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (6.1.4) - activesupport (= 6.1.4) + activejob (7.0.1) + activesupport (= 7.0.1) globalid (>= 0.3.6) - activemodel (6.1.4) - activesupport (= 6.1.4) - activerecord (6.1.4) - activemodel (= 6.1.4) - activesupport (= 6.1.4) - activestorage (6.1.4) - actionpack (= 6.1.4) - activejob (= 6.1.4) - activerecord (= 6.1.4) - activesupport (= 6.1.4) - marcel (~> 1.0.0) + activemodel (7.0.1) + activesupport (= 7.0.1) + activerecord (7.0.1) + activemodel (= 7.0.1) + activesupport (= 7.0.1) + activestorage (7.0.1) + actionpack (= 7.0.1) + activejob (= 7.0.1) + activerecord (= 7.0.1) + activesupport (= 7.0.1) + marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.4) + activesupport (7.0.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) - acts_as_commentable_with_threading (2.0.1) - activerecord (>= 4.0) - activesupport (>= 4.0) - awesome_nested_set (>= 3.0) + acts_as_commentable_with_threading (1.2.0) + activerecord (>= 3.0) + activesupport (>= 3.0) + awesome_nested_set (>= 2.0) acts_as_list (1.0.4) activerecord (>= 4.2) addressable (2.8.0) @@ -83,8 +112,8 @@ GEM ast (2.4.2) autoprefixer-rails (10.3.1.0) execjs (~> 2) - awesome_nested_set (3.4.0) - activerecord (>= 4.0.0, < 7.0) + awesome_nested_set (2.1.6) + activerecord (>= 3.0.0) aws_cf_signer (0.1.3) bcrypt (3.1.16) bindex (0.8.1) @@ -159,10 +188,10 @@ GEM activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) - delayed_job (4.1.9) - activesupport (>= 3.0, < 6.2) - delayed_job_active_record (4.1.6) - activerecord (>= 3.0, < 6.2) + delayed_job (4.1.10) + activesupport (>= 3.0, < 8.0) + delayed_job_active_record (4.1.7) + activerecord (>= 3.0, < 8.0) delayed_job (>= 3.0, < 5) devise (4.8.0) bcrypt (~> 3.0) @@ -173,6 +202,7 @@ GEM devise_ichain_authenticatable (0.3.2) devise (>= 2.2) diff-lcs (1.4.4) + digest (3.1.0) docile (1.4.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) @@ -212,8 +242,8 @@ GEM fastimage (2.2.5) feature (1.4.0) ffi (1.15.3) - font-awesome-rails (4.7.0.7) - railties (>= 3.2, < 7) + font-awesome-rails (4.7.0.8) + railties (>= 3.2, < 8.0) formatador (0.3.0) formtastic (3.1.5) actionpack (>= 3.2.13) @@ -221,7 +251,7 @@ GEM formtastic (>= 3.0) geckodriver-helper (0.24.0) archive-zip (~> 0.7) - globalid (0.5.2) + globalid (1.0.0) activesupport (>= 5.0) gravtastic (3.2.6) guard (2.18.0) @@ -265,7 +295,7 @@ GEM http-accept (1.7.0) http-cookie (1.0.4) domain_name (~> 0.5) - i18n (1.8.10) + i18n (1.9.1) concurrent-ruby (~> 1.0) i18n_data (0.13.0) icalendar (2.7.1) @@ -275,6 +305,7 @@ GEM mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) io-like (0.3.1) + io-wait (0.2.1) iso-639 (0.3.5) jquery-datatables-rails (3.4.0) actionpack (>= 3.1) @@ -298,14 +329,15 @@ GEM rails (>= 4.2.0) letter_opener (1.7.0) launchy (~> 2.2) - letter_opener_web (1.4.0) - actionmailer (>= 3.2) - letter_opener (~> 1.0) - railties (>= 3.2) + letter_opener_web (2.0.0) + actionmailer (>= 5.2) + letter_opener (~> 1.7) + railties (>= 5.2) + rexml listen (3.6.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.12.0) + loofah (2.13.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.2.8) @@ -320,9 +352,9 @@ GEM open4 (~> 1.3.4) rake mini_magick (4.11.0) - mini_mime (1.1.0) - mini_portile2 (2.6.1) - minitest (5.14.4) + mini_mime (1.1.2) + mini_portile2 (2.7.1) + minitest (5.15.0) momentjs-rails (2.20.1) railties (>= 3.1) monetize (1.9.4) @@ -339,12 +371,27 @@ GEM multipart-post (2.1.1) mysql2 (0.5.3) nenv (0.3.0) + net-imap (0.2.3) + digest + net-protocol + strscan + net-pop (0.1.1) + digest + net-protocol + timeout + net-protocol (0.1.2) + io-wait + timeout + net-smtp (0.3.1) + digest + net-protocol + timeout netrc (0.11.0) next_rails (1.0.4) colorize (>= 0.8.1) nio4r (2.5.8) - nokogiri (1.12.3) - mini_portile2 (~> 2.6.1) + nokogiri (1.13.1) + mini_portile2 (~> 2.7.0) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) @@ -418,7 +465,7 @@ GEM public_suffix (4.0.6) puma (4.3.8) nio4r (~> 2.0) - racc (1.5.2) + racc (1.6.0) rack (2.2.3) rack-openid (1.4.2) rack (>= 1.1.0) @@ -427,41 +474,20 @@ GEM rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.1.4) - actioncable (= 6.1.4) - actionmailbox (= 6.1.4) - actionmailer (= 6.1.4) - actionpack (= 6.1.4) - actiontext (= 6.1.4) - actionview (= 6.1.4) - activejob (= 6.1.4) - activemodel (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) + rails (7.0.1) + actioncable (= 7.0.1) + actionmailbox (= 7.0.1) + actionmailer (= 7.0.1) + actionpack (= 7.0.1) + actiontext (= 7.0.1) + actionview (= 7.0.1) + activejob (= 7.0.1) + activemodel (= 7.0.1) + activerecord (= 7.0.1) + activestorage (= 7.0.1) + activesupport (= 7.0.1) bundler (>= 1.15.0) - railties (= 6.1.4) - sprockets-rails (>= 2.0.0) - rails-assets-bootstrap (3.4.1) - rails-assets-jquery (>= 1.9.1, < 4) - rails-assets-bootstrap-markdown (2.10.0) - rails-assets-bootstrap (~> 3) - rails-assets-bootstrap-select (1.13.10) - rails-assets-bootstrap (>= 3.0.0) - rails-assets-jquery (>= 1.9.1, < 4) - rails-assets-date.format (1.2.3) - rails-assets-holderjs (2.9.6) - rails-assets-jquery (3.4.1) - rails-assets-jquery-smooth-scroll (2.2.0) - rails-assets-jquery (>= 1.7.0) - rails-assets-markdown (0.5.0) - rails-assets-momentjs (2.22.2) - rails-assets-spectrum (1.8.0) - rails-assets-jquery (>= 1.7.2) - rails-assets-tinycolor (1.4.1) - rails-assets-to-markdown (3.1.1) - rails-assets-trianglify (1.2.0) - rails-assets-waypoints (4.0.1) + railties (= 7.0.1) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -469,17 +495,18 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) + rails-html-sanitizer (1.4.2) loofah (~> 2.3) - rails-i18n (6.0.0) + rails-i18n (7.0.1) i18n (>= 0.7, < 2) - railties (>= 6.0.0, < 7) - railties (6.1.4) - actionpack (= 6.1.4) - activesupport (= 6.1.4) + railties (>= 6.0.0, < 8) + railties (7.0.1) + actionpack (= 7.0.1) + activesupport (= 7.0.1) method_source - rake (>= 0.13) + rake (>= 12.2) thor (~> 1.0) + zeitwerk (~> 2.5) rainbow (3.0.0) rake (13.0.6) rb-fsevent (0.11.0) @@ -612,11 +639,13 @@ GEM dante (>= 0.2.0) multi_json (~> 1.0) stripe (> 5, < 6) + strscan (3.0.1) sysexits (1.2.0) temple (0.8.2) - thor (1.1.0) + thor (1.2.1) tilt (2.0.10) timecop (0.9.4) + timeout (0.2.0) transitions (1.2.1) ttfunk (1.7.0) turbolinks (5.2.1) @@ -655,7 +684,7 @@ GEM chronic (>= 0.6.3) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.4.2) + zeitwerk (2.5.4) PLATFORMS ruby @@ -728,7 +757,7 @@ DEPENDENCIES prawn-qrcode prawn-rails puma (~> 4.3) - rails (~> 6) + rails (~> 7) rails-assets-bootstrap-markdown! rails-assets-bootstrap-select! rails-assets-date.format! @@ -776,7 +805,7 @@ DEPENDENCIES whenever RUBY VERSION - ruby 2.5.9p229 + ruby 3.1.0 BUNDLED WITH - 1.17.3 + 2.3.3 From 5b698f9a4aaf85fa2898f74243855660a412c6e7 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Thu, 10 Feb 2022 17:34:34 +0100 Subject: [PATCH 03/29] Drop guard/spring No developer left using this... --- Gemfile | 6 +---- Gemfile.lock | 37 -------------------------- Gemfile.next.lock | 40 ---------------------------- Guardfile | 66 ----------------------------------------------- bin/rake | 1 - bin/spring | 14 ---------- config/spring.rb | 6 ----- 7 files changed, 1 insertion(+), 169 deletions(-) delete mode 100644 Guardfile delete mode 100755 bin/spring delete mode 100644 config/spring.rb diff --git a/Gemfile b/Gemfile index 991df83d..11eeabbe 100644 --- a/Gemfile +++ b/Gemfile @@ -228,16 +228,12 @@ gem 'dalli' gem 'icalendar' -# Use guard and spring for testing in development group :development do - # to launch specs when files are modified - gem 'guard-rspec' - gem 'haml_lint' - gem 'spring-commands-rspec' # for static code analisys gem 'rubocop', require: false gem 'rubocop-rspec', require: false gem 'rubocop-rails', require: false + gem 'haml_lint' # to open mails gem 'letter_opener' gem 'letter_opener_web' diff --git a/Gemfile.lock b/Gemfile.lock index 2e84b18d..253970b7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -142,7 +142,6 @@ GEM aws_cf_signer rest-client (>= 2.0.0) cocoon (1.2.15) - coderay (1.1.3) colorize (0.8.1) concurrent-ruby (1.1.9) countable-rails (0.0.1) @@ -220,7 +219,6 @@ GEM ffi (1.15.4) font-awesome-rails (4.7.0.7) railties (>= 3.2, < 7) - formatador (1.1.0) formtastic (3.1.5) actionpack (>= 3.2.13) formtastic-bootstrap (3.1.1) @@ -230,20 +228,6 @@ GEM globalid (0.4.2) activesupport (>= 4.2.0) gravtastic (3.2.6) - guard (2.18.0) - formatador (>= 0.2.4) - listen (>= 2.7, < 4.0) - lumberjack (>= 1.0.12, < 2.0) - nenv (~> 0.1) - notiffany (~> 0.0) - pry (>= 0.13.0) - shellany (~> 0.0) - thor (>= 0.18.1) - guard-compat (1.2.1) - guard-rspec (4.7.3) - guard (~> 2.1) - guard-compat (~> 1.1) - rspec (>= 2.99.0, < 4.0) haml (5.2.2) temple (>= 0.8.0) tilt @@ -308,13 +292,9 @@ GEM actionmailer (>= 3.2) letter_opener (~> 1.0) railties (>= 3.2) - listen (3.7.1) - rb-fsevent (~> 0.10, >= 0.10.3) - rb-inotify (~> 0.9, >= 0.9.10) loofah (2.12.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - lumberjack (1.2.8) mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.1) @@ -344,7 +324,6 @@ GEM multi_xml (0.6.0) multipart-post (2.1.1) mysql2 (0.5.3) - nenv (0.3.0) netrc (0.11.0) next_rails (1.0.4) colorize (>= 0.8.1) @@ -352,9 +331,6 @@ GEM nokogiri (1.12.5) mini_portile2 (~> 2.6.1) racc (~> 1.4) - notiffany (0.1.3) - nenv (~> 0.1) - shellany (~> 0.0) oauth2 (1.4.7) faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) @@ -418,9 +394,6 @@ GEM prawn-table prawn-table (0.2.2) prawn (>= 1.3.0, < 3.0.0) - pry (0.14.1) - coderay (~> 1.1) - method_source (~> 1.0) public_suffix (4.0.6) puma (4.3.9) nio4r (~> 2.0) @@ -489,10 +462,6 @@ GEM chunky_png (~> 1.0) rqrcode_core (~> 1.0) rqrcode_core (1.2.0) - rspec (3.6.0) - rspec-core (~> 3.6.0) - rspec-expectations (~> 3.6.0) - rspec-mocks (~> 3.6.0) rspec-activemodel-mocks (1.1.0) activemodel (>= 3.0) activesupport (>= 3.0) @@ -566,7 +535,6 @@ GEM concurrent-ruby faraday sexp_processor (4.15.3) - shellany (0.0.1) shoulda-matchers (4.5.1) activesupport (>= 4.2.0) simplecov (0.21.2) @@ -584,9 +552,6 @@ GEM activesupport (>= 4.2.0) sort_alphabetical (1.1.0) unicode_utils (>= 1.2.2) - spring (4.0.0) - spring-commands-rspec (1.0.4) - spring (>= 0.9.1) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -686,7 +651,6 @@ DEPENDENCIES formtastic-bootstrap geckodriver-helper gravtastic - guard-rspec haml-rails haml_lint icalendar @@ -749,7 +713,6 @@ DEPENDENCIES shoulda-matchers simplecov-cobertura skylight - spring-commands-rspec sprockets-rails sqlite3 stripe diff --git a/Gemfile.next.lock b/Gemfile.next.lock index 61837968..8a823de5 100644 --- a/Gemfile.next.lock +++ b/Gemfile.next.lock @@ -165,7 +165,6 @@ GEM aws_cf_signer rest-client (>= 2.0.0) cocoon (1.2.15) - coderay (1.1.3) colorize (0.8.1) concurrent-ruby (1.1.9) countable-rails (0.0.1) @@ -244,7 +243,6 @@ GEM ffi (1.15.3) font-awesome-rails (4.7.0.8) railties (>= 3.2, < 8.0) - formatador (0.3.0) formtastic (3.1.5) actionpack (>= 3.2.13) formtastic-bootstrap (3.1.1) @@ -254,20 +252,6 @@ GEM globalid (1.0.0) activesupport (>= 5.0) gravtastic (3.2.6) - guard (2.18.0) - formatador (>= 0.2.4) - listen (>= 2.7, < 4.0) - lumberjack (>= 1.0.12, < 2.0) - nenv (~> 0.1) - notiffany (~> 0.0) - pry (>= 0.13.0) - shellany (~> 0.0) - thor (>= 0.18.1) - guard-compat (1.2.1) - guard-rspec (4.7.3) - guard (~> 2.1) - guard-compat (~> 1.1) - rspec (>= 2.99.0, < 4.0) haml (5.2.2) temple (>= 0.8.0) tilt @@ -334,13 +318,9 @@ GEM letter_opener (~> 1.7) railties (>= 5.2) rexml - listen (3.6.0) - rb-fsevent (~> 0.10, >= 0.10.3) - rb-inotify (~> 0.9, >= 0.9.10) loofah (2.13.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - lumberjack (1.2.8) mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.1) @@ -370,7 +350,6 @@ GEM multi_xml (0.6.0) multipart-post (2.1.1) mysql2 (0.5.3) - nenv (0.3.0) net-imap (0.2.3) digest net-protocol @@ -393,9 +372,6 @@ GEM nokogiri (1.13.1) mini_portile2 (~> 2.7.0) racc (~> 1.4) - notiffany (0.1.3) - nenv (~> 0.1) - shellany (~> 0.0) oauth2 (1.4.7) faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) @@ -459,9 +435,6 @@ GEM prawn-table prawn-table (0.2.2) prawn (>= 1.3.0, < 3.0.0) - pry (0.14.1) - coderay (~> 1.1) - method_source (~> 1.0) public_suffix (4.0.6) puma (4.3.8) nio4r (~> 2.0) @@ -509,9 +482,6 @@ GEM zeitwerk (~> 2.5) rainbow (3.0.0) rake (13.0.6) - rb-fsevent (0.11.0) - rb-inotify (0.10.1) - ffi (~> 1.0) recaptcha (5.8.1) json redcarpet (3.5.1) @@ -532,10 +502,6 @@ GEM chunky_png (~> 1.0) rqrcode_core (~> 1.0) rqrcode_core (1.1.0) - rspec (3.10.0) - rspec-core (~> 3.10.0) - rspec-expectations (~> 3.10.0) - rspec-mocks (~> 3.10.0) rspec-activemodel-mocks (1.1.0) activemodel (>= 3.0) activesupport (>= 3.0) @@ -606,7 +572,6 @@ GEM concurrent-ruby faraday sexp_processor (4.15.3) - shellany (0.0.1) shoulda-matchers (4.5.1) activesupport (>= 4.2.0) simplecov (0.21.2) @@ -622,9 +587,6 @@ GEM activesupport (>= 5.2.0) sort_alphabetical (1.1.0) unicode_utils (>= 1.2.2) - spring (2.1.1) - spring-commands-rspec (1.0.4) - spring (>= 0.9.1) sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -726,7 +688,6 @@ DEPENDENCIES formtastic-bootstrap geckodriver-helper gravtastic - guard-rspec haml-rails haml_lint icalendar @@ -789,7 +750,6 @@ DEPENDENCIES shoulda-matchers simplecov-cobertura skylight - spring-commands-rspec sprockets-rails sqlite3 stripe diff --git a/Guardfile b/Guardfile deleted file mode 100644 index ba8f6520..00000000 --- a/Guardfile +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/ruby -# frozen_string_literal: true - -# -# More info at https://github.com/guard/guard#readme - -guard_opts = { - all_on_start: true, - all_after_pass: true, - cmd: 'spring rspec' -} - -def model_specs ; 'spec/models' end - -def model_spec(model) - "spec/models/#{model}_spec.rb" -end - -def all_testunit_tests - [ - model_tests, - controller_tests, - helper_tests, - integration_tests, - ] -end - -def all_specs - [ - model_specs, - ] -end - -def startup_guards - watch(%r{^Gemfile$}) { yield } - watch(%r{^Gemfile.lock$}) { yield } - watch(%r{^config/routes.rb$}) { yield } - watch(%r{^config/application\.rb$}) { yield } - watch(%r{^config/environment\.rb$}) { yield } - watch(%r{^config/environments/.+\.rb$}) { yield } - watch(%r{^config/initializers/.+\.rb$}) { yield } - watch(%r{^db/schema\.rb$}) { yield } - watch(%r{^spec/spec_helper\.rb$}) { yield } -end - -def rspec_guards - watch(%r{^spec/factories/.+\.rb$}) { all_specs } - watch(%r{^spec/.+_spec\.rb$}) - watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } -end - -group :rspec do - guard 'rspec', guard_opts do - #startup_guards { all_specs } - rspec_guards - #all_specs - end -end - -# group :bundler do -# guard 'bundler' do -# watch('Gemfile') -# # Uncomment next line if Gemfile contain `gemspec' command -# # watch(/^.+\.gemspec/) -# end -# end diff --git a/bin/rake b/bin/rake index 31bcf935..17240489 100755 --- a/bin/rake +++ b/bin/rake @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -load File.expand_path('spring', __dir__) require_relative '../config/boot' require 'rake' Rake.application.run diff --git a/bin/spring b/bin/spring deleted file mode 100755 index acb2557a..00000000 --- a/bin/spring +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env ruby -if !defined?(Spring) && [nil, 'development', 'test'].include?(ENV['RAILS_ENV']) - gem "bundler" - require "bundler" - - # Load Spring without loading other gems in the Gemfile, for speed. - Bundler.locked_gems&.specs&.find { |spec| spec.name == 'spring' }&.tap do |spring| - Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path - gem 'spring', spring.version - require 'spring/binstub' - rescue Gem::LoadError - # Ignore when Spring is not installed. - end -end diff --git a/config/spring.rb b/config/spring.rb deleted file mode 100644 index 8f6432bf..00000000 --- a/config/spring.rb +++ /dev/null @@ -1,6 +0,0 @@ -Spring.watch( - '.ruby-version', - '.rbenv-vars', - 'tmp/restart.txt', - 'tmp/caching-dev.txt' -) From 10c6edcf8c35dfa539f0092c80d58b5616c8df6b Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Thu, 10 Feb 2022 17:41:08 +0100 Subject: [PATCH 04/29] Update to Rails 7 --- Rakefile | 7 +- bin/bundle | 121 +++++++++++- bin/rspec | 32 ++- bin/setup | 33 ---- bin/update | 29 --- config.ru | 2 +- config/application.rb | 21 +- config/cable.yml | 10 - config/environments/development.rb | 186 ++++++++++-------- config/environments/production.rb | 83 +------- config/environments/test.rb | 30 +-- config/initializers/backtrace_silencers.rb | 8 - .../initializers/content_security_policy.rb | 40 ++-- config/initializers/cookies_serializer.rb | 5 - config/initializers/mime_types.rb | 4 - config/initializers/money.rb | 56 ------ .../new_framework_defaults_6_1.rb | 67 ------- config/initializers/rolify.rb | 8 - config/initializers/wrap_parameters.rb | 14 -- config/locales/devise.en.yml | 58 ------ config/storage.yml | 34 ---- dotenv.example | 4 +- .../apple-touch-icon-precomposed.png | 0 .../.gitkeep => public/apple-touch-icon.png | 0 public/robots.txt | 6 +- vendor/{plugins/.gitkeep => .keep} | 0 26 files changed, 304 insertions(+), 554 deletions(-) delete mode 100755 bin/setup delete mode 100755 bin/update delete mode 100644 config/cable.yml delete mode 100644 config/initializers/backtrace_silencers.rb delete mode 100644 config/initializers/cookies_serializer.rb delete mode 100644 config/initializers/mime_types.rb delete mode 100644 config/initializers/money.rb delete mode 100644 config/initializers/new_framework_defaults_6_1.rb delete mode 100644 config/initializers/rolify.rb delete mode 100644 config/initializers/wrap_parameters.rb delete mode 100644 config/locales/devise.en.yml delete mode 100644 config/storage.yml rename vendor/assets/javascripts/.gitkeep => public/apple-touch-icon-precomposed.png (100%) rename vendor/assets/stylesheets/.gitkeep => public/apple-touch-icon.png (100%) rename vendor/{plugins/.gitkeep => .keep} (100%) diff --git a/Rakefile b/Rakefile index ff005ce2..e85f9139 100644 --- a/Rakefile +++ b/Rakefile @@ -1,9 +1,6 @@ -#!/usr/bin/env rake -# frozen_string_literal: true - # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require File.expand_path('../config/application', __FILE__) +require_relative 'config/application' -Osem::Application.load_tasks +Rails.application.load_tasks diff --git a/bin/bundle b/bin/bundle index 66e9889e..96131dad 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,120 @@ #!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -load Gem.bin_path('bundler', 'bundle') +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'bundle' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'rubygems' + +m = Module.new do + module_function + + def invoked_as_script? + File.expand_path($0) == File.expand_path(__FILE__) + end + + def env_var_version + ENV['BUNDLER_VERSION'] + end + + def cli_arg_version + return unless invoked_as_script? # don't want to hijack other binstubs + return unless 'update'.start_with?(ARGV.first || ' ') # must be running `bundle update` + + bundler_version = nil + update_index = nil + ARGV.each_with_index do |a, i| + if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN + bundler_version = a + end + next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ + + bundler_version = Regexp.last_match(1) + update_index = i + end + bundler_version + end + + def gemfile + gemfile = ENV['BUNDLE_GEMFILE'] + return gemfile if gemfile && !gemfile.empty? + + File.expand_path('../../Gemfile', __FILE__) + end + + def lockfile + lockfile = + case File.basename(gemfile) + when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile) + else "#{gemfile}.lock" + end + File.expand_path(lockfile) + end + + def lockfile_version + return unless File.file?(lockfile) + + lockfile_contents = File.read(lockfile) + return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ + + Regexp.last_match(1) + end + + def bundler_requirement + @bundler_requirement ||= + env_var_version || cli_arg_version || + bundler_requirement_for(lockfile_version) + end + + def bundler_requirement_for(version) + return "#{Gem::Requirement.default}.a" unless version + + bundler_gem_version = Gem::Version.new(version) + + requirement = bundler_gem_version.approximate_recommendation + + return requirement unless Gem.rubygems_version < Gem::Version.new('2.7.0') + + requirement += '.a' if bundler_gem_version.prerelease? + + requirement + end + + def load_bundler! + ENV['BUNDLE_GEMFILE'] ||= gemfile + + activate_bundler + end + + def activate_bundler + gem_error = activation_error_handling do + gem 'bundler', bundler_requirement + end + return if gem_error.nil? + + require_error = activation_error_handling do + require 'bundler/version' + end + return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) + + warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" + exit 42 + end + + def activation_error_handling + yield + nil + rescue StandardError, LoadError => e + e + end +end + +m.load_bundler! + +if m.invoked_as_script? + load Gem.bin_path('bundler', 'bundle') +end diff --git a/bin/rspec b/bin/rspec index 20060ebd..e800d9aa 100755 --- a/bin/rspec +++ b/bin/rspec @@ -1,7 +1,29 @@ #!/usr/bin/env ruby -begin - load File.expand_path("../spring", __FILE__) -rescue LoadError +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'rspec' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile.next", + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end end -require 'bundler/setup' -load Gem.bin_path('rspec-core', 'rspec') + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rspec-core", "rspec") diff --git a/bin/setup b/bin/setup deleted file mode 100755 index a8e630c6..00000000 --- a/bin/setup +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env ruby -require 'fileutils' - -# path to your application root. -APP_ROOT = File.expand_path('..', __dir__) - -def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") -end - -FileUtils.chdir APP_ROOT do - # 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. - # Add necessary setup steps to this file. - - 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' - # end - - puts "\n== Preparing database ==" - 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 diff --git a/bin/update b/bin/update deleted file mode 100755 index a8e4462f..00000000 --- a/bin/update +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -require 'pathname' -require 'fileutils' -include FileUtils - -# path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) - -def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") -end - -chdir APP_ROOT do - # This script is a way to update your development environment automatically. - # Add necessary update steps to this file. - - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') - - puts "\n== Updating database ==" - system! 'bin/rails db:migrate' - - puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' - - puts "\n== Restarting application server ==" - system! 'bin/rails restart' -end diff --git a/config.ru b/config.ru index 949a0571..6f4d491b 100644 --- a/config.ru +++ b/config.ru @@ -5,4 +5,4 @@ require_relative 'config/environment' run Rails.application -Rails.application.load_server if Rails::VERSION::MAJOR == 6 +Rails.application.load_server if Rails::VERSION::MAJOR == 7 diff --git a/config/application.rb b/config/application.rb index 6d21d010..b647c947 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,6 +1,18 @@ require_relative 'boot' -require 'rails/all' +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. @@ -9,7 +21,7 @@ Bundler.require(*Rails.groups) module Osem class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 5.0 + config.load_defaults 7.0 # Configuration for the application, engines, and railties goes here. # @@ -19,8 +31,7 @@ module Osem config.time_zone = ENV.fetch('OSEM_TIME_ZONE') { 'UTC' } # Enable escaping HTML in JSON. config.active_support.escape_html_entities_in_json = true - config.active_record.sqlite3.represent_boolean_as_integer = false - # Require `belongs_to` associations by default. Previous versions had false. - config.active_record.belongs_to_required_by_default = false + # Don't generate system test files. + config.generators.system_tests = nil end end diff --git a/config/cable.yml b/config/cable.yml deleted file mode 100644 index 2a9e33d4..00000000 --- a/config/cable.yml +++ /dev/null @@ -1,10 +0,0 @@ -development: - adapter: async - -test: - adapter: test - -production: - adapter: redis - url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> - channel_prefix: osem_production diff --git a/config/environments/development.rb b/config/environments/development.rb index 2e165809..7c66d30e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,117 +1,131 @@ -Osem::Application.configure do - # Settings specified here will take precedence over those in config/application.rb +require 'active_support/core_ext/integer/time' - config.action_mailer.delivery_method = :letter_opener +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development + # In the development environment your application's code is reloaded any time + # it changes. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false - config.cache_store = :memory_store, { size: 64.megabytes } - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Don't care if the mailer can't send - config.action_mailer.raise_delivery_errors = false - - # Print deprecation notices to the Rails logger - config.active_support.deprecation = :log - - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin - - # Raise exception on mass assignment protection for Active Record models - # config.active_record.mass_assignment_sanitizer = :strict - - # Do not compress assets - config.assets.compress = false - - # Expands the lines which load the assets - config.assets.debug = true - # Do not eager load code on boot. config.eager_load = false - # Do not log asset requests + # 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? + config.action_controller.perform_caching = true + config.action_controller.enable_fragment_cache_logging = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{2.days.to_i}" + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Highlight code that triggered database queries in logs. + config.active_record.verbose_query_logs = true + + # Suppress logger output for asset requests. config.assets.quiet = true + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true + # Set the detault url for action mailer config.action_mailer.default_url_options = { host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000') } - # Set the secret key base if it's not set via other means - config.secret_key_base ||= 'f4be765bc98e516de82ac01daa8f8aa11c5ca13cb6c911887851ac89457b6c0b056b2361a21b5c08926c9386e0f91eef84fc0b103d522bf00bc0c78ea8ce7c58' + # Access all mails sent at http://localhost:3000/letter_opener + config.action_mailer.delivery_method = :letter_opener # Use omniauth mock credentials OmniAuth.config.test_mode = true OmniAuth.config.mock_auth[:facebook] = - OmniAuth::AuthHash.new( - provider: 'facebook', - uid: 'facebook-test-uid-1', - info: { - name: 'facebook user', - email: 'user-facebook@example.com', - username: 'user_facebook' - }, - credentials: { - token: 'fb_mock_token', - secret: 'fb_mock_secret' - } - ) + OmniAuth::AuthHash.new( + provider: 'facebook', + uid: 'facebook-test-uid-1', + info: { + name: 'facebook user', + email: 'user-facebook@example.com', + username: 'user_facebook' + }, + credentials: { + token: 'fb_mock_token', + secret: 'fb_mock_secret' + } + ) OmniAuth.config.mock_auth[:google] = - OmniAuth::AuthHash.new( - provider: 'google', - uid: 'google-test-uid-1', - info: { - name: 'google user', - email: 'user-google@example.com', - username: 'user_google' - }, - credentials: { - token: 'google_mock_token', - secret: 'google_mock_secret' - } - ) + OmniAuth::AuthHash.new( + provider: 'google', + uid: 'google-test-uid-1', + info: { + name: 'google user', + email: 'user-google@example.com', + username: 'user_google' + }, + credentials: { + token: 'google_mock_token', + secret: 'google_mock_secret' + } + ) OmniAuth.config.mock_auth[:suse] = - OmniAuth::AuthHash.new( - provider: 'suse', - uid: 'suse-test-uid-1', - info: { - name: 'suse user', - email: 'user-suse@example.com', - username: 'user_suse' - }, - credentials: { - token: 'suse_mock_token', - secret: 'suse_mock_secret' - } - ) + OmniAuth::AuthHash.new( + provider: 'suse', + uid: 'suse-test-uid-1', + info: { + name: 'suse user', + email: 'user-suse@example.com', + username: 'user_suse' + }, + credentials: { + token: 'suse_mock_token', + secret: 'suse_mock_secret' + } + ) OmniAuth.config.mock_auth[:github] = - OmniAuth::AuthHash.new( - provider: 'github', - uid: 'github-test-uid-1', - info: { - name: 'github user', - email: 'user-github@example.com', - username: 'user_github' - }, - credentials: { - token: 'github_mock_token', - secret: 'github_mock_secret' - } - ) - + OmniAuth::AuthHash.new( + provider: 'github', + uid: 'github-test-uid-1', + info: { + name: 'github user', + email: 'user-github@example.com', + username: 'user_github' + }, + credentials: { + token: 'github_mock_token', + secret: 'github_mock_secret' + } + ) config.after_initialize do Devise.setup do |devise_config| # Enable ichain test mode devise_config.ichain_test_mode = true end end - config.active_record.verbose_query_logs = true end diff --git a/config/environments/production.rb b/config/environments/production.rb index a74cac43..4f40e48f 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -22,7 +22,7 @@ Rails.application.configure do # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? + config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress CSS using a preprocessor. # config.assets.css_compressor = :sass @@ -31,22 +31,14 @@ Rails.application.configure do config.assets.compile = false # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.asset_host = 'http://assets.example.com' + # config.asset_host = "http://assets.example.com" # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - - # Store uploaded files on the local file system (see config/storage.yml for options). - config.active_storage.service = :local - - # Mount Action Cable outside main process or domain. - # config.action_cable.mount_path = nil - # config.action_cable.url = 'wss://example.com/cable' - # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache + # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - config.force_ssl = true if ENV.fetch('FORCE_SSL', false) + # config.force_ssl = true # Include generic and useful information about system operation, but avoid logging too much # information to avoid inadvertent exposure of personally identifiable information (PII). @@ -56,57 +48,21 @@ Rails.application.configure do config.log_tags = [:request_id] # Use a different cache store in production. - if ENV["OSEM_MEMCACHED_SERVERS"] - config.cache_store = :mem_cache_store, ENV["OSEM_MEMCACHED_SERVERS"].split(','), { - username: ENV["OSEM_MEMCACHED_USERNAME"], - password: ENV["OSEM_MEMCACHED_PASSWORD"] - } - end - - # Use a real queuing backend for Active Job (and separate queues per environment). - # config.active_job.queue_adapter = :resque - # config.active_job.queue_name_prefix = "osem_production" - - config.action_mailer.perform_caching = false - - # Ignore bad email addresses and do not raise email delivery errors. - # Set this to true and configure the email server for immediate delivery to raise delivery errors. - # config.action_mailer.raise_delivery_errors = false - - config.action_mailer.default_url_options = { host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000') } - config.action_mailer.smtp_settings = { - address: ENV['OSEM_SMTP_ADDRESS'], - port: ENV['OSEM_SMTP_PORT'], - user_name: ENV['OSEM_SMTP_USERNAME'], - password: ENV['OSEM_SMTP_PASSWORD'], - authentication: ENV['OSEM_SMTP_AUTHENTICATION'].try(:to_sym), - domain: ENV['OSEM_SMTP_DOMAIN'], - enable_starttls_auto: ENV['OSEM_SMTP_ENABLE_STARTTLS_AUTO'], - openssl_verify_mode: ENV['OSEM_SMTP_OPENSSL_VERIFY_MODE'] - }.compact - - # Set the secret_key_base from the env, if not set by any other means - config.secret_key_base ||= ENV["SECRET_KEY_BASE"] + # config.cache_store = :mem_cache_store # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify - - # Log disallowed deprecations. - config.active_support.disallowed_deprecation = :log - - # Tell Active Support which deprecation messages to disallow. - config.active_support.disallowed_deprecation_warnings = [] + # Don't log any deprecations. + config.active_support.report_deprecations = false # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new # Use a different logger for distributed setups. # require "syslog/logger" - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) @@ -116,25 +72,4 @@ Rails.application.configure do # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false - - # Inserts middleware to perform automatic connection switching. - # The `database_selector` hash is used to pass options to the DatabaseSelector - # middleware. The `delay` is used to determine how long to wait after a write - # to send a subsequent read to the primary. - # - # The `database_resolver` class is used by the middleware to determine which - # database is appropriate to use based on the time delay. - # - # The `database_resolver_context` class is used by the middleware to set - # timestamps for the last write to the primary. The resolver uses the context - # class timestamps to determine how long to wait before reading from the - # replica. - # - # By default Rails will store a last write timestamp in the session. The - # DatabaseSelector middleware is designed as such you can define your own - # strategy for connection switching and pass that into the middleware through - # these configuration options. - # config.active_record.database_selector = { delay: 2.seconds } - # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver - # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session end diff --git a/config/environments/test.rb b/config/environments/test.rb index 9a2ddb3e..25a85f43 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -8,13 +8,13 @@ require 'active_support/core_ext/integer/time' Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - config.cache_classes = false - config.action_view.cache_template_loading = true + # Turn false under Spring and add config.action_view.cache_template_loading = true. + config.cache_classes = 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 @@ -25,6 +25,7 @@ Rails.application.configure do # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false + config.action_mailer.perform_caching = false config.cache_store = :null_store # Raise exceptions instead of rendering exception templates. @@ -33,16 +34,6 @@ Rails.application.configure do # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false - # Store uploaded files on the local file system in a temporary directory. - config.active_storage.service = :test - - config.action_mailer.perform_caching = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr @@ -54,12 +45,7 @@ Rails.application.configure do # Set the detault url for action mailer config.action_mailer.default_url_options = { host: 'localhost:3000' } - - # Raises error for missing translations. - # config.i18n.raise_on_missing_translations = true - - # Annotate rendered view with file names. - # config.action_view.annotate_rendered_view_with_filenames = true + config.action_mailer.delivery_method = :test config.after_initialize do # Set Time.now to May 1, 2014 00:01:00 AM (at this instant), but allow it to move forward diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb deleted file mode 100644 index d4d9b3b9..00000000 --- a/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code -# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". -Rails.backtrace_cleaner.remove_silencers! if ENV['BACKTRACE'] diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 41c43016..3621f97f 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -4,25 +4,23 @@ # For further information see the following documentation # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy -# Rails.application.config.content_security_policy do |policy| -# policy.default_src :self, :https -# policy.font_src :self, :https, :data -# policy.img_src :self, :https, :data -# policy.object_src :none -# policy.script_src :self, :https -# policy.style_src :self, :https - -# # Specify URI for violation reports -# # policy.report_uri "/csp-violation-report-endpoint" +# Rails.application.configure do +# config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end +# +# # Generate session nonces for permitted importmap and inline scripts +# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } +# config.content_security_policy_nonce_directives = %w(script-src) +# +# # Report CSP violations to a specified URI. See: +# # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only +# # config.content_security_policy_report_only = true # end - -# If you are using UJS then enable automatic nonce generation -# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } - -# Set the nonce only to specific directives -# Rails.application.config.content_security_policy_nonce_directives = %w(script-src) - -# Report CSP violations to a specified URI -# For further information see the following documentation: -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only -# Rails.application.config.content_security_policy_report_only = true diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb deleted file mode 100644 index f51a497e..00000000 --- a/config/initializers/cookies_serializer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Specify a serializer for the signed and encrypted cookie jars. -# Valid options are :json, :marshal, and :hybrid. -Rails.application.config.action_dispatch.cookies_serializer = :hybrid diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb deleted file mode 100644 index dc189968..00000000 --- a/config/initializers/mime_types.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf diff --git a/config/initializers/money.rb b/config/initializers/money.rb deleted file mode 100644 index a9e69fa5..00000000 --- a/config/initializers/money.rb +++ /dev/null @@ -1,56 +0,0 @@ -# encoding : utf-8 - -# https://github.com/RubyMoney/money#deprecation -Money.locale_backend = :i18n -Money.rounding_mode = BigDecimal::ROUND_HALF_EVEN - -MoneyRails.configure do |config| - - # To set the default currency - # - config.default_currency = :usd - - # Set default bank object - # - # Example: - # config.default_bank = EuCentralBank.new - - # Add exchange rates to current money bank object. - # (The conversion rate refers to one direction only) - # - # Example: - # config.add_rate "USD", "CAD", 1.24515 - # config.add_rate "CAD", "USD", 0.803115 - - # To handle the inclusion of validations for monetized fields - # The default value is true - # - # config.include_validations = true - - # Default ActiveRecord migration configuration values for columns: - # - # config.amount_column = { prefix: '', # column name prefix - # postfix: '_cents', # column name postfix - # column_name: nil, # full column name (overrides prefix, postfix and accessor name) - # type: :integer, # column type - # present: true, # column will be created - # null: false, # other options will be treated as column options - # default: 0 - # } - # - # config.currency_column = { prefix: '', - # postfix: '_currency', - # column_name: nil, - # type: :string, - # present: true, - # null: false, - # default: 'USD' - # } - - # Set money formatted output globally. - # Default value is nil meaning "ignore this option". - # Options are nil, true, false. - # - # config.no_cents_if_whole = nil - # config.symbol = nil -end diff --git a/config/initializers/new_framework_defaults_6_1.rb b/config/initializers/new_framework_defaults_6_1.rb deleted file mode 100644 index 9526b835..00000000 --- a/config/initializers/new_framework_defaults_6_1.rb +++ /dev/null @@ -1,67 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains migration options to ease your Rails 6.1 upgrade. -# -# Once upgraded flip defaults one by one to migrate to the new default. -# -# Read the Guide for Upgrading Ruby on Rails for more info on each option. - -# Support for inversing belongs_to -> has_many Active Record associations. -# Rails.application.config.active_record.has_many_inversing = true - -# Track Active Storage variants in the database. -# Rails.application.config.active_storage.track_variants = true - -# Apply random variation to the delay when retrying failed jobs. -# Rails.application.config.active_job.retry_jitter = 0.15 - -# Stop executing `after_enqueue`/`after_perform` callbacks if -# `before_enqueue`/`before_perform` respectively halts with `throw :abort`. -# Rails.application.config.active_job.skip_after_callbacks_if_terminated = true - -# Specify cookies SameSite protection level: either :none, :lax, or :strict. -# -# This change is not backwards compatible with earlier Rails versions. -# It's best enabled when your entire app is migrated and stable on 6.1. -# Rails.application.config.action_dispatch.cookies_same_site_protection = :lax - -# Generate CSRF tokens that are encoded in URL-safe Base64. -# -# This change is not backwards compatible with earlier Rails versions. -# It's best enabled when your entire app is migrated and stable on 6.1. -# Rails.application.config.action_controller.urlsafe_csrf_tokens = true - -# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an -# UTC offset or a UTC time. -# ActiveSupport.utc_to_local_returns_utc_offset_times = true - -# Change the default HTTP status code to `308` when redirecting non-GET/HEAD -# requests to HTTPS in `ActionDispatch::SSL` middleware. -# Rails.application.config.action_dispatch.ssl_default_redirect_status = 308 - -# Use new connection handling API. For most applications this won't have any -# effect. For applications using multiple databases, this new API provides -# support for granular connection swapping. -# Rails.application.config.active_record.legacy_connection_handling = false - -# Make `form_with` generate non-remote forms by default. -# Rails.application.config.action_view.form_with_generates_remote_forms = false - -# Set the default queue name for the analysis job to the queue adapter default. -# Rails.application.config.active_storage.queues.analysis = nil - -# Set the default queue name for the purge job to the queue adapter default. -# Rails.application.config.active_storage.queues.purge = nil - -# Set the default queue name for the incineration job to the queue adapter default. -# Rails.application.config.action_mailbox.queues.incineration = nil - -# Set the default queue name for the routing job to the queue adapter default. -# Rails.application.config.action_mailbox.queues.routing = nil - -# Set the default queue name for the mail deliver job to the queue adapter default. -# Rails.application.config.action_mailer.deliver_later_queue_name = nil - -# Generate a `Link` header that gives a hint to modern browsers about -# preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`. -# Rails.application.config.action_view.preload_links_header = true diff --git a/config/initializers/rolify.rb b/config/initializers/rolify.rb deleted file mode 100644 index 14460ef6..00000000 --- a/config/initializers/rolify.rb +++ /dev/null @@ -1,8 +0,0 @@ -Rolify.configure do |config| - # By default ORM adapter is ActiveRecord. uncomment to use mongoid - # config.use_mongoid - - # Dynamic shortcuts for User class (user.is_admin? like methods). Default is: false - # Enable this feature _after_ running rake db:migrate as it relies on the roles table - # config.use_dynamic_shortcuts -end diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb deleted file mode 100644 index bbfc3961..00000000 --- a/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] -end - -# To enable root element in JSON for ActiveRecord objects. -# ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true -# end diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml deleted file mode 100644 index 3b4084b4..00000000 --- a/config/locales/devise.en.yml +++ /dev/null @@ -1,58 +0,0 @@ -# Additional translations at https://github.com/plataformatec/devise/wiki/I18n - -en: - errors: - messages: - expired: "has expired, please request a new one" - not_found: "not found" - already_confirmed: "was already confirmed, please try signing in" - not_locked: "was not locked" - not_saved: - one: "1 error prohibited this %{resource} from being saved:" - other: "%{count} errors prohibited this %{resource} from being saved:" - - devise: - failure: - already_authenticated: 'You are already signed in.' - unauthenticated: 'You need to sign in or sign up before continuing.' - unconfirmed: 'You have to confirm your account before continuing.' - locked: 'Your account is locked.' - invalid: 'Invalid login or password.' - invalid_token: 'Invalid authentication token.' - timeout: 'Your session expired, please sign in again to continue.' - inactive: 'Your account was not activated yet.' - sessions: - signed_in: 'Signed in successfully.' - signed_out: 'Signed out successfully.' - passwords: - send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.' - updated: 'Your password was changed successfully. You are now signed in.' - updated_not_active: 'Your password was changed successfully.' - send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." - no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." - confirmations: - send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.' - send_paranoid_instructions: 'If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes.' - confirmed: 'Your account was successfully confirmed. NOTE: You have not been automatically registered to attend a conference!' - registrations: - signed_up: 'Welcome! You have signed up successfully.' - signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.' - signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.' - signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.' - updated: 'You updated your account successfully.' - update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address." - destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.' - unlocks: - send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.' - unlocked: 'Your account has been unlocked successfully. Please sign in to continue.' - send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.' - omniauth_callbacks: - success: 'Successfully authenticated from %{kind} account.' - failure: 'Could not authenticate you from %{kind} because "%{reason}".' - mailer: - confirmation_instructions: - subject: 'Confirmation instructions' - reset_password_instructions: - subject: 'Reset password instructions' - unlock_instructions: - subject: 'Unlock Instructions' diff --git a/config/storage.yml b/config/storage.yml deleted file mode 100644 index d32f76e8..00000000 --- a/config/storage.yml +++ /dev/null @@ -1,34 +0,0 @@ -test: - service: Disk - root: <%= Rails.root.join("tmp/storage") %> - -local: - service: Disk - root: <%= Rails.root.join("storage") %> - -# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) -# amazon: -# service: S3 -# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> -# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> -# region: us-east-1 -# bucket: your_own_bucket - -# Remember not to checkin your GCS keyfile to a repository -# google: -# service: GCS -# project: your_project -# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> -# bucket: your_own_bucket - -# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) -# microsoft: -# service: AzureStorage -# storage_account_name: your_account_name -# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> -# container: your_container_name - -# mirror: -# service: Mirror -# primary: local -# mirrors: [ amazon, google, microsoft ] diff --git a/dotenv.example b/dotenv.example index 21ce4eb4..a93a5c4c 100644 --- a/dotenv.example +++ b/dotenv.example @@ -32,8 +32,8 @@ # OSEM_MEMCACHED_USERNAME='root' # OSEM_MEMCACHED_PASSWORD='1234' -# The ruby version to use -# OSEM_RUBY_VERSION=2.5.0 +# Set this if you want to deviate from our 'standar' ruby version +# OSEM_RUBY_VERSION=3.1.0 # What time is it? # OSEM_TIME_ZONE="UTC" diff --git a/vendor/assets/javascripts/.gitkeep b/public/apple-touch-icon-precomposed.png similarity index 100% rename from vendor/assets/javascripts/.gitkeep rename to public/apple-touch-icon-precomposed.png diff --git a/vendor/assets/stylesheets/.gitkeep b/public/apple-touch-icon.png similarity index 100% rename from vendor/assets/stylesheets/.gitkeep rename to public/apple-touch-icon.png diff --git a/public/robots.txt b/public/robots.txt index 085187fa..c19f78ab 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,5 +1 @@ -# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file -# -# To ban all spiders from the entire site uncomment the next two lines: -# User-Agent: * -# Disallow: / +# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file diff --git a/vendor/plugins/.gitkeep b/vendor/.keep similarity index 100% rename from vendor/plugins/.gitkeep rename to vendor/.keep From f3815ad543b55e8a7e3d4333c047466bc9d4c0e2 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Thu, 10 Feb 2022 17:49:01 +0100 Subject: [PATCH 05/29] Update rubocop to 1.25.1 --- .rubocop_todo.yml | 218 ++++++++++++++++++---------------------------- Gemfile.lock | 18 ++-- Gemfile.next.lock | 18 ++-- 3 files changed, 101 insertions(+), 153 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d0ba1ec4..45457a6b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,12 +1,12 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2021-08-13 12:49:18 UTC using RuboCop version 1.19.0. +# on 2022-02-10 16:47:29 UTC using RuboCop version 1.25.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 1 +# Offense count: 2 # Cop supports --auto-correct. # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. # Include: **/*.gemfile, **/Gemfile, **/gems.rb @@ -14,13 +14,12 @@ Bundler/OrderedGems: Exclude: - 'Gemfile' -# Offense count: 5 +# Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: IndentationWidth. Layout/AssignmentIndentation: Exclude: - 'app/helpers/format_helper.rb' - - 'config/environments/development.rb' # Offense count: 4 # Cop supports --auto-correct. @@ -33,6 +32,7 @@ Layout/ClosingParenthesisIndentation: # Offense count: 14 # Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment. Layout/CommentIndentation: Exclude: - 'app/controllers/admin/comments_controller.rb' @@ -62,7 +62,7 @@ Layout/EmptyLineAfterMagicComment: Exclude: - 'spec/models/conference_spec.rb' -# Offense count: 113 +# Offense count: 108 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: empty_lines, no_empty_lines @@ -75,17 +75,13 @@ Layout/EmptyLinesAroundExceptionHandlingKeywords: Exclude: - 'app/models/payment.rb' -# Offense count: 13 +# Offense count: 6 # Cop supports --auto-correct. # Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. Layout/ExtraSpacing: Exclude: - - 'Guardfile' - 'app/controllers/application_controller.rb' - 'app/views/admin/events/_all_with_comments.xlsx.axlsx' - - 'bin/rails' - - 'config.ru' - - 'config/environments/test.rb' - 'db/migrate/20140623101032_create_ahoy_events.rb' - 'db/migrate/20140701123203_add_events_per_week_to_conference.rb' - 'db/migrate/20140719160903_create_delayed_jobs.rb' @@ -140,12 +136,11 @@ Layout/IndentationWidth: Exclude: - 'app/controllers/users_controller.rb' -# Offense count: 4 +# Offense count: 2 # Cop supports --auto-correct. # Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment. Layout/LeadingCommentSpace: Exclude: - - 'Guardfile' - 'app/models/comment.rb' # Offense count: 32 @@ -179,14 +174,14 @@ Layout/MultilineHashBraceLayout: - 'config/routes.rb' - 'spec/models/event_spec.rb' -# Offense count: 36 +# Offense count: 35 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: symmetrical, new_line, same_line Layout/MultilineMethodCallBraceLayout: Enabled: false -# Offense count: 56 +# Offense count: 55 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: aligned, indented, indented_relative_to_receiver @@ -241,14 +236,13 @@ Layout/SpaceAroundMethodCallOperator: - 'spec/features/organizer_ability_spec.rb' - 'spec/models/program_spec.rb' -# Offense count: 3 +# Offense count: 2 # Cop supports --auto-correct. # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator. # SupportedStylesForExponentOperator: space, no_space Layout/SpaceAroundOperators: Exclude: - 'app/views/admin/events/_all_with_comments.xlsx.axlsx' - - 'config/environments/test.rb' - 'lib/tasks/data.rake' # Offense count: 139 @@ -278,12 +272,6 @@ Layout/SpaceBeforeFirstArg: Exclude: - 'app/controllers/admin/booths_controller.rb' -# Offense count: 1 -# Cop supports --auto-correct. -Layout/SpaceBeforeSemicolon: - Exclude: - - 'Guardfile' - # Offense count: 8 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. @@ -339,7 +327,7 @@ Layout/SpaceInsideHashLiteralBraces: # Offense count: 4 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. -# SupportedStyles: space, no_space +# SupportedStyles: space, compact, no_space Layout/SpaceInsideParens: Exclude: - 'app/views/admin/registrations/index.xlsx.axlsx' @@ -371,11 +359,17 @@ Lint/AmbiguousBlockAssociation: - 'spec/controllers/schedules_controller_spec.rb' - 'spec/models/user_spec.rb' -# Offense count: 1 -# Configuration parameters: AllowSafeAssignment. -Lint/AssignmentInCondition: +# Offense count: 13 +# Cop supports --auto-correct. +Lint/AmbiguousOperatorPrecedence: Exclude: - - 'bin/spring' + - 'app/controllers/application_controller.rb' + - 'app/helpers/conference_helper.rb' + - 'app/models/admin_ability.rb' + - 'app/models/commercial.rb' + - 'app/models/conference.rb' + - 'app/models/track.rb' + - 'app/pdfs/ticket_pdf.rb' # Offense count: 1 # Configuration parameters: AllowedMethods. @@ -409,31 +403,12 @@ Lint/IneffectiveAccessModifier: - 'app/models/commercial.rb' - 'app/models/conference.rb' -# Offense count: 1 -# Cop supports --auto-correct. -Lint/NonDeterministicRequireOrder: - Exclude: - - 'spec/spec_helper.rb' - # Offense count: 1 # Cop supports --auto-correct. Lint/RedundantCopDisableDirective: Exclude: - 'spec/support/save_feature_failures.rb' -# Offense count: 2 -# Cop supports --auto-correct. -Lint/ScriptPermission: - Exclude: - - 'Guardfile' - - 'Rakefile' - -# Offense count: 1 -# Configuration parameters: AllowComments, AllowNil. -Lint/SuppressedException: - Exclude: - - 'bin/rspec' - # Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. @@ -455,16 +430,16 @@ Lint/UriRegexp: - 'app/models/commercial.rb' - 'app/models/contact.rb' -# Offense count: 128 +# Offense count: 127 # Configuration parameters: IgnoredMethods, CountRepeatedAttributes. Metrics/AbcSize: Max: 71 -# Offense count: 315 +# Offense count: 313 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. # IgnoredMethods: refine Metrics/BlockLength: - Max: 1344 + Max: 1341 # Offense count: 1 # Configuration parameters: CountBlocks. @@ -476,12 +451,12 @@ Metrics/BlockNesting: Metrics/ClassLength: Max: 652 -# Offense count: 28 +# Offense count: 29 # Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: Max: 16 -# Offense count: 150 +# Offense count: 152 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. Metrics/MethodLength: Max: 56 @@ -491,7 +466,7 @@ Metrics/MethodLength: Metrics/ModuleLength: Max: 173 -# Offense count: 25 +# Offense count: 26 # Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: Max: 19 @@ -510,15 +485,6 @@ Naming/HeredocDelimiterNaming: - 'spec/factories/users.rb' - 'spec/models/user_spec.rb' -# Offense count: 10 -# Configuration parameters: CheckIdentifiers, CheckConstants, CheckVariables, CheckStrings, CheckSymbols, CheckComments, CheckFilepaths, FlaggedTerms. -Naming/InclusiveLanguage: - Exclude: - - 'app/controllers/admin/contacts_controller.rb' - - 'app/controllers/users_controller.rb' - - 'app/uploaders/picture_uploader.rb' - - 'config/application.rb' - # Offense count: 2 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. # AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to @@ -618,7 +584,7 @@ RSpec/DescribedClass: - 'spec/serializers/speaker_serializer_spec.rb' - 'spec/serializers/track_serializer_spec.rb' -# Offense count: 13 +# Offense count: 11 # Cop supports --auto-correct. # Configuration parameters: AllowConsecutiveOneLiners. RSpec/EmptyLineAfterExample: @@ -649,7 +615,7 @@ RSpec/EmptyLineAfterFinalLet: - 'spec/models/payment_spec.rb' - 'spec/models/ticket_spec.rb' -# Offense count: 16 +# Offense count: 17 # Cop supports --auto-correct. RSpec/EmptyLineAfterHook: Exclude: @@ -682,7 +648,7 @@ RSpec/EmptyLineAfterSubject: RSpec/ExampleLength: Max: 187 -# Offense count: 19 +# Offense count: 18 # Cop supports --auto-correct. # Configuration parameters: CustomTransform, IgnoredWords. RSpec/ExampleWording: @@ -829,7 +795,7 @@ RSpec/MultipleDescribes: - 'spec/controllers/application_controller_spec.rb' - 'spec/models/conference_spec.rb' -# Offense count: 279 +# Offense count: 277 RSpec/MultipleExpectations: Max: 97 @@ -951,7 +917,7 @@ Style/AccessorGrouping: - 'app/models/payment.rb' # Offense count: 12 -# Cop supports --auto-correct. +# Cop supports --auto-correct-all. Style/CaseLikeIf: Exclude: - 'app/controllers/admin/roles_controller.rb' @@ -1007,14 +973,6 @@ Style/ConditionalAssignment: Style/Documentation: Enabled: false -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: allowed_in_returns, forbidden -Style/DoubleNegation: - Exclude: - - 'config/environments/production.rb' - # Offense count: 2 # Cop supports --auto-correct. Style/EmptyCaseCondition: @@ -1042,37 +1000,23 @@ Style/EmptyMethod: - 'db/migrate/20130206192339_rename_attending_social_events_with_partner.rb' - 'db/migrate/20130216122155_set_registration_defaults_to_false.rb' -# Offense count: 4 +# Offense count: 3 # Cop supports --auto-correct. Style/Encoding: Exclude: - 'app/uploaders/picture_uploader.rb' - 'config/initializers/formtastic.rb' - - 'config/initializers/money.rb' - 'spec/models/conference_spec.rb' -# Offense count: 11 +# Offense count: 3 # Cop supports --auto-correct. Style/ExpandPathArguments: Exclude: - - 'Rakefile' - 'bin/bundle' - - 'bin/rails' - 'bin/rspec' - - 'bin/setup' - - 'bin/update' - - 'config.ru' - - 'config/application.rb' - - 'config/environment.rb' - 'spec/spec_helper.rb' -# Offense count: 9 -# Cop supports --auto-correct. -Style/ExplicitBlockArgument: - Exclude: - - 'Guardfile' - -# Offense count: 48 +# Offense count: 41 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. # SupportedStyles: always, always_true, never @@ -1085,7 +1029,7 @@ Style/GlobalStdStream: Exclude: - 'config/environments/production.rb' -# Offense count: 28 +# Offense count: 29 # Configuration parameters: MinBodyLength. Style/GuardClause: Enabled: false @@ -1114,25 +1058,22 @@ Style/HashLikeCase: Exclude: - 'app/helpers/versions_helper.rb' -# Offense count: 7 +# Offense count: 358 # Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +# SupportedShorthandSyntax: always, never, either Style/HashSyntax: - Exclude: - - 'Gemfile' - - 'app/views/admin/events/events.xlsx.axlsx' - - 'app/views/admin/registrations/index.xlsx.axlsx' - - 'lib/tasks/user.rake' + Enabled: false # Offense count: 2 -# Cop supports --auto-correct. +# Cop supports --auto-correct-all. Style/HashTransformValues: Exclude: - 'app/controllers/admin/comments_controller.rb' - 'app/helpers/chart_helper.rb' -# Offense count: 59 +# Offense count: 61 # Cop supports --auto-correct. Style/IfUnlessModifier: Enabled: false @@ -1144,6 +1085,12 @@ Style/LineEndConcatenation: - 'spec/features/conference_spec.rb' - 'spec/features/registration_periods_spec.rb' +# Offense count: 1 +# Cop supports --auto-correct-all. +Style/MapToHash: + Exclude: + - 'app/controllers/admin/comments_controller.rb' + # Offense count: 9 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle. @@ -1154,12 +1101,9 @@ Style/MethodDefParentheses: - 'app/models/user.rb' - 'lib/tasks/demo_data_for_development.rake' -# Offense count: 4 +# Offense count: 1 Style/MixinUsage: Exclude: - - 'bin/setup' - - 'bin/update' - - 'config/application.rb' - 'spec/spec_helper.rb' # Offense count: 7 @@ -1213,12 +1157,12 @@ Style/NumericLiteralPrefix: # Offense count: 7 # Cop supports --auto-correct. -# Configuration parameters: Strict. +# Configuration parameters: Strict, AllowedNumbers. Style/NumericLiterals: MinDigits: 15 # Offense count: 36 -# Cop supports --auto-correct. +# Cop supports --auto-correct-all. # Configuration parameters: EnforcedStyle, IgnoredMethods. # SupportedStyles: predicate, comparison Style/NumericPredicate: @@ -1266,14 +1210,28 @@ Style/ParenthesesAroundCondition: - 'app/controllers/application_controller.rb' - 'app/helpers/format_helper.rb' -# Offense count: 21 +# Offense count: 19 # Cop supports --auto-correct. # Configuration parameters: PreferredDelimiters. Style/PercentLiteralDelimiters: - Enabled: false + Exclude: + - 'Gemfile' + - 'app/controllers/admin/users_controller.rb' + - 'app/models/cfp.rb' + - 'app/models/comment.rb' + - 'app/models/commercial.rb' + - 'app/models/conference.rb' + - 'app/models/contact.rb' + - 'app/models/registration.rb' + - 'app/models/subscription.rb' + - 'app/models/track.rb' + - 'app/uploaders/picture_uploader.rb' + - 'config/deploy.rb' + - 'config/initializers/formtastic.rb' + - 'spec/models/program_spec.rb' # Offense count: 1 -# Cop supports --auto-correct. +# Cop supports --auto-correct-all. # Configuration parameters: EnforcedStyle. # SupportedStyles: short, verbose Style/PreferredHashMethods: @@ -1308,7 +1266,7 @@ Style/RedundantCondition: - 'app/models/ticket.rb' # Offense count: 3 -# Cop supports --auto-correct. +# Cop supports --auto-correct-all. # Configuration parameters: SafeForConstants. Style/RedundantFetchBlock: Exclude: @@ -1336,13 +1294,12 @@ Style/RedundantReturn: - 'app/controllers/admin/events_controller.rb' - 'app/controllers/admin/organizations_controller.rb' -# Offense count: 3 +# Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, AllowInnerSlashes. # SupportedStyles: slashes, percent_r, mixed Style/RegexpLiteral: Exclude: - - 'Guardfile' - 'app/uploaders/picture_uploader.rb' # Offense count: 2 @@ -1363,13 +1320,6 @@ Style/SignalException: - 'lib/tasks/user.rake' - 'spec/support/flash.rb' -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: AllowIfMethodIsEmpty. -Style/SingleLineMethods: - Exclude: - - 'Guardfile' - # Offense count: 6 # Cop supports --auto-correct. # Configuration parameters: AllowModifier. @@ -1382,13 +1332,20 @@ Style/SoleNestedConditional: - 'db/migrate/20140801170430_move_event_media_to_commercial.rb' - 'db/migrate/20151018152439_create_programs_table.rb' -# Offense count: 31 +# Offense count: 1 # Cop supports --auto-correct. +# Configuration parameters: RequireEnglish. +# SupportedStyles: use_perl_names, use_english_names +Style/SpecialGlobalVars: + EnforcedStyle: use_perl_names + +# Offense count: 31 +# Cop supports --auto-correct-all. # Configuration parameters: Mode. Style/StringConcatenation: Enabled: false -# Offense count: 31 +# Offense count: 35 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. # SupportedStyles: single_quotes, double_quotes @@ -1396,7 +1353,6 @@ Style/StringLiterals: Exclude: - 'Gemfile' - 'bin/rspec' - - 'bin/spring' - 'config/deploy.rb' - 'config/environments/production.rb' - 'config/puma.rb' @@ -1416,7 +1372,7 @@ Style/StringLiteralsInInterpolation: - 'app/views/admin/events/_confirmed_events.xlsx.axlsx' - 'lib/tasks/dump_db.rake' -# Offense count: 108 +# Offense count: 109 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, MinSize. # SupportedStyles: percent, brackets @@ -1424,7 +1380,7 @@ Style/SymbolArray: Enabled: false # Offense count: 10 -# Cop supports --auto-correct. +# Cop supports --auto-correct-all. # Configuration parameters: AllowMethodsWithArguments, IgnoredMethods. # IgnoredMethods: respond_to, define_method Style/SymbolProc: @@ -1445,14 +1401,6 @@ Style/TernaryParentheses: Exclude: - 'app/helpers/format_helper.rb' -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyleForMultiline. -# SupportedStylesForMultiline: comma, consistent_comma, no_comma -Style/TrailingCommaInArrayLiteral: - Exclude: - - 'Guardfile' - # Offense count: 21 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyleForMultiline. @@ -1476,9 +1424,9 @@ Style/WordArray: EnforcedStyle: percent MinSize: 6 -# Offense count: 533 +# Offense count: 532 # Cop supports --auto-correct. -# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https Layout/LineLength: Max: 619 diff --git a/Gemfile.lock b/Gemfile.lock index 253970b7..dafb1692 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -365,8 +365,8 @@ GEM paper_trail (12.1.0) activerecord (>= 5.2) request_store (~> 1.1) - parallel (1.20.1) - parser (3.0.2.0) + parallel (1.21.0) + parser (3.1.0.0) ast (~> 2.4.1) pdf-core (0.9.0) pdf-inspector (1.3.0) @@ -437,7 +437,7 @@ GEM method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) - rainbow (3.0.0) + rainbow (3.1.1) rake (13.0.6) rb-fsevent (0.11.0) rb-inotify (0.10.1) @@ -445,7 +445,7 @@ GEM recaptcha (4.14.0) json redcarpet (3.5.1) - regexp_parser (2.1.1) + regexp_parser (2.2.0) request_store (1.5.0) rack (>= 1.4) responders (3.0.1) @@ -483,16 +483,16 @@ GEM rspec-mocks (~> 3.6.0) rspec-support (~> 3.6.0) rspec-support (3.6.0) - rubocop (1.19.1) + rubocop (1.25.1) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.1.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.9.1, < 2.0) + rubocop-ast (>= 1.15.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.11.0) + rubocop-ast (1.15.1) parser (>= 3.0.1.1) rubocop-rails (2.11.3) activesupport (>= 4.2.0) @@ -584,7 +584,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.7) - unicode-display_width (2.0.0) + unicode-display_width (2.1.0) unicode_utils (1.4.0) unobtrusive_flash (3.3.1) railties diff --git a/Gemfile.next.lock b/Gemfile.next.lock index 8a823de5..73049b10 100644 --- a/Gemfile.next.lock +++ b/Gemfile.next.lock @@ -406,8 +406,8 @@ GEM paper_trail (12.0.0) activerecord (>= 5.2) request_store (~> 1.1) - parallel (1.20.1) - parser (3.0.2.0) + parallel (1.21.0) + parser (3.1.0.0) ast (~> 2.4.1) pdf-core (0.9.0) pdf-inspector (1.3.0) @@ -480,12 +480,12 @@ GEM rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) - rainbow (3.0.0) + rainbow (3.1.1) rake (13.0.6) recaptcha (5.8.1) json redcarpet (3.5.1) - regexp_parser (2.1.1) + regexp_parser (2.2.0) request_store (1.5.0) rack (>= 1.4) responders (3.0.1) @@ -523,16 +523,16 @@ GEM rspec-mocks (~> 3.10) rspec-support (~> 3.10) rspec-support (3.10.2) - rubocop (1.19.0) + rubocop (1.25.1) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.1.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.9.1, < 2.0) + rubocop-ast (>= 1.15.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.10.0) + rubocop-ast (1.15.1) parser (>= 3.0.1.1) rubocop-rails (2.11.3) activesupport (>= 4.2.0) @@ -620,7 +620,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.7) - unicode-display_width (2.0.0) + unicode-display_width (2.1.0) unicode_utils (1.4.0) unobtrusive_flash (3.3.1) railties From bee30b6ff814c879ccd5dd60267692f0d60b09a1 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Thu, 10 Feb 2022 17:55:31 +0100 Subject: [PATCH 06/29] Update devise to 4.8.1 --- Gemfile.lock | 18 +++++++++--------- Gemfile.next.lock | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index dafb1692..8267d4c3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -169,7 +169,7 @@ GEM delayed_job_active_record (4.1.6) activerecord (>= 3.0, < 6.2) delayed_job (>= 3.0, < 5) - devise (4.8.0) + devise (4.8.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -255,7 +255,7 @@ GEM http-accept (1.7.0) http-cookie (1.0.4) domain_name (~> 0.5) - i18n (1.8.10) + i18n (1.9.1) concurrent-ruby (~> 1.0) i18n_data (0.13.0) icalendar (2.7.1) @@ -292,7 +292,7 @@ GEM actionmailer (>= 3.2) letter_opener (~> 1.0) railties (>= 3.2) - loofah (2.12.0) + loofah (2.13.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -307,8 +307,8 @@ GEM rake mini_magick (4.11.0) mini_mime (1.1.1) - mini_portile2 (2.6.1) - minitest (5.14.4) + mini_portile2 (2.7.1) + minitest (5.15.0) momentjs-rails (2.20.1) railties (>= 3.1) monetize (1.9.4) @@ -328,8 +328,8 @@ GEM next_rails (1.0.4) colorize (>= 0.8.1) nio4r (2.5.8) - nokogiri (1.12.5) - mini_portile2 (~> 2.6.1) + nokogiri (1.13.1) + mini_portile2 (~> 2.7.0) racc (~> 1.4) oauth2 (1.4.7) faraday (>= 0.8, < 2.0) @@ -397,7 +397,7 @@ GEM public_suffix (4.0.6) puma (4.3.9) nio4r (~> 2.0) - racc (1.5.2) + racc (1.6.0) rack (2.2.3) rack-openid (1.4.2) rack (>= 1.1.0) @@ -568,7 +568,7 @@ GEM stripe (> 5, < 6) sysexits (1.2.0) temple (0.8.2) - thor (1.1.0) + thor (1.2.1) thread_safe (0.3.6) tilt (2.0.10) timecop (0.9.4) diff --git a/Gemfile.next.lock b/Gemfile.next.lock index 73049b10..e34b6636 100644 --- a/Gemfile.next.lock +++ b/Gemfile.next.lock @@ -192,7 +192,7 @@ GEM delayed_job_active_record (4.1.7) activerecord (>= 3.0, < 8.0) delayed_job (>= 3.0, < 5) - devise (4.8.0) + devise (4.8.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) From 14eea7d37bd53baa126da1b5f2802177b4cb6540 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Thu, 10 Feb 2022 18:08:49 +0100 Subject: [PATCH 07/29] Workaround missing prawn dependency --- Gemfile | 3 +++ Gemfile.lock | 2 ++ Gemfile.next.lock | 2 ++ 3 files changed, 7 insertions(+) diff --git a/Gemfile b/Gemfile index 11eeabbe..096efc3c 100644 --- a/Gemfile +++ b/Gemfile @@ -143,6 +143,9 @@ gem 'country_select' # as PDF generator gem 'prawn-qrcode' gem 'prawn-rails' +# FIXME: for prawn, matrix isn't in the default set of Ruby 3.1 anymore +# see https://github.com/prawnpdf/prawn/commit/3658d5125c3b20eb11484c3b039ca6b89dc7d1b7 +gem 'matrix', '~> 0.4' # for QR code generation gem 'rqrcode' diff --git a/Gemfile.lock b/Gemfile.lock index 8267d4c3..2fae724f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -298,6 +298,7 @@ GEM mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.1) + matrix (0.4.2) method_source (1.0.0) mime-types (3.3.1) mime-types-data (~> 3.2015) @@ -662,6 +663,7 @@ DEPENDENCIES leaflet-rails letter_opener letter_opener_web + matrix (~> 0.4) mina mini_magick money-rails diff --git a/Gemfile.next.lock b/Gemfile.next.lock index e34b6636..9d0d8526 100644 --- a/Gemfile.next.lock +++ b/Gemfile.next.lock @@ -324,6 +324,7 @@ GEM mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.1) + matrix (0.4.2) method_source (1.0.0) mime-types (3.3.1) mime-types-data (~> 3.2015) @@ -699,6 +700,7 @@ DEPENDENCIES leaflet-rails letter_opener letter_opener_web + matrix (~> 0.4) mina mini_magick money-rails From dc230e45398ea1a06f062770bce73758b1587452 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Thu, 10 Feb 2022 18:33:15 +0100 Subject: [PATCH 08/29] Update paper_trail to 12.2.0 --- Gemfile.lock | 4 ++-- Gemfile.next.lock | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2fae724f..1167482d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -363,7 +363,7 @@ GEM omniauth (~> 2.0) open4 (1.3.4) orm_adapter (0.5.0) - paper_trail (12.1.0) + paper_trail (12.2.0) activerecord (>= 5.2) request_store (~> 1.1) parallel (1.21.0) @@ -447,7 +447,7 @@ GEM json redcarpet (3.5.1) regexp_parser (2.2.0) - request_store (1.5.0) + request_store (1.5.1) rack (>= 1.4) responders (3.0.1) actionpack (>= 5.0) diff --git a/Gemfile.next.lock b/Gemfile.next.lock index 9d0d8526..a0516224 100644 --- a/Gemfile.next.lock +++ b/Gemfile.next.lock @@ -404,7 +404,7 @@ GEM omniauth (~> 2.0) open4 (1.3.4) orm_adapter (0.5.0) - paper_trail (12.0.0) + paper_trail (12.2.0) activerecord (>= 5.2) request_store (~> 1.1) parallel (1.21.0) @@ -487,7 +487,7 @@ GEM json redcarpet (3.5.1) regexp_parser (2.2.0) - request_store (1.5.0) + request_store (1.5.1) rack (>= 1.4) responders (3.0.1) actionpack (>= 5.0) From 5cc84aa65df6769a5efabb7c51751342494374b4 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Thu, 10 Feb 2022 18:35:37 +0100 Subject: [PATCH 09/29] Switch CI to Ruby 3.1 --- .github/workflows/next-rails.yml | 2 +- .github/workflows/spec.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/next-rails.yml b/.github/workflows/next-rails.yml index 4d0aac83..5f31a6eb 100644 --- a/.github/workflows/next-rails.yml +++ b/.github/workflows/next-rails.yml @@ -26,7 +26,7 @@ jobs: echo "BUNDLE_CACHE_PATH=vendor/cache.next" >> $GITHUB_ENV - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.5 + ruby-version: 3.1.0 bundler-cache: true - name: Prepare spec run: | diff --git a/.github/workflows/spec.yml b/.github/workflows/spec.yml index a80430d0..4dadf9b7 100644 --- a/.github/workflows/spec.yml +++ b/.github/workflows/spec.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.5 + ruby-version: 3.1.0 bundler-cache: true - run: bundle exec rubocop - run: bundle exec haml-lint app/views @@ -34,7 +34,7 @@ jobs: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.5 + ruby-version: 3.1 bundler-cache: true - name: Prepare spec run: | From 27894d68f6985b39ee1cd4fcb259a1340581b3c8 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Fri, 11 Feb 2022 15:00:18 +0100 Subject: [PATCH 10/29] Update awesome_nested_set to 3.5.0 --- Gemfile.lock | 4 ++-- Gemfile.next.lock | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1167482d..68c7074f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -89,8 +89,8 @@ GEM ast (2.4.2) autoprefixer-rails (10.3.3.0) execjs (~> 2) - awesome_nested_set (3.4.0) - activerecord (>= 4.0.0, < 7.0) + awesome_nested_set (3.5.0) + activerecord (>= 4.0.0, < 7.1) aws_cf_signer (0.1.3) bcrypt (3.1.16) bindex (0.8.1) diff --git a/Gemfile.next.lock b/Gemfile.next.lock index a0516224..51bd7506 100644 --- a/Gemfile.next.lock +++ b/Gemfile.next.lock @@ -112,8 +112,8 @@ GEM ast (2.4.2) autoprefixer-rails (10.3.1.0) execjs (~> 2) - awesome_nested_set (2.1.6) - activerecord (>= 3.0.0) + awesome_nested_set (3.5.0) + activerecord (>= 4.0.0, < 7.1) aws_cf_signer (0.1.3) bcrypt (3.1.16) bindex (0.8.1) From e15fedd9b05707de6b9310fa18a1fc042b6326e3 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Fri, 11 Feb 2022 15:05:24 +0100 Subject: [PATCH 11/29] Add next_rails binstubs --- bin/bundle_report | 29 +++++++++++++++++++++++++++++ bin/deprecations | 29 +++++++++++++++++++++++++++++ bin/gem-next-diff | 29 +++++++++++++++++++++++++++++ bin/next | 29 +++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100755 bin/bundle_report create mode 100755 bin/deprecations create mode 100755 bin/gem-next-diff create mode 100755 bin/next diff --git a/bin/bundle_report b/bin/bundle_report new file mode 100755 index 00000000..b136eb23 --- /dev/null +++ b/bin/bundle_report @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'bundle_report' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'pathname' +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path('bundle', __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort('Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.') + end +end + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path('next_rails', 'bundle_report') diff --git a/bin/deprecations b/bin/deprecations new file mode 100755 index 00000000..825e288e --- /dev/null +++ b/bin/deprecations @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'deprecations' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'pathname' +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path('bundle', __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort('Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.') + end +end + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path('next_rails', 'deprecations') diff --git a/bin/gem-next-diff b/bin/gem-next-diff new file mode 100755 index 00000000..f9f4a82a --- /dev/null +++ b/bin/gem-next-diff @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'gem-next-diff' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'pathname' +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path('bundle', __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path('next_rails', 'gem-next-diff') diff --git a/bin/next b/bin/next new file mode 100755 index 00000000..e813021d --- /dev/null +++ b/bin/next @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'next' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'pathname' +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path('bundle', __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path('next_rails', 'next') From 5c5374252ce9b040978c55a68d7193db696ee93c Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Fri, 11 Feb 2022 16:49:42 +0100 Subject: [PATCH 12/29] Fix HasManyThroughOrderErrors --- app/models/conference.rb | 2 +- app/models/user.rb | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/models/conference.rb b/app/models/conference.rb index 8d0b786d..cac3a849 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -28,8 +28,8 @@ class Conference < ApplicationRecord delegate :city, :country_name, to: :venue, allow_nil: true delegate :name, :street, to: :venue, prefix: true, allow_nil: true - has_many :physical_tickets, through: :ticket_purchases has_many :ticket_purchases, dependent: :destroy + has_many :physical_tickets, through: :ticket_purchases has_many :payments, dependent: :destroy has_many :supporters, through: :ticket_purchases, source: :user has_many :tickets, dependent: :destroy diff --git a/app/models/user.rb b/app/models/user.rb index 7c764fa1..c7e45732 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -7,7 +7,6 @@ class UserDisabled < StandardError end class User < ApplicationRecord - rolify # prevent N+1 queries with has_cached_role? by preloading roles *always* default_scope { preload(:roles) } @@ -17,8 +16,15 @@ class User < ApplicationRecord where('ticket_purchases.conference_id = ?', conference) end end + has_many :tickets, through: :ticket_purchases, source: :ticket do + def for_registration conference + where(conference: conference, registration_ticket: true).first + end + end + has_many :users_roles has_many :roles, through: :users_roles, dependent: :destroy + rolify has_paper_trail on: [:create, :update], ignore: [:sign_in_count, :remember_created_at, :current_sign_in_at, :last_sign_in_at, :current_sign_in_ip, :last_sign_in_ip, :unconfirmed_email, :avatar_content_type, :avatar_file_size, :avatar_updated_at, :updated_at, :confirmation_sent_at, :confirmation_token, :reset_password_token] @@ -69,11 +75,7 @@ class User < ApplicationRecord end has_many :events_registrations, through: :registrations has_many :payments, dependent: :destroy - has_many :tickets, through: :ticket_purchases, source: :ticket do - def for_registration conference - where(conference: conference, registration_ticket: true).first - end - end + has_many :votes, dependent: :destroy has_many :voted_events, through: :votes, source: :events has_many :subscriptions, dependent: :destroy From 639fb5ff0d892b8330b8cd1b46fd544a927917df Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Fri, 11 Feb 2022 16:50:09 +0100 Subject: [PATCH 13/29] Supress money deprecation warnings https://github.com/RubyMoney/money#deprecation --- config/initializers/money.rb | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 config/initializers/money.rb diff --git a/config/initializers/money.rb b/config/initializers/money.rb new file mode 100644 index 00000000..e16ddcb9 --- /dev/null +++ b/config/initializers/money.rb @@ -0,0 +1,3 @@ +Money.locale_backend = :currency +Money.default_currency = 'USD' +Money.rounding_mode = BigDecimal::ROUND_HALF_EVEN From ca80b753e74558078b5c032a6c9d21d1b29fb29d Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Fri, 11 Feb 2022 16:55:39 +0100 Subject: [PATCH 14/29] Autocorrect Faker deprecations --- spec/factories/contacts.rb | 8 ++++---- spec/factories/events.rb | 2 +- spec/factories/tracks.rb | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/factories/contacts.rb b/spec/factories/contacts.rb index edec9ea9..1be2ab37 100644 --- a/spec/factories/contacts.rb +++ b/spec/factories/contacts.rb @@ -5,10 +5,10 @@ FactoryBot.define do social_tag { SecureRandom.urlsafe_base64(4) } email { Faker::Internet.email } sponsor_email { Faker::Internet.email } - facebook { Faker::Internet.url('facebook.com') } - googleplus { Faker::Internet.url('plus.google.com') } - twitter { Faker::Internet.url('twitter.com') } - instagram { Faker::Internet.url('instagram.com') } + facebook { Faker::Internet.url(host: 'facebook.com') } + googleplus { Faker::Internet.url(host: 'plus.google.com') } + twitter { Faker::Internet.url(host: 'twitter.com') } + instagram { Faker::Internet.url(host: 'instagram.com') } conference end diff --git a/spec/factories/events.rb b/spec/factories/events.rb index f7861705..34f64d83 100644 --- a/spec/factories/events.rb +++ b/spec/factories/events.rb @@ -5,7 +5,7 @@ FactoryBot.define do factory :event do title { Faker::Hipster.sentence } - abstract { Faker::Hipster.paragraph(2) } + abstract { Faker::Hipster.paragraph(sentence_count: 2) } program diff --git a/spec/factories/tracks.rb b/spec/factories/tracks.rb index 34bf1b9f..be57b94b 100644 --- a/spec/factories/tracks.rb +++ b/spec/factories/tracks.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :track do - name { Faker::Commerce.department(2, true) } + name { Faker::Commerce.department(max: 2, fixed_amount: true) } description { Faker::Lorem.sentence } color { Faker::Color.hex_color } short_name { SecureRandom.urlsafe_base64(5) } @@ -17,7 +17,7 @@ FactoryBot.define do start_date { Time.zone.today } end_date { Time.zone.today } room - relevance { Faker::Hipster.paragraph(2) } + relevance { Faker::Hipster.paragraph(sentence_count: 2) } end end end From 85dae98a766eda7b9337731dd72b39d116b207b1 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Mon, 14 Feb 2022 17:53:58 +0100 Subject: [PATCH 15/29] =?UTF-8?q?=F0=9F=91=8B=20update=5Fattributes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit You served us well... --- app/controllers/admin/booths_controller.rb | 2 +- app/controllers/admin/cfps_controller.rb | 2 +- .../admin/conferences_controller.rb | 2 +- .../admin/difficulty_levels_controller.rb | 2 +- .../admin/event_types_controller.rb | 2 +- app/controllers/admin/events_controller.rb | 4 +-- app/controllers/admin/lodgings_controller.rb | 2 +- .../admin/organizations_controller.rb | 2 +- app/controllers/admin/programs_controller.rb | 2 +- app/controllers/admin/questions_controller.rb | 4 +-- .../admin/registrations_controller.rb | 4 +-- app/controllers/admin/resources_controller.rb | 2 +- app/controllers/admin/roles_controller.rb | 2 +- app/controllers/admin/rooms_controller.rb | 2 +- .../admin/splashpages_controller.rb | 2 +- app/controllers/admin/sponsors_controller.rb | 2 +- .../admin/sponsorship_levels_controller.rb | 2 +- .../admin/survey_questions_controller.rb | 2 +- app/controllers/admin/surveys_controller.rb | 2 +- app/controllers/admin/tickets_controller.rb | 2 +- app/controllers/admin/tracks_controller.rb | 4 +-- app/controllers/admin/users_controller.rb | 2 +- app/controllers/admin/venues_controller.rb | 2 +- .../admin/volunteers_controller.rb | 2 +- app/controllers/booths_controller.rb | 2 +- .../conference_registrations_controller.rb | 2 +- app/controllers/surveys_controller.rb | 4 +-- app/controllers/tracks_controller.rb | 2 +- app/models/program.rb | 2 +- app/models/ticket_purchase.rb | 2 +- app/models/user.rb | 6 ++-- lib/tasks/data_demo.rake | 2 +- lib/tasks/demo_data_for_development.rake | 8 ++--- lib/tasks/version.rake | 4 +-- .../admin/versions_controller_spec.rb | 16 ++++----- ...conference_registration_controller_spec.rb | 2 +- spec/controllers/proposals_controller_spec.rb | 6 ++-- spec/factories/conferences.rb | 2 +- spec/features/versions_spec.rb | 34 +++++++++---------- spec/helpers/application_helper_spec.rb | 14 ++++---- spec/mailers/mailbot_spec.rb | 20 +++++------ spec/models/email_settings_spec.rb | 10 +++--- spec/models/program_spec.rb | 4 +-- spec/models/ticket_spec.rb | 8 ++--- spec/models/user_spec.rb | 10 +++--- spec/serializers/speaker_serializer_spec.rb | 2 +- 46 files changed, 109 insertions(+), 109 deletions(-) diff --git a/app/controllers/admin/booths_controller.rb b/app/controllers/admin/booths_controller.rb index dd4e5844..0a899921 100644 --- a/app/controllers/admin/booths_controller.rb +++ b/app/controllers/admin/booths_controller.rb @@ -53,7 +53,7 @@ module Admin def update @url = admin_conference_booth_path(@conference.short_title, @booth.id) - @booth.update_attributes(booth_params) + @booth.update(booth_params) if @booth.save redirect_to admin_conference_booths_path, diff --git a/app/controllers/admin/cfps_controller.rb b/app/controllers/admin/cfps_controller.rb index fab49f2f..cb43bf56 100644 --- a/app/controllers/admin/cfps_controller.rb +++ b/app/controllers/admin/cfps_controller.rb @@ -35,7 +35,7 @@ module Admin send_mail_on_cfp_dates_updates = @cfp.notify_on_cfp_date_update? - if @cfp.update_attributes(cfp_params) + if @cfp.update(cfp_params) ConferenceCfpUpdateMailJob.perform_later(@conference) if send_mail_on_cfp_dates_updates redirect_to admin_conference_program_cfps_path(@conference.short_title), notice: 'Call for papers successfully updated.' diff --git a/app/controllers/admin/conferences_controller.rb b/app/controllers/admin/conferences_controller.rb index f25f2cfe..2dcd5a27 100644 --- a/app/controllers/admin/conferences_controller.rb +++ b/app/controllers/admin/conferences_controller.rb @@ -91,7 +91,7 @@ module Admin @conference.assign_attributes(conference_params) send_mail_on_conf_update = @conference.notify_on_dates_changed? - if @conference.update_attributes(conference_params) + if @conference.update(conference_params) ConferenceDateUpdateMailJob.perform_later(@conference) if send_mail_on_conf_update redirect_to edit_admin_conference_path(id: @conference.short_title), notice: 'Conference was successfully updated.' diff --git a/app/controllers/admin/difficulty_levels_controller.rb b/app/controllers/admin/difficulty_levels_controller.rb index 30c57452..e5717f7e 100644 --- a/app/controllers/admin/difficulty_levels_controller.rb +++ b/app/controllers/admin/difficulty_levels_controller.rb @@ -28,7 +28,7 @@ module Admin end def update - if @difficulty_level.update_attributes(difficulty_level_params) + if @difficulty_level.update(difficulty_level_params) redirect_to admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title), notice: 'Difficulty level successfully updated.' else diff --git a/app/controllers/admin/event_types_controller.rb b/app/controllers/admin/event_types_controller.rb index 137e8f00..a171b427 100644 --- a/app/controllers/admin/event_types_controller.rb +++ b/app/controllers/admin/event_types_controller.rb @@ -26,7 +26,7 @@ module Admin end def update - if @event_type.update_attributes(event_type_params) + if @event_type.update(event_type_params) redirect_to admin_conference_program_event_types_path(conference_id: @conference.short_title), notice: 'Event type successfully updated.' else diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index 9db4a438..7187940e 100644 --- a/app/controllers/admin/events_controller.rb +++ b/app/controllers/admin/events_controller.rb @@ -72,7 +72,7 @@ module Admin def update @languages = @program.languages_list - if @event.update_attributes(event_params) + if @event.update(event_params) if request.xhr? render js: 'index' @@ -142,7 +142,7 @@ module Admin @votes = @event.votes.includes(:user) if (votes = current_user.votes.find_by_event_id(params[:id])) - votes.update_attributes(rating: params[:rating]) + votes.update(rating: params[:rating]) else @myvote = @event.votes.build @myvote.user = current_user diff --git a/app/controllers/admin/lodgings_controller.rb b/app/controllers/admin/lodgings_controller.rb index 7a095e3d..639e0544 100644 --- a/app/controllers/admin/lodgings_controller.rb +++ b/app/controllers/admin/lodgings_controller.rb @@ -26,7 +26,7 @@ module Admin def edit; end def update - if @lodging.update_attributes(lodging_params) + if @lodging.update(lodging_params) redirect_to admin_conference_lodgings_path(conference_id: @conference.short_title), notice: 'Lodging successfully updated.' else diff --git a/app/controllers/admin/organizations_controller.rb b/app/controllers/admin/organizations_controller.rb index ca1ec5b9..14ff040d 100644 --- a/app/controllers/admin/organizations_controller.rb +++ b/app/controllers/admin/organizations_controller.rb @@ -27,7 +27,7 @@ module Admin def edit; end def update - if @organization.update_attributes(organization_params) + if @organization.update(organization_params) redirect_to admin_organizations_path, notice: 'Organization successfully updated' else diff --git a/app/controllers/admin/programs_controller.rb b/app/controllers/admin/programs_controller.rb index 634b0726..09a86099 100644 --- a/app/controllers/admin/programs_controller.rb +++ b/app/controllers/admin/programs_controller.rb @@ -16,7 +16,7 @@ module Admin send_mail_on_schedule_public = @program.notify_on_schedule_public? event_schedules_count_was = @program.event_schedules.count - if @program.update_attributes(program_params) + if @program.update(program_params) ConferenceScheduleUpdateMailJob.perform_later(@conference) if send_mail_on_schedule_public respond_to do |format| format.html do diff --git a/app/controllers/admin/questions_controller.rb b/app/controllers/admin/questions_controller.rb index 1905d36c..3d67cf96 100644 --- a/app/controllers/admin/questions_controller.rb +++ b/app/controllers/admin/questions_controller.rb @@ -48,7 +48,7 @@ module Admin # PUT questions/1 def update - if @question.update_attributes(question_params) + if @question.update(question_params) redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Question '#{@question.title}' for #{@conference.short_title} successfully updated." else redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed. #{@question.errors.full_messages.join('. ')}" @@ -58,7 +58,7 @@ module Admin # Update questions used for the conference def update_conference authorize! :update, Question.new(conference_id: @conference.id) - if @conference.update_attributes(conference_params) + if @conference.update(conference_params) redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Questions for #{@conference.short_title} successfully updated." else redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed." diff --git a/app/controllers/admin/registrations_controller.rb b/app/controllers/admin/registrations_controller.rb index ef94ae2e..3ef0da1c 100644 --- a/app/controllers/admin/registrations_controller.rb +++ b/app/controllers/admin/registrations_controller.rb @@ -37,9 +37,9 @@ module Admin def edit; end def update - @user.update_attributes(user_params) + @user.update(user_params) - @registration.update_attributes(registration_params) + @registration.update(registration_params) if @registration.save redirect_to admin_conference_registrations_path(@conference.short_title), notice: "Successfully updated registration for #{@registration.user.email}!" diff --git a/app/controllers/admin/resources_controller.rb b/app/controllers/admin/resources_controller.rb index af75e428..a6e51e99 100644 --- a/app/controllers/admin/resources_controller.rb +++ b/app/controllers/admin/resources_controller.rb @@ -25,7 +25,7 @@ module Admin end def update - if @resource.update_attributes(resource_params) + if @resource.update(resource_params) redirect_to admin_conference_resources_path(conference_id: @conference.short_title), notice: 'Resource successfully updated.' else diff --git a/app/controllers/admin/roles_controller.rb b/app/controllers/admin/roles_controller.rb index 98e2e13c..ca455dce 100644 --- a/app/controllers/admin/roles_controller.rb +++ b/app/controllers/admin/roles_controller.rb @@ -36,7 +36,7 @@ module Admin def update role_name = @role.name - if @role.update_attributes(role_params) + if @role.update(role_params) url = if @track admin_conference_program_track_role_path(@conference.short_title, @track, @role.name) else diff --git a/app/controllers/admin/rooms_controller.rb b/app/controllers/admin/rooms_controller.rb index c4fac65d..af83d5cb 100644 --- a/app/controllers/admin/rooms_controller.rb +++ b/app/controllers/admin/rooms_controller.rb @@ -26,7 +26,7 @@ module Admin end def update - if @room.update_attributes(room_params) + if @room.update(room_params) redirect_to admin_conference_venue_rooms_path(conference_id: @conference.short_title), notice: 'Room successfully updated.' else diff --git a/app/controllers/admin/splashpages_controller.rb b/app/controllers/admin/splashpages_controller.rb index fd432cde..6b40d0d1 100644 --- a/app/controllers/admin/splashpages_controller.rb +++ b/app/controllers/admin/splashpages_controller.rb @@ -25,7 +25,7 @@ module Admin end def update - if @splashpage.update_attributes(splashpage_params) + if @splashpage.update(splashpage_params) redirect_to admin_conference_splashpage_path, notice: 'Splashpage successfully updated.' else diff --git a/app/controllers/admin/sponsors_controller.rb b/app/controllers/admin/sponsors_controller.rb index ca57d4a0..bc61d834 100644 --- a/app/controllers/admin/sponsors_controller.rb +++ b/app/controllers/admin/sponsors_controller.rb @@ -28,7 +28,7 @@ module Admin end def update - if @sponsor.update_attributes(sponsor_params) + if @sponsor.update(sponsor_params) redirect_to admin_conference_sponsors_path( conference_id: @conference.short_title), notice: 'Sponsor successfully updated.' diff --git a/app/controllers/admin/sponsorship_levels_controller.rb b/app/controllers/admin/sponsorship_levels_controller.rb index 9f59d4ca..443aa8b9 100644 --- a/app/controllers/admin/sponsorship_levels_controller.rb +++ b/app/controllers/admin/sponsorship_levels_controller.rb @@ -27,7 +27,7 @@ module Admin end def update - if @sponsorship_level.update_attributes(sponsorship_level_params) + if @sponsorship_level.update(sponsorship_level_params) redirect_to admin_conference_sponsorship_levels_path( conference_id: @conference.short_title), notice: 'Sponsorship level successfully updated.' diff --git a/app/controllers/admin/survey_questions_controller.rb b/app/controllers/admin/survey_questions_controller.rb index b425fc4b..61febf1d 100644 --- a/app/controllers/admin/survey_questions_controller.rb +++ b/app/controllers/admin/survey_questions_controller.rb @@ -28,7 +28,7 @@ module Admin # PUT questions/1 def update - if @survey_question.update_attributes(survey_question_params) + if @survey_question.update(survey_question_params) redirect_to admin_conference_survey_path(@conference.short_title, @survey), notice: 'Successfully updated Survey Question.' else @url = admin_conference_survey_survey_question_path(@conference.short_title, @survey, @survey_question) diff --git a/app/controllers/admin/surveys_controller.rb b/app/controllers/admin/surveys_controller.rb index 0cef238f..8054cc44 100644 --- a/app/controllers/admin/surveys_controller.rb +++ b/app/controllers/admin/surveys_controller.rb @@ -28,7 +28,7 @@ module Admin end def update - if @survey.update_attributes(survey_params) + if @survey.update(survey_params) redirect_to admin_conference_surveys_path(@conference.short_title) else @url = admin_conference_survey_path(@conference.short_title, @survey) diff --git a/app/controllers/admin/tickets_controller.rb b/app/controllers/admin/tickets_controller.rb index 6635ed29..b19032a9 100644 --- a/app/controllers/admin/tickets_controller.rb +++ b/app/controllers/admin/tickets_controller.rb @@ -29,7 +29,7 @@ module Admin def edit; end def update - if @ticket.update_attributes(ticket_params) + if @ticket.update(ticket_params) redirect_to admin_conference_tickets_path(conference_id: @conference.short_title), notice: 'Ticket successfully updated.' else diff --git a/app/controllers/admin/tracks_controller.rb b/app/controllers/admin/tracks_controller.rb index 511a4fa9..77de53f4 100644 --- a/app/controllers/admin/tracks_controller.rb +++ b/app/controllers/admin/tracks_controller.rb @@ -56,7 +56,7 @@ module Admin def edit; end def update - if @track.update_attributes(track_params) + if @track.update(track_params) redirect_to admin_conference_program_tracks_path(conference_id: @conference.short_title), notice: 'Track successfully updated.' else @@ -122,7 +122,7 @@ module Admin end def update_selected_schedule - if @track.update_attributes(params.require(:track).permit(:selected_schedule_id)) + if @track.update(params.require(:track).permit(:selected_schedule_id)) respond_to do |format| format.js { render json: {} } end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 4d7925dd..570e28b4 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -56,7 +56,7 @@ module Admin end end - if @user.update_attributes(user_params) + if @user.update(user_params) redirect_to admin_users_path, notice: "Updated #{@user.name} (#{@user.email})!" + message else redirect_to admin_users_path, error: "Could not update #{@user.name} (#{@user.email}). #{@user.errors.full_messages.join('. ')}." diff --git a/app/controllers/admin/venues_controller.rb b/app/controllers/admin/venues_controller.rb index 79de3c8f..17ba4c99 100644 --- a/app/controllers/admin/venues_controller.rb +++ b/app/controllers/admin/venues_controller.rb @@ -25,7 +25,7 @@ module Admin end def update - if @venue.update_attributes(venue_params) + if @venue.update(venue_params) redirect_to admin_conference_venue_path(conference_id: @conference.short_title), notice: 'Venue was successfully updated.' else diff --git a/app/controllers/admin/volunteers_controller.rb b/app/controllers/admin/volunteers_controller.rb index dc310d17..b0b85ffc 100644 --- a/app/controllers/admin/volunteers_controller.rb +++ b/app/controllers/admin/volunteers_controller.rb @@ -26,7 +26,7 @@ module Admin end def update - if @conference.update_attributes(conference_params) + if @conference.update(conference_params) redirect_to admin_conference_volunteers_info_path(conference_id: params[:conference_id]), notice: 'Volunteering options were successfully updated.' else redirect_to admin_conference_volunteers_info_path(conference_id: params[:conference_id]), error: "Volunteering options update failed: #{@conference.errors.full_messages.join '. '}" diff --git a/app/controllers/booths_controller.rb b/app/controllers/booths_controller.rb index 959c9d5d..f8057637 100644 --- a/app/controllers/booths_controller.rb +++ b/app/controllers/booths_controller.rb @@ -36,7 +36,7 @@ class BoothsController < ApplicationController def update @url = conference_booth_path(@conference.short_title, @booth.id) - @booth.update_attributes(booth_params) + @booth.update(booth_params) if @booth.save redirect_to conference_booths_path, diff --git a/app/controllers/conference_registrations_controller.rb b/app/controllers/conference_registrations_controller.rb index 887d0ce1..e2e75452 100644 --- a/app/controllers/conference_registrations_controller.rb +++ b/app/controllers/conference_registrations_controller.rb @@ -72,7 +72,7 @@ class ConferenceRegistrationsController < ApplicationController end def update - if @registration.update_attributes(registration_params) + if @registration.update(registration_params) redirect_to conference_conference_registration_path(@conference.short_title), notice: 'Registration was successfully updated.' else diff --git a/app/controllers/surveys_controller.rb b/app/controllers/surveys_controller.rb index 349bc34b..fdf24963 100644 --- a/app/controllers/surveys_controller.rb +++ b/app/controllers/surveys_controller.rb @@ -27,14 +27,14 @@ class SurveysController < ApplicationController reply_text = survey_submission[survey_question.id.to_s].reject(&:blank?).join(',') if reply - reply.update_attributes(text: reply_text) unless reply.text == reply_text + reply.update(text: reply_text) unless reply.text == reply_text else survey_question.survey_replies.create!(text: reply_text, user: current_user) end user_survey_submission = @survey.survey_submissions.find_by(user: current_user) if user_survey_submission - user_survey_submission.update_attributes(updated_at: Time.current) + user_survey_submission.update_attribute(:updated_at, Time.current) else @survey.survey_submissions.create!(user: current_user) end diff --git a/app/controllers/tracks_controller.rb b/app/controllers/tracks_controller.rb index ad418d46..6db26991 100644 --- a/app/controllers/tracks_controller.rb +++ b/app/controllers/tracks_controller.rb @@ -31,7 +31,7 @@ class TracksController < ApplicationController end def update - if @track.update_attributes(track_params) + if @track.update(track_params) redirect_to conference_program_tracks_path(conference_id: @conference.short_title), notice: 'Track request successfully updated.' else diff --git a/app/models/program.rb b/app/models/program.rb index 8db24c6c..f367d1b2 100644 --- a/app/models/program.rb +++ b/app/models/program.rb @@ -268,7 +268,7 @@ class Program < ApplicationRecord def normalize_event_types_length event_types.each do |event_type| new_length = event_type.length > schedule_interval ? event_type.length - (event_type.length % schedule_interval) : schedule_interval - event_type.update_attributes length: new_length + event_type.update_attribute(:length, new_length) end end end diff --git a/app/models/ticket_purchase.rb b/app/models/ticket_purchase.rb index 129d7916..f8e6c210 100644 --- a/app/models/ticket_purchase.rb +++ b/app/models/ticket_purchase.rb @@ -77,7 +77,7 @@ class TicketPurchase < ApplicationRecord end def pay(payment) - update_attributes(paid: true, payment: payment) + update(paid: true, payment: payment) PhysicalTicket.transaction do quantity.times { physical_tickets.create } end diff --git a/app/models/user.rb b/app/models/user.rb index c7e45732..86c197db 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -156,9 +156,9 @@ class User < ApplicationRecord raise UserDisabled if user&.is_disabled if user - user.update_attributes(email: attributes[:email], - last_sign_in_at: user.current_sign_in_at, - current_sign_in_at: Time.current) + user.update(email: attributes[:email], + last_sign_in_at: user.current_sign_in_at, + current_sign_in_at: Time.current) else begin user = create!(username: username, email: attributes[:email]) diff --git a/lib/tasks/data_demo.rake b/lib/tasks/data_demo.rake index 4209e799..ae57b717 100644 --- a/lib/tasks/data_demo.rake +++ b/lib/tasks/data_demo.rake @@ -6,7 +6,7 @@ namespace :data do task demo: :environment do include FactoryBot::Syntax::Methods conference = create(:full_conference, title: 'Open Source Event Manager Demo', short_title: 'osemdemo' ,description: "This is a [Open Source Event Manager](http://osem.io/) demo instance. You can log in as **admin** with the password **password123** or just you just [sign up](/accounts/sign_up) with your own user. We hope you enjoy checking out all the functionality, if you have questions don't hesitate to [contact us](http://osem.io/#contact)!\r\n\r\n## Data will be destroyed every thirty minutes or whenever someone updates the [OSEM source code on github](https://github.com/openSUSE/osem/commits/master).") - conference.contact.update_attributes(email: 'osemdemo@osem.io', sponsor_email: 'osemdemo@osem.io') + conference.contact.update(email: 'osemdemo@osem.io', sponsor_email: 'osemdemo@osem.io') create(:admin, email: 'admin@osem.io', username: 'admin', password: 'password123', password_confirmation: 'password123') end end diff --git a/lib/tasks/demo_data_for_development.rake b/lib/tasks/demo_data_for_development.rake index d54f8cfb..7a40d19f 100644 --- a/lib/tasks/demo_data_for_development.rake +++ b/lib/tasks/demo_data_for_development.rake @@ -36,7 +36,7 @@ namespace :data do selected_schedule = create(:schedule, program: program) demo_schedule = create(:schedule, program: program) - program.update_attributes!(selected_schedule: selected_schedule) + program.update_attribute(:selected_schedule, selected_schedule) create(:event, program: program, title: 'Demo Event', abstract: 'This is a demo event instance whose state not defined.') create(:event, program: program, title: 'Demo Rejected Event', state: 'rejected', abstract: 'This is demo event instance in a rejected state.') @@ -72,9 +72,9 @@ namespace :data do # So that events can be created without any failure in validations. conference = create(:full_conference, title: 'Jangouts Demo Conference', short_title: 'jangouts', start_date: 7.days.ago, end_date: 6.days.from_now, start_hour: 15, end_hour: 20, description: 'This is a full conference demo instance happened in the past. It contains open cfp, venue/rooms, submitted talks by multiple speakers, partly confirmed talks and multiple schedules.') generate_program conference - conference.program.cfp.update_attributes!(start_date: 4.days.ago, end_date: 2.days.ago) - conference.update_attributes!(end_date: 1.day.ago) - conference.registration_period.update_attributes!(start_date: 9.days.ago, end_date: 8.days.ago) + conference.program.cfp.update!(start_date: 4.days.ago, end_date: 2.days.ago) + conference.update_attribute!(:end_date, 1.day.ago) + conference.registration_period.update!(start_date: 9.days.ago, end_date: 8.days.ago) # This is a conference that will happen in the future # It only has a registration period and unscheduled events diff --git a/lib/tasks/version.rake b/lib/tasks/version.rake index 0827e6a5..da3d270c 100644 --- a/lib/tasks/version.rake +++ b/lib/tasks/version.rake @@ -7,7 +7,7 @@ namespace :data do PaperTrail::Version.where(conference_id: nil, item_type: %w[Conference Event]).each do |version| # All pre-existing versions are either of Conference or Event if version.item_type == 'Conference' - version.update_attributes(conference_id: version.item_id) + version.update_attribute(:conference_id, version.item_id) elsif version.item_type == 'Event' event = version.item @@ -30,7 +30,7 @@ namespace :data do puts "Setting conference_id value failed for PaperTrail::Version object with ID=#{version.id}" nil end - version.update_attributes(conference_id: conference_id) + version.update_attribute(:conference_id, conference_id) end end puts 'All done!' diff --git a/spec/controllers/admin/versions_controller_spec.rb b/spec/controllers/admin/versions_controller_spec.rb index 69e3d362..654909db 100644 --- a/spec/controllers/admin/versions_controller_spec.rb +++ b/spec/controllers/admin/versions_controller_spec.rb @@ -17,7 +17,7 @@ describe Admin::VersionsController do end it 'reverts all changes for update actions' do - conference.update_attributes(short_title: 'testtitle', description: 'Some random text') + conference.update(short_title: 'testtitle', description: 'Some random text') get :revert_object, params: { id: conference.versions.last.id } conference.reload expect(conference.short_title).to eq 'exampletitle' @@ -62,7 +62,7 @@ describe Admin::VersionsController do end it 'reverts specified change for update actions' do - conference.update_attributes(short_title: 'testtitle', description: 'Some random text') + conference.update(short_title: 'testtitle', description: 'Some random text') get :revert_attribute, params: { id: conference.versions.last.id, attribute: 'short_title' } conference.reload expect(conference.short_title).to eq 'exampletitle' @@ -70,8 +70,8 @@ describe Admin::VersionsController do end it 'shows correct flash on trying to revert to the current state' do - conference.update_attributes(short_title: 'testtitle', description: 'Some random text') - conference.update_attributes(short_title: 'exampletitle') + conference.update(short_title: 'testtitle', description: 'Some random text') + conference.update_attribute(:short_title, 'exampletitle') get :revert_attribute, params: { id: conference.versions[-2].id, attribute: 'short_title' } expect(flash[:error]).to match('The item is already in the state that you are trying to revert it back to') expect(conference.short_title).to eq 'exampletitle' @@ -79,7 +79,7 @@ describe Admin::VersionsController do it 'fails on trying to revert deleted object' do event_type = conference.program.event_types.first - event_type.update_attributes(title: 'New Event Title') + event_type.update_attribute(:title, 'New Event Title') event_type.destroy get :revert_attribute, params: { id: event_type.versions[-2].id, attribute: 'title' } conference.reload @@ -93,7 +93,7 @@ describe Admin::VersionsController do end it 'revert fails when attribute is invalid' do - conference.update_attributes(short_title: 'testtitle', description: 'Some random text') + conference.update(short_title: 'testtitle', description: 'Some random text') before_conference_title = conference.title # Note: even though title is a valid attribute of conference, it was not updated in the change we are trying to revert get :revert_attribute, params: { id: conference.versions.last.id, attribute: 'title' } @@ -117,12 +117,12 @@ describe Admin::VersionsController do before :each do @user = create(:user) - conference.update_attributes(short_title: 'testtitle', description: 'Some random text') + conference.update(short_title: 'testtitle', description: 'Some random text') @version_organizer = conference.versions.last cfp = create(:cfp, program: conference.program) @version_cfp = cfp.versions.last registration = create(:registration, conference: conference) - registration.update_attributes(attended: true) + registration.update_attribute(:attended, true) @version_info_desk = registration.versions.last end diff --git a/spec/controllers/conference_registration_controller_spec.rb b/spec/controllers/conference_registration_controller_spec.rb index 964acaac..5ed47c1f 100644 --- a/spec/controllers/conference_registration_controller_spec.rb +++ b/spec/controllers/conference_registration_controller_spec.rb @@ -316,7 +316,7 @@ describe ConferenceRegistrationsController, type: :controller do context 'update fails' do before do - allow_any_instance_of(Registration).to receive(:update_attributes).and_return(false) + allow_any_instance_of(Registration).to receive(:update).and_return(false) patch :update, params: { registration: attributes_for(:registration, volunteer: true), conference_id: conference.short_title diff --git a/spec/controllers/proposals_controller_spec.rb b/spec/controllers/proposals_controller_spec.rb index db52ffd1..b591bb2a 100644 --- a/spec/controllers/proposals_controller_spec.rb +++ b/spec/controllers/proposals_controller_spec.rb @@ -415,7 +415,7 @@ describe ProposalsController do end describe 'PATCH #confirm' do - before { event.update_attributes(state: 'unconfirmed') } + before { event.update_attribute(:state, 'unconfirmed') } context 'confirmed successfully' do describe 'when require_registration is set' do @@ -501,7 +501,7 @@ describe ProposalsController do context 'event save fails' do before do - event.update_attributes(state: 'unconfirmed') + event.update_attribute(:state, 'unconfirmed') allow_any_instance_of(Event).to receive(:save).and_return(false) patch :confirm, params: { conference_id: conference.short_title, id: event.id } end @@ -521,7 +521,7 @@ describe ProposalsController do end describe 'PATCH #restart' do - before { event.update_attributes(state: 'withdrawn') } + before { event.update_attribute(:state, 'withdrawn') } it 'assigns url variable' do patch :restart, params: { conference_id: conference.short_title, id: event.id } diff --git a/spec/factories/conferences.rb b/spec/factories/conferences.rb index dcb0e662..ac454c92 100644 --- a/spec/factories/conferences.rb +++ b/spec/factories/conferences.rb @@ -33,7 +33,7 @@ FactoryBot.define do # Contact/Program is created by Conference callbacks conference.contact.destroy conference.contact = create(:contact, conference: conference) - conference.program.update_attributes(schedule_public: true) + conference.program.update_attribute(:schedule_public, true) create(:cfp, program: conference.program) create_list(:track, 2, program: conference.program) diff --git a/spec/features/versions_spec.rb b/spec/features/versions_spec.rb index 4c02cee7..399091b5 100644 --- a/spec/features/versions_spec.rb +++ b/spec/features/versions_spec.rb @@ -35,7 +35,7 @@ feature 'Version' do end scenario 'display changes in cfp', feature: true, versioning: true, js: true do - cfp.update_attributes(start_date: (Time.zone.today + 1).strftime('%d/%m/%Y'), end_date: (Time.zone.today + 3).strftime('%d/%m/%Y')) + cfp.update(start_date: (Time.zone.today + 1).strftime('%d/%m/%Y'), end_date: (Time.zone.today + 3).strftime('%d/%m/%Y')) cfp_id = cfp.id cfp.destroy @@ -47,7 +47,7 @@ feature 'Version' do scenario 'display changes in registration_period', feature: true, versioning: true, js: true do registration_period = create(:registration_period, conference: conference) - registration_period.update_attributes(start_date: (Time.zone.today + 1).strftime('%d/%m/%Y'), end_date: (Time.zone.today + 3).strftime('%d/%m/%Y')) + registration_period.update(start_date: (Time.zone.today + 1).strftime('%d/%m/%Y'), end_date: (Time.zone.today + 3).strftime('%d/%m/%Y')) registration_period_id = registration_period.id registration_period.destroy @@ -60,7 +60,7 @@ feature 'Version' do scenario 'display changes in conference', feature: true, versioning: true, js: true do new_conference = create(:conference, title: 'Test Conference') organizer.add_role :organizer, new_conference - new_conference.update_attributes(title: 'New Con', short_title: 'NewCon') + new_conference.update(title: 'New Con', short_title: 'NewCon') visit admin_revision_history_path select '100', from: 'versionstable_length' @@ -72,7 +72,7 @@ feature 'Version' do scenario 'display changes in event_type', feature: true, versioning: true, js: true do event_type = create(:event_type, program: conference.program, name: 'Discussion') - event_type.update_attributes(length: 90, maximum_abstract_length: 10000) + event_type.update(length: 90, maximum_abstract_length: 10000) event_type_id = event_type.id event_type.destroy @@ -84,7 +84,7 @@ feature 'Version' do scenario 'display changes in lodging', feature: true, versioning: true, js: true do lodging = create(:lodging, conference: conference, name: 'Hotel XYZ') - lodging.update_attributes(description: 'Nice view,close to venue', website_link: 'http://www.example.com') + lodging.update(description: 'Nice view,close to venue', website_link: 'http://www.example.com') lodging_id = lodging.id lodging.destroy @@ -106,7 +106,7 @@ feature 'Version' do scenario 'display changes in room', feature: true, versioning: true, js: true do venue = create(:venue, conference: conference) room = create(:room, venue: venue, name: 'Auditorium') - room.update_attributes(size: 120) + room.update_attribute(:size, 120) room_id = room.id room.destroy @@ -119,7 +119,7 @@ feature 'Version' do scenario 'display changes in sponsor', feature: true, versioning: true, js: true do conference.sponsorship_levels << create_list(:sponsorship_level, 2, conference: conference) sponsor = create(:sponsor, conference: conference, name: 'SUSE', sponsorship_level: conference.sponsorship_levels.first) - sponsor.update_attributes(website_url: 'https://www.suse.com/company/history', sponsorship_level: conference.sponsorship_levels.second) + sponsor.update(website_url: 'https://www.suse.com/company/history', sponsorship_level: conference.sponsorship_levels.second) sponsor.destroy sponsor_id = sponsor.id @@ -131,7 +131,7 @@ feature 'Version' do scenario 'display changes in sponsorship_level', feature: true, versioning: true, js: true do sponsorship_level = create(:sponsorship_level, conference: conference) - sponsorship_level.update_attributes(title: 'Gold') + sponsorship_level.update_attribute(:title, 'Gold') sponsorship_level_id = sponsorship_level.id sponsorship_level.destroy @@ -143,7 +143,7 @@ feature 'Version' do scenario 'display changes in ticket', feature: true, versioning: true, js: true do ticket = create(:ticket, conference: conference, title: 'Gold') - ticket.update_attributes(price: 50, description: 'Premium Ticket') + ticket.update(price: 50, description: 'Premium Ticket') ticket_id = ticket.id ticket.destroy @@ -155,7 +155,7 @@ feature 'Version' do scenario 'display changes in track', feature: true, versioning: true, js: true do track = create(:track, program: conference.program, name: 'Distribution') - track.update_attributes(description: 'Events about Linux distributions') + track.update_attribute(:description, 'Events about Linux distributions') track_id = track.id track.destroy @@ -167,7 +167,7 @@ feature 'Version' do scenario 'display changes in venue', feature: true, versioning: true, js: true do venue = create(:venue, conference: conference, name: 'Example University') - venue.update_attributes(website: 'www.example.com new', description: 'Just another beautiful venue') + venue.update(website: 'www.example.com new', description: 'Just another beautiful venue') venue_id = venue.id venue.destroy @@ -221,7 +221,7 @@ feature 'Version' do scenario 'display changes in difficulty levels', feature: true, versioning: true, js: true do difficulty_level = create(:difficulty_level, program: conference.program, title: 'Expert') - difficulty_level.update_attributes(description: 'Only for Experts') + difficulty_level.update_attribute(:description, 'Only for Experts') difficulty_level_id = difficulty_level.id difficulty_level.destroy @@ -273,7 +273,7 @@ feature 'Version' do scenario 'display changes in conference commercials', feature: true, versioning: true, js: true do conference_commercial = create(:conference_commercial, commercialable: conference) - conference_commercial.update_attributes(url: 'https://www.youtube.com/watch?v=VNkDJk5_9eU') + conference_commercial.update_attribute(:url, 'https://www.youtube.com/watch?v=VNkDJk5_9eU') conference_commercial.destroy visit admin_revision_history_path @@ -284,7 +284,7 @@ feature 'Version' do scenario 'display changes in event commercials', feature: true, versioning: true, js: true do event_commercial - event_commercial.update_attributes(url: 'https://www.youtube.com/watch?v=VNkDJk5_9eU') + event_commercial.update_attribute(:url, 'https://www.youtube.com/watch?v=VNkDJk5_9eU') event_commercial.destroy visit admin_revision_history_path @@ -354,7 +354,7 @@ feature 'Version' do end scenario 'display changes in email settings', feature: true, versioning: true, js: true do - conference.email_settings.update_attributes(registration_subject: 'xxxxx', registration_body: 'yyyyy', accepted_subject: 'zzzzz') + conference.email_settings.update(registration_subject: 'xxxxx', registration_body: 'yyyyy', accepted_subject: 'zzzzz') visit admin_revision_history_path expect(page).to have_text("Someone (probably via the console) updated registration body, registration subject and accepted subject of email settings in conference #{conference.short_title}") @@ -374,7 +374,7 @@ feature 'Version' do registration = Registration.create(user: organizer, conference: conference) event = create(:event, program: conference.program, title: 'My second event') EventsRegistration.create(registration: registration, event: event) - EventsRegistration.first.update_attributes(attended: true) + EventsRegistration.first.update_attribute(:attended, true) EventsRegistration.last.destroy # Here registration is deleted to ensure the event registration related change still displays the associated user's name registration.destroy @@ -433,7 +433,7 @@ feature 'Version' do scenario 'display updates to user', feature: true, versioning: true, js: true do user = create(:user) - user.update_attributes(nickname: 'testnick', affiliation: 'openSUSE') + user.update(nickname: 'testnick', affiliation: 'openSUSE') visit admin_revision_history_path expect(page).to have_text("Someone (probably via the console) updated nickname and affiliation of user #{user.name}") diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index cc0caeb9..95d87059 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -29,7 +29,7 @@ describe ApplicationHelper, type: :helper do before :each do @other_event = create(:event, program: conference.program, state: 'confirmed') schedule = create(:schedule, program: conference.program) - conference.program.update_attributes!(selected_schedule: schedule) + conference.program.update_attribute(:selected_schedule, schedule) @event_schedule = create(:event_schedule, event: event, start_time: conference.start_date + conference.start_hour.hours, room: create(:room), schedule: schedule) @other_event_schedule = create(:event_schedule, event: @other_event, start_time: conference.start_date + conference.start_hour.hours, room: create(:room), schedule: schedule) end @@ -40,7 +40,7 @@ describe ApplicationHelper, type: :helper do end it 'when event is in between the other event' do - @event_schedule.update_attributes!(start_time: @other_event_schedule.start_time + 10.minutes) + @event_schedule.update_attribute(:start_time, @other_event_schedule.start_time + 10.minutes) expect(concurrent_events(event).include?(@other_event)).to eq true end end @@ -52,12 +52,12 @@ describe ApplicationHelper, type: :helper do end it 'when one event starts and other ends at the same time' do - @event_schedule.update_attributes!(start_time: @other_event_schedule.end_time) + @event_schedule.update_attribute(:start_time, @other_event_schedule.end_time) expect(concurrent_events(event).present?).to eq false end it 'when conference program does not have a selected schedule' do - conference.program.update_attributes!(selected_schedule_id: nil) + conference.program.update_attribute(:selected_schedule_id, nil) expect(concurrent_events(event).present?).to eq false end end @@ -83,7 +83,7 @@ describe ApplicationHelper, type: :helper do context 'first sponsorship_level' do before do first_sponsorship_level = create(:sponsorship_level, position: 1) - sponsor.update_attributes(sponsorship_level: first_sponsorship_level) + sponsor.update_attribute(:sponsorship_level, first_sponsorship_level) end it 'returns correct url' do @@ -94,7 +94,7 @@ describe ApplicationHelper, type: :helper do context 'second sponsorship_level' do before do second_sponsorship_level = create(:sponsorship_level, position: 2) - sponsor.update_attributes(sponsorship_level: second_sponsorship_level) + sponsor.update_attribute(:sponsorship_level, second_sponsorship_level) end it 'returns correct url' do @@ -105,7 +105,7 @@ describe ApplicationHelper, type: :helper do context 'other sponsorship_level' do before do other_sponsorship_level = create(:sponsorship_level, position: 3) - sponsor.update_attributes(sponsorship_level: other_sponsorship_level) + sponsor.update_attribute(:sponsorship_level, other_sponsorship_level) end it 'returns correct url' do diff --git a/spec/mailers/mailbot_spec.rb b/spec/mailers/mailbot_spec.rb index 1cbdd8e7..39aaf3cf 100644 --- a/spec/mailers/mailbot_spec.rb +++ b/spec/mailers/mailbot_spec.rb @@ -7,7 +7,7 @@ describe Mailbot do let!(:email_settings) { create(:email_settings, conference: conference) } let(:user) { create(:user, email: 'user@example.com') } - before { conference.contact.update_attributes(email: 'conf@domain.com') } + before { conference.contact.update_attribute(:email, 'conf@domain.com') } context 'onboarding and proposal' do let(:event) { create(:event, program: conference.program, submitter: user) } @@ -39,9 +39,9 @@ describe Mailbot do describe '.acceptance_mail' do before do - conference.email_settings.update_attributes(send_on_accepted: true, - accepted_subject: 'Lorem Ipsum Dolsum', - accepted_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit') + conference.email_settings.update(send_on_accepted: true, + accepted_subject: 'Lorem Ipsum Dolsum', + accepted_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit') end include_examples 'mailer actions' do @@ -51,9 +51,9 @@ describe Mailbot do describe '.rejection_mail' do before do - conference.email_settings.update_attributes(send_on_rejected: true, - rejected_subject: 'Lorem Ipsum Dolsum', - rejected_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit') + conference.email_settings.update(send_on_rejected: true, + rejected_subject: 'Lorem Ipsum Dolsum', + rejected_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit') end include_examples 'mailer actions' do @@ -63,9 +63,9 @@ describe Mailbot do describe '.confirm_reminder_mail' do before do - conference.email_settings.update_attributes(send_on_confirmed_without_registration: true, - confirmed_without_registration_subject: 'Lorem Ipsum Dolsum', - confirmed_without_registration_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit') + conference.email_settings.update(send_on_confirmed_without_registration: true, + confirmed_without_registration_subject: 'Lorem Ipsum Dolsum', + confirmed_without_registration_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit') end include_examples 'mailer actions' do diff --git a/spec/models/email_settings_spec.rb b/spec/models/email_settings_spec.rb index f79857f7..4f7059d5 100644 --- a/spec/models/email_settings_spec.rb +++ b/spec/models/email_settings_spec.rb @@ -32,7 +32,7 @@ describe EmailSettings do context 'user does not have name' do before do - user.update_attributes(name: nil) + user.update(name: nil) username_hash = { 'name' => 'johnd' } expected_hash.merge!(username_hash) end @@ -59,7 +59,7 @@ describe EmailSettings do context 'conference has venue' do before do - conference.update_attributes(venue: create(:venue)) + conference.venue = create(:venue) venue_hash = { 'venue' => conference.venue.name, 'venue_address' => conference.venue.address } expected_hash.merge!(venue_hash) end @@ -71,9 +71,9 @@ describe EmailSettings do context 'conference has registration period' do before do - conference.update_attributes(registration_period: create(:registration_period, - start_date: Date.new(2014, 05, 03), - end_date: Date.new(2014, 05, 05))) + conference.registration_period = create(:registration_period, + start_date: Date.new(2014, 05, 03), + end_date: Date.new(2014, 05, 05)) registration_period_hash = { 'registration_start_date' => Date.new(2014, 05, 03), 'registration_end_date' => Date.new(2014, 05, 05) } expected_hash.merge!(registration_period_hash) end diff --git a/spec/models/program_spec.rb b/spec/models/program_spec.rb index 1aa7eb29..581fc185 100644 --- a/spec/models/program_spec.rb +++ b/spec/models/program_spec.rb @@ -192,8 +192,8 @@ describe Program do program.schedule_interval = 5 program.save! - program.event_types.first.update_attributes length: 5 - program.event_types.last.update_attributes length: 25 + program.event_types.first.update_attribute(:length, 5) + program.event_types.last.update_attribute(:length, 25) create(:event_type, program: program, length: 30) program.schedule_interval = 10 diff --git a/spec/models/ticket_spec.rb b/spec/models/ticket_spec.rb index 858e4d37..32dd30cf 100644 --- a/spec/models/ticket_spec.rb +++ b/spec/models/ticket_spec.rb @@ -84,7 +84,7 @@ describe Ticket do end context 'user has paid' do - before { ticket_purchase.update_attributes(paid: true) } + before { ticket_purchase.update_attribute(:paid, true) } it 'returns false' do expect(ticket.unpaid?(user)).to eq(false) @@ -120,7 +120,7 @@ describe Ticket do context 'user has paid' do let!(:ticket_purchase) { create(:ticket_purchase, user: user, ticket: ticket, quantity: 20) } - before { ticket_purchase.update_attributes(paid: true) } + before { ticket_purchase.update_attribute(:paid, true) } it 'returns the correct value if the user has bought and paid for this ticket' do expect(ticket.quantity_bought_by(user, paid: true)).to eq(20) @@ -145,7 +145,7 @@ describe Ticket do context 'user has paid' do let!(:ticket_purchase) { create(:ticket_purchase, user: user, ticket: ticket, quantity: 20) } - before { ticket_purchase.update_attributes(paid: true) } + before { ticket_purchase.update_attribute(:paid, true) } it 'returns the correct value if the user has bought this ticket' do expect(ticket.total_price(user, paid: true)).to eq(Money.new(100000, 'USD')) @@ -203,7 +203,7 @@ describe Ticket do it 'should allow currency update' do free_ticket = Ticket.first - expect { free_ticket.update_attributes(price_currency: 'INR') }.to change { free_ticket.reload.price_currency }.from('USD').to('INR') + expect { free_ticket.update_attribute(:price_currency, 'INR') }.to change { free_ticket.reload.price_currency }.from('USD').to('INR') end end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index eda4d725..9c87238b 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -118,7 +118,7 @@ describe User do describe '#attended_event?' do context 'user has attended to the event' do before do - events_registration.update_attributes(attended: true) + events_registration.update_attribute(:attended, true) end it 'returns true' do @@ -201,7 +201,7 @@ describe User do end describe '.for_ichain_username' do - before { user.update_attributes(current_sign_in_at: Date.new(2014, 12, 12)) } + before { user.update_attribute(:current_sign_in_at, Date.new(2014, 12, 12)) } context 'user exists' do it 'updates last_sign_in_at of user' do @@ -220,7 +220,7 @@ describe User do end context 'user is disabled' do - before { user.update_attributes(is_disabled: true) } + before { user.update_attribute(:is_disabled, true) } it 'User.for_ichain_username raises exception if user is disabled' do expect{ User.for_ichain_username(user.username, email: user.email) } @@ -292,7 +292,7 @@ describe User do let(:conf2_organizer_role) { Role.find_by(name: 'organizer', resource: conference2) } before do - user.update_attributes(role_ids: [organizer_role.id, cfp_role.id, conf2_organizer_role.id]) + user.update_attribute(:role_ids, [organizer_role.id, cfp_role.id, conf2_organizer_role.id]) end it 'returns hash of role and conference' do @@ -351,7 +351,7 @@ describe User do end context 'unconfirmed user' do - before { user.update_attributes(confirmed_at: nil) } + before { user.update_attribute(:confirmed_at, nil) } it 'returns false' do expect(user.confirmed?).to eq false diff --git a/spec/serializers/speaker_serializer_spec.rb b/spec/serializers/speaker_serializer_spec.rb index b3a1a869..9174795e 100644 --- a/spec/serializers/speaker_serializer_spec.rb +++ b/spec/serializers/speaker_serializer_spec.rb @@ -18,7 +18,7 @@ describe SpeakerSerializer, type: :serializer do end context 'speaker has biography' do - before{ speaker.update_attributes(biography: 'Doest of all Jon Does') } + before{ speaker.update_attribute(:biography, 'Doest of all Jon Does') } it 'sets name, affiliation and biography' do expected_json = { From 0eb7496502a784fddac27dcee4c8dc5be90ea477 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Mon, 14 Feb 2022 19:01:50 +0100 Subject: [PATCH 16/29] Disable ActiveRecord.belongs_to_required_by_default This is a nightmare currently, no one ever thought about this in our data model. --- config/application.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/application.rb b/config/application.rb index b647c947..9897473c 100644 --- a/config/application.rb +++ b/config/application.rb @@ -33,5 +33,7 @@ module Osem config.active_support.escape_html_entities_in_json = true # Don't generate system test files. config.generators.system_tests = nil + # This is a nightmare with our current data model, no one ever thought about this. + config.active_record.belongs_to_required_by_default = false end end From 1ca6029edcd6ca7a58e5a2178bbfbaa549b403f7 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Tue, 15 Feb 2022 12:52:54 +0100 Subject: [PATCH 17/29] Update stripe/stripe-ruby-mock --- Gemfile | 2 +- Gemfile.next.lock | 6 +++--- spec/models/payment_spec.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 096efc3c..216b3eb0 100644 --- a/Gemfile +++ b/Gemfile @@ -264,7 +264,7 @@ group :test do # for mocking external requests gem 'webmock' # for mocking Stripe responses in tests - gem 'stripe-ruby-mock' + gem 'stripe-ruby-mock', '~> 3.1.0.rc3' # For validating JSON schemas gem 'json-schema' # For using 'assigns' in tests diff --git a/Gemfile.next.lock b/Gemfile.next.lock index 51bd7506..47ff59cc 100644 --- a/Gemfile.next.lock +++ b/Gemfile.next.lock @@ -597,8 +597,8 @@ GEM sprockets (>= 3.0.0) sqlite3 (1.4.2) ssrf_filter (1.0.7) - stripe (5.38.0) - stripe-ruby-mock (3.0.1) + stripe (5.43.0) + stripe-ruby-mock (3.1.0.rc3) dante (>= 0.2.0) multi_json (~> 1.0) stripe (> 5, < 6) @@ -755,7 +755,7 @@ DEPENDENCIES sprockets-rails sqlite3 stripe - stripe-ruby-mock + stripe-ruby-mock (~> 3.1.0.rc3) timecop transitions turbolinks diff --git a/spec/models/payment_spec.rb b/spec/models/payment_spec.rb index 702ad725..f637e211 100644 --- a/spec/models/payment_spec.rb +++ b/spec/models/payment_spec.rb @@ -113,7 +113,7 @@ describe Payment do context 'when the request to Stripe is invalid' do it 'raises exception' do - StripeMock.prepare_error(Stripe::InvalidRequestError.new('Your request is invalid.', code: 402)) + StripeMock.prepare_error(Stripe::InvalidRequestError.new('Your request is invalid.', {}, code: 402)) expect{ payment.purchase }.not_to raise_error end end From 2aaca67bc12cb072f2afb046c5b547e788a58465 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Tue, 15 Feb 2022 13:20:14 +0100 Subject: [PATCH 18/29] Drop piwik_analytics The gem is unmaintained, the openSUSE matomo installation is dead. If you need this, bring it back... --- Gemfile | 3 --- Gemfile.lock | 9 ++------- Gemfile.next.lock | 5 ----- app/views/layouts/application.html.haml | 1 - 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/Gemfile b/Gemfile index 216b3eb0..3f9b7182 100644 --- a/Gemfile +++ b/Gemfile @@ -168,9 +168,6 @@ gem 'font-awesome-rails' # for markdown gem 'redcarpet' -# for visitor tracking -gem 'piwik_analytics', '~> 1.0.1' - # for recurring jobs gem 'delayed_job_active_record' gem 'whenever', :require => false diff --git a/Gemfile.lock b/Gemfile.lock index 68c7074f..c87dd5a2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -379,10 +379,6 @@ GEM ruby-rc4 ttfunk pg (1.2.3) - piwik_analytics (1.0.2) - actionpack - activesupport - rails (>= 3.0.0) prawn (2.4.0) pdf-core (~> 0.9.0) ttfunk (~> 1.7) @@ -563,7 +559,7 @@ GEM sqlite3 (1.4.2) ssrf_filter (1.0.7) stripe (5.38.0) - stripe-ruby-mock (3.0.1) + stripe-ruby-mock (3.1.0.rc3) dante (>= 0.2.0) multi_json (~> 1.0) stripe (> 5, < 6) @@ -679,7 +675,6 @@ DEPENDENCIES paper_trail pdf-inspector pg - piwik_analytics (~> 1.0.1) prawn-qrcode prawn-rails puma (~> 4.3) @@ -718,7 +713,7 @@ DEPENDENCIES sprockets-rails sqlite3 stripe - stripe-ruby-mock + stripe-ruby-mock (~> 3.1.0.rc3) timecop transitions turbolinks diff --git a/Gemfile.next.lock b/Gemfile.next.lock index 47ff59cc..91ef7565 100644 --- a/Gemfile.next.lock +++ b/Gemfile.next.lock @@ -420,10 +420,6 @@ GEM ruby-rc4 ttfunk pg (1.2.3) - piwik_analytics (1.0.2) - actionpack - activesupport - rails (>= 3.0.0) prawn (2.4.0) pdf-core (~> 0.9.0) ttfunk (~> 1.7) @@ -716,7 +712,6 @@ DEPENDENCIES paper_trail pdf-inspector pg - piwik_analytics (~> 1.0.1) prawn-qrcode prawn-rails puma (~> 4.3) diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index d4c194b9..7dfaf2c8 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -51,4 +51,3 @@ #{link_to "Skylight", ENV["SKYLIGHT_PUBLIC_DASHBOARD_URL"]}. = yield :script_body = yield :charts_js - = piwik_tracking_tag From f3a54ee82dce8af16c190d51c467e41add097565 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Tue, 15 Feb 2022 13:21:21 +0100 Subject: [PATCH 19/29] Fix main assets location Some OBSisms sneaked into my copy and paste job. --- app/assets/config/manifest.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index bceaf4db..daff3dc0 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,7 +1,7 @@ // This is a sprockets 4.0 manifest file // -//= link webui/application.css -//= link webui/application.js +//= link application.css +//= link application.js //= link_tree ../images //= link_tree ../fonts From b76102aa69d420faf9c4c6d461b90d32b6a217d6 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Tue, 15 Feb 2022 13:27:04 +0100 Subject: [PATCH 20/29] Fix ticket PDF spec open is not neccesarily OpenURI --- app/pdfs/ticket_pdf.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/pdfs/ticket_pdf.rb b/app/pdfs/ticket_pdf.rb index c4408e7c..cb624b1d 100644 --- a/app/pdfs/ticket_pdf.rb +++ b/app/pdfs/ticket_pdf.rb @@ -51,7 +51,7 @@ class TicketPdf < Prawn::Document when 'http', 'ftp:' # CDNs begin open(@conference.picture.ticket.url) - rescue OpenURI::HTTPError + rescue OpenURI::HTTPError, Errno::ENOENT nil end when '/sys' # local storage From 0fb080441a7b59e1e5848c6e3bb75d3cad5643b0 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Tue, 15 Feb 2022 13:30:35 +0100 Subject: [PATCH 21/29] Drop redirect_back_or_to helper This is a thing in ActionController by now --- app/helpers/application_helper.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 24c08d0e..4362cb75 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -88,14 +88,6 @@ module ApplicationHelper end end - def redirect_back_or_to(options = {}, response_status = {}) - if request.env['HTTP_REFERER'] - redirect_back(fallback_location: root_path) - else - redirect_to options, response_status - end - end - def concurrent_events(event) return nil unless event.scheduled? && event.program.selected_event_schedules From e79cfe0f9161ac345ec5e9f702d08336df55175c Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Tue, 15 Feb 2022 16:25:38 +0100 Subject: [PATCH 22/29] Drop jquery.mobile All that code, just for swipe. Nah... --- app/assets/javascripts/application.js | 1 - app/assets/javascripts/jquery.mobile.custom.min.js | 3 --- app/views/schedules/_schedule.html.haml | 8 -------- app/views/schedules/show.html.haml | 8 -------- 4 files changed, 20 deletions(-) delete mode 100644 app/assets/javascripts/jquery.mobile.custom.min.js diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 9917612b..cf12a085 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -12,7 +12,6 @@ // //= require jquery //= require jquery_ujs -//= require jquery.mobile.custom.min //= require jquery-ui/widgets/draggable //= require jquery-ui/widgets/droppable //= require waypoints/jquery.waypoints diff --git a/app/assets/javascripts/jquery.mobile.custom.min.js b/app/assets/javascripts/jquery.mobile.custom.min.js deleted file mode 100644 index 058c3453..00000000 --- a/app/assets/javascripts/jquery.mobile.custom.min.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! jQuery Mobile v1.4.5 | Copyright 2010, 2014 jQuery Foundation, Inc. | jquery.org/license */ - -(function(e,t,n){typeof define=="function"&&define.amd?define(["jquery"],function(r){return n(r,e,t),r.mobile}):n(e.jQuery,e,t)})(this,document,function(e,t,n,r){(function(e,t,n,r){function T(e){while(e&&typeof e.originalEvent!="undefined")e=e.originalEvent;return e}function N(t,n){var i=t.type,s,o,a,l,c,h,p,d,v;t=e.Event(t),t.type=n,s=t.originalEvent,o=e.event.props,i.search(/^(mouse|click)/)>-1&&(o=f);if(s)for(p=o.length,l;p;)l=o[--p],t[l]=s[l];i.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1);if(i.search(/^touch/)!==-1){a=T(s),i=a.touches,c=a.changedTouches,h=i&&i.length?i[0]:c&&c.length?c[0]:r;if(h)for(d=0,v=u.length;di||Math.abs(n.pageY-p)>i,d&&!r&&P("vmousecancel",t,s),P("vmousemove",t,s),_()}function I(e){if(g)return;A();var t=C(e.target),n,r;P("vmouseup",e,t),d||(n=P("vclick",e,t),n&&n.isDefaultPrevented()&&(r=T(e).changedTouches[0],v.push({touchID:E,x:r.clientX,y:r.clientY}),m=!0)),P("vmouseout",e,t),d=!1,_()}function q(t){var n=e.data(t,i),r;if(n)for(r in n)if(n[r])return!0;return!1}function R(){}function U(t){var n=t.substr(1);return{setup:function(){q(this)||e.data(this,i,{});var r=e.data(this,i);r[t]=!0,l[t]=(l[t]||0)+1,l[t]===1&&b.bind(n,H),e(this).bind(n,R),y&&(l.touchstart=(l.touchstart||0)+1,l.touchstart===1&&b.bind("touchstart",B).bind("touchend",I).bind("touchmove",F).bind("scroll",j))},teardown:function(){--l[t],l[t]||b.unbind(n,H),y&&(--l.touchstart,l.touchstart||b.unbind("touchstart",B).unbind("touchmove",F).unbind("touchend",I).unbind("scroll",j));var r=e(this),s=e.data(this,i);s&&(s[t]=!1),r.unbind(n,R),q(this)||r.removeData(i)}}}var i="virtualMouseBindings",s="virtualTouchID",o="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),u="clientX clientY pageX pageY screenX screenY".split(" "),a=e.event.mouseHooks?e.event.mouseHooks.props:[],f=e.event.props.concat(a),l={},c=0,h=0,p=0,d=!1,v=[],m=!1,g=!1,y="addEventListener"in n,b=e(n),w=1,E=0,S,x;e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(x=0;xMath.floor(e.pageY)||e.pageX===0&&Math.floor(i)>Math.floor(e.pageX))i-=n,s-=r;else if(se.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-n.coords[1])n.coords[0]?"swipeleft":"swiperight";return l(r,"swipe",e.Event("swipe",{target:i,swipestart:t,swipestop:n}),!0),l(r,s,e.Event(s,{target:i,swipestart:t,swipestop:n}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,n=this,r=e(n),s={};t=e.data(this,"mobile-events"),t||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=s,s.start=function(t){if(e.event.special.swipe.eventInProgress)return;e.event.special.swipe.eventInProgress=!0;var r,o=e.event.special.swipe.start(t),u=t.target,l=!1;s.move=function(t){if(!o||t.isDefaultPrevented())return;r=e.event.special.swipe.stop(t),l||(l=e.event.special.swipe.handleSwipe(o,r,n,u),l&&(e.event.special.swipe.eventInProgress=!1)),Math.abs(o.coords[0]-r.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault()},s.stop=function(){l=!0,e.event.special.swipe.eventInProgress=!1,i.off(f,s.move),s.move=null},i.on(f,s.move).one(a,s.stop)},r.on(u,s.start)},teardown:function(){var t,n;t=e.data(this,"mobile-events"),t&&(n=t.swipe,delete t.swipe,t.length--,t.length===0&&e.removeData(this,"mobile-events")),n&&(n.start&&e(this).off(u,n.start),n.move&&i.off(f,n.move),n.stop&&i.off(a,n.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)},teardown:function(){e(this).unbind(n)}}})}(e,this)}); \ No newline at end of file diff --git a/app/views/schedules/_schedule.html.haml b/app/views/schedules/_schedule.html.haml index 68dc9407..3b4c3dac 100644 --- a/app/views/schedules/_schedule.html.haml +++ b/app/views/schedules/_schedule.html.haml @@ -57,12 +57,4 @@ $(document).ready(function(){ // hide the left control when the page is ready $('.carousel').children('.left.carousel-control').hide(); - - // carousel swipe - $(".carousel-inner").swiperight(function() { - $(this).parent().carousel('prev'); - }); - $(".carousel-inner").swipeleft(function() { - $(this).parent().carousel('next'); - }); }); diff --git a/app/views/schedules/show.html.haml b/app/views/schedules/show.html.haml index 03aa16fe..8000b1ad 100644 --- a/app/views/schedules/show.html.haml +++ b/app/views/schedules/show.html.haml @@ -67,14 +67,6 @@ } }); - // carousel swipe - $(".carousel-inner").swiperight(function() { - $(this).parent().carousel('prev'); - }); - $(".carousel-inner").swipeleft(function() { - $(this).parent().carousel('next'); - }); - var day = "#{@current_day}"; // we only go to the date tag in the url if the conference is not taking place now if(day === ""){ From c967a0b9a41409cf8ebcd2663edf873a66ab6a54 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Tue, 15 Feb 2022 19:06:26 +0100 Subject: [PATCH 23/29] Update chartkick to 4.1.3 --- Gemfile.lock | 2 +- Gemfile.next.lock | 2 +- app/views/application/_donut_chart.haml | 14 +++----------- app/views/application/_line_chart.html.haml | 9 +-------- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index c87dd5a2..c4caaf9a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -133,7 +133,7 @@ GEM caxlsx_rails (0.6.2) actionpack (>= 3.1) caxlsx (>= 3.0) - chartkick (3.4.2) + chartkick (4.1.3) childprocess (3.0.0) chronic (0.10.2) chunky_png (1.4.0) diff --git a/Gemfile.next.lock b/Gemfile.next.lock index 91ef7565..4eb5fb1d 100644 --- a/Gemfile.next.lock +++ b/Gemfile.next.lock @@ -156,7 +156,7 @@ GEM caxlsx_rails (0.6.2) actionpack (>= 3.1) caxlsx (>= 3.0) - chartkick (3.4.2) + chartkick (4.1.3) childprocess (3.0.0) chronic (0.10.2) chunky_png (1.4.0) diff --git a/app/views/application/_donut_chart.haml b/app/views/application/_donut_chart.haml index 351ff216..8a65e390 100644 --- a/app/views/application/_donut_chart.haml +++ b/app/views/application/_donut_chart.haml @@ -1,16 +1,8 @@ :ruby combined_data ||= {} data ||= chart_values(combined_data) - colors ||= chart_colors(combined_data) - - options = { - donut: true, - legend: 'bottom', - download: true, - messages: { empty: 'No data' } - } - options[:colors] = colors if colors.present? .text-center - %h4= title - = pie_chart data, options + %h4 + = title + = pie_chart data, donut: true, legend: 'bottom', download: true, messages: { empty: 'No data' }, colors: chart_colors(combined_data) diff --git a/app/views/application/_line_chart.html.haml b/app/views/application/_line_chart.html.haml index b3dbf7be..7fc2cdfd 100644 --- a/app/views/application/_line_chart.html.haml +++ b/app/views/application/_line_chart.html.haml @@ -1,10 +1,3 @@ -:ruby - options = { - legend: 'bottom', - download: true, - messages: { empty: 'No data' } - } - .row .col-md-12 .text-center @@ -12,4 +5,4 @@ = title .row .col-md-12 - = line_chart data, options + = line_chart data, legend: 'bottom', download: true, messages: { empty: 'No data' } From c436ae172c18313b766137dd2fa7510d5b4be5ef Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Wed, 16 Feb 2022 12:26:09 +0100 Subject: [PATCH 24/29] Stop testing views There is no logic involved in assigning a CSS class... --- spec/views/layouts/application.haml_spec.rb | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 spec/views/layouts/application.haml_spec.rb diff --git a/spec/views/layouts/application.haml_spec.rb b/spec/views/layouts/application.haml_spec.rb deleted file mode 100644 index 4b337429..00000000 --- a/spec/views/layouts/application.haml_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -describe 'layouts/application.haml' do - let(:conference) { create(:conference) } - - it 'assigns a class to the body identifying the current conference' do - assign(:conference, conference) - render - expect(rendered).to have_selector("body.conference-#{conference.short_title}") - end -end From 19d8afa613e8aa9b727f7a5a0f3b1f9dccc700ad Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Thu, 10 Feb 2022 18:30:28 +0100 Subject: [PATCH 25/29] Fix Datatables Using `def_delegator` needs Forwardable --- app/controllers/admin/registrations_controller.rb | 2 +- app/controllers/admin/users_controller.rb | 2 +- app/datatables/registration_datatable.rb | 2 ++ app/datatables/user_datatable.rb | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/registrations_controller.rb b/app/controllers/admin/registrations_controller.rb index 3ef0da1c..588c87c5 100644 --- a/app/controllers/admin/registrations_controller.rb +++ b/app/controllers/admin/registrations_controller.rb @@ -20,7 +20,7 @@ module Admin respond_to do |format| format.html format.json do - render json: RegistrationDatatable.new(view_context, conference: @conference) + render json: RegistrationDatatable.new(view_context: view_context, conference: @conference) end format.pdf { render 'index', layout: false } format.xlsx do diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 570e28b4..6b317a7e 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -23,7 +23,7 @@ module Admin respond_to do |format| format.html format.json do - render json: UserDatatable.new(view_context) + render json: UserDatatable.new(view_context: view_context) end end end diff --git a/app/datatables/registration_datatable.rb b/app/datatables/registration_datatable.rb index a20fe3af..9ba7ae6a 100644 --- a/app/datatables/registration_datatable.rb +++ b/app/datatables/registration_datatable.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class RegistrationDatatable < AjaxDatatablesRails::Base + extend Forwardable + def_delegator :@view, :edit_admin_conference_registration_path def view_columns diff --git a/app/datatables/user_datatable.rb b/app/datatables/user_datatable.rb index b97eb404..cc2ece66 100644 --- a/app/datatables/user_datatable.rb +++ b/app/datatables/user_datatable.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class UserDatatable < AjaxDatatablesRails::Base + extend Forwardable + def_delegator :@view, :show_roles def_delegator :@view, :admin_user_path def_delegator :@view, :edit_admin_user_path From 800bb28c342a294e577e9686655bf80a9d9d4d2e Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Tue, 15 Feb 2022 16:36:19 +0100 Subject: [PATCH 26/29] Drop formtastic formtastic-bootstrap is unmaintained since years, formtastic is just syntactic sugar, ActionView grew up to be beautiful. --- .rubocop_todo.yml | 8 -- Gemfile | 2 - Gemfile.lock | 6 -- Gemfile.next.lock | 6 -- app/assets/stylesheets/application.css | 1 - config/initializers/formtastic.rb | 113 ------------------------- 6 files changed, 136 deletions(-) delete mode 100644 config/initializers/formtastic.rb diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 45457a6b..0d9a6f13 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -42,13 +42,6 @@ Layout/CommentIndentation: - 'app/models/track.rb' - 'spec/features/volunteers_spec.rb' -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: AllowBorderComment, AllowMarginComment. -Layout/EmptyComment: - Exclude: - - 'config/initializers/formtastic.rb' - # Offense count: 3 # Cop supports --auto-correct. Layout/EmptyLineAfterGuardClause: @@ -1005,7 +998,6 @@ Style/EmptyMethod: Style/Encoding: Exclude: - 'app/uploaders/picture_uploader.rb' - - 'config/initializers/formtastic.rb' - 'spec/models/conference_spec.rb' # Offense count: 3 diff --git a/Gemfile b/Gemfile index 3f9b7182..bc221407 100644 --- a/Gemfile +++ b/Gemfile @@ -85,8 +85,6 @@ gem 'uglifier', '>= 1.3.0' gem 'autoprefixer-rails' gem 'bootstrap-sass', '~> 3.4.0' gem 'cocoon' -gem 'formtastic', '~> 3.1.5' -gem 'formtastic-bootstrap' # as the JavaScript library gem 'jquery-rails' diff --git a/Gemfile.lock b/Gemfile.lock index c4caaf9a..d6b86f5c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -219,10 +219,6 @@ GEM ffi (1.15.4) font-awesome-rails (4.7.0.7) railties (>= 3.2, < 7) - formtastic (3.1.5) - actionpack (>= 3.2.13) - formtastic-bootstrap (3.1.1) - formtastic (>= 3.0) geckodriver-helper (0.24.0) archive-zip (~> 0.7) globalid (0.4.2) @@ -644,8 +640,6 @@ DEPENDENCIES faker feature font-awesome-rails - formtastic (~> 3.1.5) - formtastic-bootstrap geckodriver-helper gravtastic haml-rails diff --git a/Gemfile.next.lock b/Gemfile.next.lock index 4eb5fb1d..0e8acc2e 100644 --- a/Gemfile.next.lock +++ b/Gemfile.next.lock @@ -243,10 +243,6 @@ GEM ffi (1.15.3) font-awesome-rails (4.7.0.8) railties (>= 3.2, < 8.0) - formtastic (3.1.5) - actionpack (>= 3.2.13) - formtastic-bootstrap (3.1.1) - formtastic (>= 3.0) geckodriver-helper (0.24.0) archive-zip (~> 0.7) globalid (1.0.0) @@ -681,8 +677,6 @@ DEPENDENCIES faker feature font-awesome-rails - formtastic (~> 3.1.5) - formtastic-bootstrap geckodriver-helper gravtastic haml-rails diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 567fa050..3594e187 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -1,6 +1,5 @@ /* *= require strap-on - *= require formtastic-bootstrap *= require dataTables/bootstrap/3/jquery.dataTables.bootstrap *= require osem *= require osem-rating diff --git a/config/initializers/formtastic.rb b/config/initializers/formtastic.rb deleted file mode 100644 index f21da2e7..00000000 --- a/config/initializers/formtastic.rb +++ /dev/null @@ -1,113 +0,0 @@ -# encoding: utf-8 - -# Set the default text field size when input is a string. Default is nil. -# Formtastic::FormBuilder.default_text_field_size = 50 - -# Set the default text area height when input is a text. Default is 20. -# Formtastic::FormBuilder.default_text_area_height = 5 - -# Set the default text area width when input is a text. Default is nil. -# Formtastic::FormBuilder.default_text_area_width = 50 - -# Should all fields be considered "required" by default? -# Defaults to true. -# Formtastic::FormBuilder.all_fields_required_by_default = true - -# Should select fields have a blank option/prompt by default? -# Defaults to true. -Formtastic::FormBuilder.include_blank_for_select_by_default = false - -# Set the string that will be appended to the labels/fieldsets which are required -# It accepts string or procs and the default is a localized version of -# '*'. In other words, if you configure formtastic.required -# in your locale, it will replace the abbr title properly. But if you don't want to use -# abbr tag, you can simply give a string as below -Formtastic::FormBuilder.required_string = proc { Formtastic::Util.html_safe(%{ *}) } - -# Set the string that will be appended to the labels/fieldsets which are optional -# Defaults to an empty string ("") and also accepts procs (see required_string above) -# Formtastic::FormBuilder.optional_string = "(optional)" - -# Set the way inline errors will be displayed. -# Defaults to :sentence, valid options are :sentence, :list, :first and :none -# Formtastic::FormBuilder.inline_errors = :sentence -# Formtastic uses the following classes as default for hints, inline_errors and error list - -# If you override the class here, please ensure to override it in your stylesheets as well -# Formtastic::FormBuilder.default_hint_class = "inline-hints" -# Formtastic::FormBuilder.default_inline_error_class = "inline-errors" -# Formtastic::FormBuilder.default_error_list_class = "errors" - -# Set the method to call on label text to transform or format it for human-friendly -# reading when formtastic is used without object. Defaults to :humanize. -# Formtastic::FormBuilder.label_str_method = :humanize - -# Set the array of methods to try calling on parent objects in :select and :radio inputs -# for the text inside each @