Skip to content

Commit

Permalink
Maintenance: Updated to Rails 6.0.4 and the new Zeitwerk autoloader.
Browse files Browse the repository at this point in the history
This changes the minimum supported version of PostgreSQL to 9.3.
  • Loading branch information
thorsteneckel authored and mgruner committed Jun 23, 2021
1 parent 341bdd6 commit ca56de3
Show file tree
Hide file tree
Showing 151 changed files with 409 additions and 458 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ variables:
# as a key for the cache to avoid cache growth and incompatibilities between
# the gems. Search hook: 2.6.6 (change it when updating the Ruby version too)
cache:
key: "centos7ruby266"
key: "centos7ruby266rails6"
paths:
- vendor/ruby
# ATTENTION: This should be a dedicated cache only used in the job "TODO".
Expand Down
11 changes: 11 additions & 0 deletions .gitlab/ci/pre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ shellcheck:
script:
- shellcheck -S warning $(find . -name "*.sh" -o -name "functions" | grep -v "/vendor/")

zeitwerk_check:
<<: *template_pre
extends:
- .tags_docker
- .services_postgresql
script:
- bundle install -j $(nproc) --path vendor
- bundle exec ruby script/build/database_config.rb
- bundle exec rake zammad:db:init
- bundle exec rails zeitwerk:check

coffeelint:
<<: *template_pre
script:
Expand Down
4 changes: 1 addition & 3 deletions .rubocop/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ AllCops:
NewCops: enable
DisplayCopNames: true
Exclude:
- 'bin/rails'
- 'bin/rake'
- 'bin/spring'
- 'bin/*'
- 'db/schema.rb'
- 'vendor/**/*'
- 'node_modules/**/*'
Expand Down
12 changes: 6 additions & 6 deletions .rubocop/todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ Metrics/AbcSize:
- 'app/controllers/recent_view_controller.rb'
- 'app/controllers/reports_controller.rb'
- 'app/controllers/search_controller.rb'
- 'app/controllers/sessions/collection_base.rb'
- 'app/controllers/sessions/collection_ticket.rb'
- 'app/controllers/sessions_controller.rb'
- 'app/controllers/settings_controller.rb'
- 'app/controllers/text_modules_controller.rb'
Expand Down Expand Up @@ -321,6 +319,8 @@ Metrics/AbcSize:
- 'lib/service/geo_calendar/zammad.rb'
- 'lib/service/geo_ip/zammad.rb'
- 'lib/service/geo_location/gmaps.rb'
- 'lib/session_helper/collection_base.rb'
- 'lib/session_helper/collection_ticket.rb'
- 'lib/sessions.rb'
- 'lib/sessions/backend/activity_stream.rb'
- 'lib/sessions/backend/base.rb'
Expand Down Expand Up @@ -478,8 +478,6 @@ Metrics/CyclomaticComplexity:
- 'app/controllers/organizations_controller.rb'
- 'app/controllers/reports_controller.rb'
- 'app/controllers/search_controller.rb'
- 'app/controllers/sessions/collection_base.rb'
- 'app/controllers/sessions/collection_ticket.rb'
- 'app/controllers/sessions_controller.rb'
- 'app/controllers/ticket_articles_controller.rb'
- 'app/controllers/tickets_controller.rb'
Expand Down Expand Up @@ -638,6 +636,8 @@ Metrics/CyclomaticComplexity:
- 'lib/secure_mailing/smime/incoming.rb'
- 'lib/sequencer/unit/import/zendesk/sub_sequence/base.rb'
- 'lib/service/geo_ip/zammad.rb'
- 'lib/session_helper/collection_base.rb'
- 'lib/session_helper/collection_ticket.rb'
- 'lib/sessions.rb'
- 'lib/sessions/backend/activity_stream.rb'
- 'lib/sessions/backend/ticket_overview_list.rb'
Expand Down Expand Up @@ -715,8 +715,6 @@ Metrics/PerceivedComplexity:
- 'app/controllers/organizations_controller.rb'
- 'app/controllers/reports_controller.rb'
- 'app/controllers/search_controller.rb'
- 'app/controllers/sessions/collection_base.rb'
- 'app/controllers/sessions/collection_ticket.rb'
- 'app/controllers/sessions_controller.rb'
- 'app/controllers/ticket_articles_controller.rb'
- 'app/controllers/tickets_controller.rb'
Expand Down Expand Up @@ -865,6 +863,8 @@ Metrics/PerceivedComplexity:
- 'lib/search_index_backend.rb'
- 'lib/secure_mailing/smime/incoming.rb'
- 'lib/service/geo_ip/zammad.rb'
- 'lib/session_helper/collection_base.rb'
- 'lib/session_helper/collection_ticket.rb'
- 'lib/sessions.rb'
- 'lib/sessions/backend/activity_stream.rb'
- 'lib/sessions/backend/ticket_overview_list.rb'
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source 'https://rubygems.org'

