Browse Source

Maintenance: Updated to Ruby 2.7.3.

Martin Gruner 3 years ago
parent
commit
22e0fc5520

+ 1 - 1
.github/workflows/ci.yaml

@@ -36,7 +36,7 @@ jobs:
       - name: Set up Ruby
         uses: ruby/setup-ruby@v1
         with:
-          ruby-version: 2.6.6
+          ruby-version: 2.7.3
       - name: Increase MySQL max_allowed_packet to 1GB (workaround for unknown/missing service option)
         run: |
           sudo apt-get install -y mysql-client

+ 3 - 3
.gitlab-ci.yml

@@ -1,5 +1,5 @@
 default:
-  image: registry.znuny.com/docker/zammad-ci:stable
+  image: registry.znuny.com/docker/zammad-ci:test-ruby-3.7
 
 include:
   - local: '/.gitlab/ci/base.yml'
@@ -43,9 +43,9 @@ variables:
 # Cache gems in between jobs and pipelines
 # ATTENTION: We use a combination of the Ruby major and minor version number
 # 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)
+# the gems. Search hook: 2.7.2 (change it when updating the Ruby version too)
 cache:
-  key: "centos7ruby266rails6"
+  key: "centos7ruby273"
   paths:
     - vendor/ruby
     # ATTENTION: This should be a dedicated cache only used in the job "TODO".

+ 1 - 0
.gitlab/ci/browser-core/api_client_ruby.yml

@@ -7,6 +7,7 @@ api_client_ruby:
     - bundle exec rake zammad:ci:test:start
     - git clone https://github.com/zammad/zammad-api-client-ruby.git
     - cd zammad-api-client-ruby
+    - bundle update --bundler
     - bundle install -j $(nproc)
     - bundle exec rspec
 

+ 11 - 0
.gitlab/ci/pre.yml

@@ -32,6 +32,17 @@ zeitwerk_check:
     - bundle exec rake zammad:db:init
     - bundle exec rails zeitwerk:check
 
+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:

+ 1 - 1
.ruby-version

@@ -1 +1 @@
-2.6.6
+2.7.3

+ 2 - 2
Gemfile

@@ -3,7 +3,7 @@
 source 'https://rubygems.org'
 
 # core - base
-ruby '2.6.6'
+ruby '2.7.3'
 gem 'rails', '6.0.4'
 
 # core - rails additions
@@ -19,7 +19,7 @@ gem 'unicorn', group: :unicorn
 
 # core - supported ORMs
 gem 'activerecord-nulldb-adapter', group: :nulldb
-gem 'mysql2', '0.4.10', group: :mysql
+gem 'mysql2', group: :mysql
 gem 'pg', '0.21.0', group: :postgres
 
 # core - asynchrous task execution

+ 8 - 8
Gemfile.lock

@@ -129,7 +129,7 @@ GEM
     biz (1.8.2)
       clavius (~> 1.0)
       tzinfo
-    bootsnap (1.3.2)
+    bootsnap (1.5.1)
       msgpack (~> 1.0)
     browser (2.5.3)
     buftok (0.2.0)
@@ -296,19 +296,19 @@ GEM
     memoizable (0.4.2)
       thread_safe (~> 0.3, >= 0.3.1)
     method_source (0.9.2)
-    mime-types (3.2.2)
+    mime-types (3.3.1)
       mime-types-data (~> 3.2015)
-    mime-types-data (3.2019.0331)
+    mime-types-data (3.2020.1104)
     mini_mime (1.1.0)
     mini_portile2 (2.5.3)
     mini_racer (0.2.9)
       libv8 (>= 6.9.411)
     minitest (5.14.4)
-    msgpack (1.2.4)
+    msgpack (1.3.3)
     multi_json (1.15.0)
     multi_xml (0.6.0)
     multipart-post (2.1.1)
-    mysql2 (0.4.10)
+    mysql2 (0.5.3)
     naught (1.1.0)
     nenv (0.3.0)
     nestful (1.1.3)
@@ -638,7 +638,7 @@ DEPENDENCIES
   mail!
   mime-types
   mini_racer
-  mysql2 (= 0.4.10)
+  mysql2
   net-ldap
   oauth2
   omniauth-facebook
@@ -699,7 +699,7 @@ DEPENDENCIES
   zendesk_api
 
 RUBY VERSION
-   ruby 2.6.6p146
+   ruby 2.7.3p183
 
 BUNDLED WITH
-   1.17.3
+   2.2.20

+ 1 - 1
app/controllers/knowledge_base/answers_controller.rb

@@ -75,7 +75,7 @@ class KnowledgeBase::AnswersController < KnowledgeBase::BaseController
 
     assets = object.assets({})
 
-    contents = object.translations.map(&:content).compact
+    contents = object.translations.filter_map(&:content)
     assets = ApplicationModel::CanAssets.reduce contents, assets
 
     render json: { id: object.id, assets: assets }, status: :created

+ 1 - 2
app/controllers/links_controller.rb

@@ -12,8 +12,7 @@ class LinksController < ApplicationController
     )
 
     linked_objects = links
-                     .map { |elem| elem['link_object']&.safe_constantize&.lookup(id: elem['link_object_value']) }
-                     .compact
+                     .filter_map { |elem| elem['link_object']&.safe_constantize&.lookup(id: elem['link_object_value']) }
 
     # return result
     render json: {

+ 2 - 4
app/jobs/checks_kb_client_notification_job.rb

@@ -53,10 +53,8 @@ class ChecksKbClientNotificationJob < ApplicationJob
   def users_for(permission_suffix)
     Sessions
       .sessions
-      .map { |client_id| Sessions.get(client_id)&.dig(:user, 'id') }
-      .compact
-      .map { |user_id| User.find_by(id: user_id) }
-      .compact
+      .filter_map { |client_id| Sessions.get(client_id)&.dig(:user, 'id') }
+      .filter_map { |user_id| User.find_by(id: user_id) }
       .select { |user| user.permissions? "knowledge_base.#{permission_suffix}" }
   end
 

Some files were not shown because too many files changed in this diff