# core - base
ruby '2.6.6'
gem 'rails', '5.2.4.6'
gem 'rails', '6.0.4'

# core - rails additions
gem 'activerecord-import'
Expand Down
142 changes: 77 additions & 65 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,62 +49,75 @@ GEM
specs:
aasm (5.0.0)
concurrent-ruby (~> 1.0)
actioncable (5.2.4.6)
actionpack (= 5.2.4.6)
actioncable (6.0.4)
actionpack (= 6.0.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.4.6)
actionpack (= 5.2.4.6)
actionview (= 5.2.4.6)
activejob (= 5.2.4.6)
actionmailbox (6.0.4)
actionpack (= 6.0.4)
activejob (= 6.0.4)
activerecord (= 6.0.4)
activestorage (= 6.0.4)
activesupport (= 6.0.4)
mail (>= 2.7.1)
actionmailer (6.0.4)
actionpack (= 6.0.4)
actionview (= 6.0.4)
activejob (= 6.0.4)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.4.6)
actionview (= 5.2.4.6)
activesupport (= 5.2.4.6)
actionpack (6.0.4)
actionview (= 6.0.4)
activesupport (= 6.0.4)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.4.6)
activesupport (= 5.2.4.6)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.4)
actionpack (= 6.0.4)
activerecord (= 6.0.4)
activestorage (= 6.0.4)
activesupport (= 6.0.4)
nokogiri (>= 1.8.5)
actionview (6.0.4)
activesupport (= 6.0.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.4.6)
activesupport (= 5.2.4.6)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.4)
activesupport (= 6.0.4)
globalid (>= 0.3.6)
activemodel (5.2.4.6)
activesupport (= 5.2.4.6)
activerecord (5.2.4.6)
activemodel (= 5.2.4.6)
activesupport (= 5.2.4.6)
arel (>= 9.0)
activerecord-import (1.0.2)
activemodel (6.0.4)
activesupport (= 6.0.4)
activerecord (6.0.4)
activemodel (= 6.0.4)
activesupport (= 6.0.4)
activerecord-import (1.0.5)
activerecord (>= 3.2)
activerecord-nulldb-adapter (0.3.9)
activerecord-nulldb-adapter (0.4.0)
activerecord (>= 2.0.0)
activerecord-session_store (2.0.0)
actionpack (>= 5.2.4.1)
activerecord (>= 5.2.4.1)
multi_json (~> 1.11, >= 1.11.2)
rack (>= 2.0.8, < 3)
railties (>= 5.2.4.1)
activestorage (5.2.4.6)
actionpack (= 5.2.4.6)
activerecord (= 5.2.4.6)
marcel (~> 0.3.1)
activesupport (5.2.4.6)
activestorage (6.0.4)
actionpack (= 6.0.4)
activejob (= 6.0.4)
activerecord (= 6.0.4)
marcel (~> 1.0.0)
activesupport (6.0.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
acts_as_list (0.9.19)
activerecord (>= 3.0)
zeitwerk (~> 2.2, >= 2.2.2)
acts_as_list (1.0.1)
activerecord (>= 4.2)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
arel (9.0.0)
argon2 (2.0.2)
ffi (~> 1.9)
ffi-compiler (>= 0.1)
Expand Down Expand Up @@ -137,9 +150,9 @@ GEM
clearbit (0.2.8)
nestful (~> 1.1.0)
coderay (1.1.2)
coffee-rails (4.2.2)
coffee-rails (5.0.0)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
railties (>= 5.2.0)
coffee-script (2.4.1)
coffee-script-source
execjs
Expand All @@ -148,9 +161,9 @@ GEM
coffee-script
execjs
json
composite_primary_keys (11.2.0)
activerecord (~> 5.2.1)
concurrent-ruby (1.1.8)
composite_primary_keys (12.0.2)
activerecord (~> 6.0.0)
concurrent-ruby (1.1.9)
coveralls (0.8.23)
json (>= 1.8, < 3)
simplecov (~> 0.16.1)
Expand All @@ -163,10 +176,10 @@ GEM
daemons (1.3.1)
dalli (2.7.10)
debug_inspector (0.0.3)
delayed_job (4.1.7)
activesupport (>= 3.0, < 5.3)
delayed_job_active_record (4.1.3)
activerecord (>= 3.0, < 5.3)
delayed_job (4.1.8)
activesupport (>= 3.0, < 6.1)
delayed_job_active_record (4.1.4)
activerecord (>= 3.0, < 6.1)
delayed_job (>= 3.0, < 5)
deprecation_toolkit (1.4.0)
activesupport (>= 4.2)
Expand Down Expand Up @@ -275,23 +288,19 @@ GEM
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.10)
loofah (2.9.1)
loofah (2.10.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.0.13)
marcel (0.3.3)
mimemagic (~> 0.3.2)
marcel (1.0.1)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
method_source (0.9.2)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0331)
mimemagic (0.3.10)
nokogiri (~> 1)
rake
mini_mime (1.1.0)
mini_portile2 (2.5.1)
mini_portile2 (2.5.3)
mini_racer (0.2.9)
libv8 (>= 6.9.411)
minitest (5.14.4)
Expand All @@ -306,7 +315,7 @@ GEM
net-ldap (0.16.1)
netrc (0.11.0)
nio4r (2.5.7)
nokogiri (1.11.5)
nokogiri (1.11.7)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
nori (2.6.0)
Expand Down Expand Up @@ -396,18 +405,20 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.4.6)
actioncable (= 5.2.4.6)
actionmailer (= 5.2.4.6)
actionpack (= 5.2.4.6)
actionview (= 5.2.4.6)
activejob (= 5.2.4.6)
activemodel (= 5.2.4.6)
activerecord (= 5.2.4.6)
activestorage (= 5.2.4.6)
activesupport (= 5.2.4.6)
rails (6.0.4)
actioncable (= 6.0.4)
actionmailbox (= 6.0.4)
actionmailer (= 6.0.4)
actionpack (= 6.0.4)
actiontext (= 6.0.4)
actionview (= 6.0.4)
activejob (= 6.0.4)
activemodel (= 6.0.4)
activerecord (= 6.0.4)
activestorage (= 6.0.4)
activesupport (= 6.0.4)
bundler (>= 1.3.0)
railties (= 5.2.4.6)
railties (= 6.0.4)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.4)
actionpack (>= 5.0.1.x)
Expand All @@ -418,12 +429,12 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (5.2.4.6)
actionpack (= 5.2.4.6)
activesupport (= 5.2.4.6)
railties (6.0.4)
actionpack (= 6.0.4)
activesupport (= 6.0.4)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
thor (>= 0.20.3, < 2.0)
rainbow (3.0.0)
raindrops (0.19.0)
rake (12.3.3)
Expand Down Expand Up @@ -562,12 +573,13 @@ GEM
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
websocket-driver (0.7.3)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
writeexcel (1.0.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.4.2)
zendesk_api (1.19.0)
faraday (~> 0.9)
hashie (>= 3.5.2, < 4.0.0)
Expand Down Expand Up @@ -650,7 +662,7 @@ DEPENDENCIES
pundit
pundit-matchers
rack-livereload
rails (= 5.2.4.6)
rails (= 6.0.4)
rails-controller-testing
rb-fsevent
rchardet (>= 1.8.0)
Expand Down
1 change: 0 additions & 1 deletion app/controllers/channels_sms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def channels_config
list = []
Dir.glob(Rails.root.join('app/models/channel/driver/sms/*.rb')).each do |path|
filename = File.basename(path)
require_dependency "channel/driver/sms/#{filename.sub('.rb', '')}"
list.push Channel.driver_class("sms/#{filename}").definition
end
list
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/channels_twitter_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/

require_dependency 'channel/driver/twitter'

class ChannelsTwitterController < ApplicationController
prepend_before_action -> { authentication_check && authorize! }, except: %i[webhook_incoming webhook_verify]
skip_before_action :verify_csrf_token, only: %i[webhook_incoming webhook_verify]
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/integration/ldap_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/

require_dependency 'ldap'
require_dependency 'ldap/user'
require_dependency 'ldap/group'

class Integration::LdapController < ApplicationController
include Integration::ImportJobBase

Expand Down
1 change: 0 additions & 1 deletion app/controllers/search_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def search_generic
if objects_with_direct_search_index.present?
items = SearchIndexBackend.search(query, objects_with_direct_search_index, limit: limit)
items.each do |item|
require_dependency item[:type].to_filename
local_class = item[:type].constantize
record = local_class.lookup(id: item[:id])
next if !record
Expand Down
2 changes: 2 additions & 0 deletions app/jobs/application_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class ApplicationJob < ActiveJob::Base
include ApplicationJob::HasQueuingPriority
include ApplicationJob::HasCustomLogging

ActiveJob::Logging::LogSubscriber.detach_from :active_job

# Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked

Expand Down
Loading

0 comments on commit ca56de3

Please sign in to comment.