Просмотр исходного кода

Maintenance: Switch to Ruby 3.0.3.

Martin Gruner 3 лет назад
Родитель
Сommit
aca7a6c496

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

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

+ 3 - 3
.gitlab-ci.yml

@@ -1,5 +1,5 @@
 default:
 default:
-  image: $CI_REGISTRY/docker/zammad-ci:2.7.4
+  image: $CI_REGISTRY/docker/zammad-ci:3.0.3
 
 
 include:
 include:
   - local: '/.gitlab/ci/base.yml'
   - local: '/.gitlab/ci/base.yml'
@@ -39,9 +39,9 @@ variables:
 # Cache gems in between jobs and pipelines
 # Cache gems in between jobs and pipelines
 # ATTENTION: We use a combination of the Ruby major and minor version number
 # 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
 # as a key for the cache to avoid cache growth and incompatibilities between
-# the gems. Search hook: 2.7.4 (change it when updating the Ruby version too)
+# the gems. Search hook: 3.0.3 (change it when updating the Ruby version too)
 cache:
 cache:
-  key: "centos7ruby274"
+  key: "centos7ruby303"
   paths:
   paths:
     - vendor/ruby
     - vendor/ruby
     # ATTENTION: This should be a dedicated cache only used in the job "TODO".
     # ATTENTION: This should be a dedicated cache only used in the job "TODO".

+ 1 - 1
.ruby-version

@@ -1 +1 @@
-2.7.4
+3.0.3

+ 7 - 3
Gemfile

@@ -3,7 +3,7 @@
 source 'https://rubygems.org'
 source 'https://rubygems.org'
 
 
 # core - base
 # core - base
-ruby '2.7.4'
+ruby '3.0.3'
 gem 'rails', '~> 6.1.0'
 gem 'rails', '~> 6.1.0'
 
 
 # core - rails additions
 # core - rails additions
@@ -97,11 +97,13 @@ gem 'omniauth-weibo-oauth2'
 # channels
 # channels
 gem 'gmail_xoauth'
 gem 'gmail_xoauth'
 gem 'koala'
 gem 'koala'
-gem 'telegramAPI'
+# TODO: remove git information after https://github.com/bennesp/telegramAPI/pull/8 is merged
+gem 'telegramAPI', git: 'https://github.com/zammad-deps/telegramAPI', branch: 'uri-escape-warning'
 gem 'twitter'
 gem 'twitter'
 
 
 # channels - email additions
 # channels - email additions
 gem 'htmlentities'
 gem 'htmlentities'
+# TODO: remove git information once v2.8 is released and works with Zammad
 gem 'mail', git: 'https://github.com/zammad-deps/mail', branch: '2-7-stable'
 gem 'mail', git: 'https://github.com/zammad-deps/mail', branch: '2-7-stable'
 gem 'mime-types'
 gem 'mime-types'
 gem 'rchardet', '>= 1.8.0'
 gem 'rchardet', '>= 1.8.0'
@@ -194,7 +196,9 @@ group :development, :test do
   gem 'overcommit'
   gem 'overcommit'
   gem 'rubocop'
   gem 'rubocop'
   gem 'rubocop-faker'
   gem 'rubocop-faker'
-  gem 'rubocop-inflector'
+  # TODO: remove git branch information for rubocop-inflector after
+  #   Ruby 3 support was added: https://github.com/aeroastro/rubocop-inflector/pull/2
+  gem 'rubocop-inflector', git: 'https://github.com/zammad-deps/rubocop-inflector', branch: 'fix-ruby3-compat'
   gem 'rubocop-performance'
   gem 'rubocop-performance'
   gem 'rubocop-rails'
   gem 'rubocop-rails'
   gem 'rubocop-rspec'
   gem 'rubocop-rspec'

+ 21 - 10
Gemfile.lock

@@ -1,3 +1,20 @@
+GIT
+  remote: https://github.com/pippokairos/telegramAPI
+  revision: fb62dd5b48b0c41169ab69fc89069969ab4705b2
+  branch: uri-escape-warning
+  specs:
+    telegramAPI (1.4)
+      rest-client (~> 2.0, >= 2.0.2)
+
+GIT
+  remote: https://github.com/splitwise/rubocop-inflector
+  revision: 0de158833bbb27b19b0643561bef52ffaf422fa0
+  specs:
+    rubocop-inflector (0.2.0)
+      activesupport
+      rubocop
+      rubocop-rspec
+
 GIT
 GIT
   remote: https://github.com/zammad-deps/autodiscover
   remote: https://github.com/zammad-deps/autodiscover
   revision: ee9b53dfa797ce6d4f970b82beea7fbdd2df56bb
   revision: ee9b53dfa797ce6d4f970b82beea7fbdd2df56bb
@@ -476,10 +493,6 @@ GEM
     rubocop-faker (1.1.0)
     rubocop-faker (1.1.0)
       faker (>= 2.12.0)
       faker (>= 2.12.0)
       rubocop (>= 0.82.0)
       rubocop (>= 0.82.0)
-    rubocop-inflector (0.1.1)
-      activesupport
-      rubocop
-      rubocop-rspec
     rubocop-performance (1.13.3)
     rubocop-performance (1.13.3)
       rubocop (>= 1.7.0, < 2.0)
       rubocop (>= 1.7.0, < 2.0)
       rubocop-ast (>= 0.4.0)
       rubocop-ast (>= 0.4.0)
@@ -530,8 +543,6 @@ GEM
       activesupport (>= 5.2)
       activesupport (>= 5.2)
       sprockets (>= 3.0.0)
       sprockets (>= 3.0.0)
     tcr (0.2.2)
     tcr (0.2.2)
-    telegramAPI (1.4.2)
-      rest-client (~> 2.0, >= 2.0.2)
     telephone_number (1.4.14)
     telephone_number (1.4.14)
     test-unit (3.5.3)
     test-unit (3.5.3)
       power_assert
       power_assert
@@ -677,7 +688,7 @@ DEPENDENCIES
   rszr
   rszr
   rubocop
   rubocop
   rubocop-faker
   rubocop-faker
-  rubocop-inflector
+  rubocop-inflector!
   rubocop-performance
   rubocop-performance
   rubocop-rails
   rubocop-rails
   rubocop-rspec
   rubocop-rspec
@@ -689,7 +700,7 @@ DEPENDENCIES
   spring
   spring
   sprockets (~> 3.7.2)
   sprockets (~> 3.7.2)
   tcr
   tcr
-  telegramAPI
+  telegramAPI!
   telephone_number
   telephone_number
   test-unit
   test-unit
   twilio-ruby
   twilio-ruby
@@ -704,7 +715,7 @@ DEPENDENCIES
   zendesk_api
   zendesk_api
 
 
 RUBY VERSION
 RUBY VERSION
-   ruby 2.7.4p191
+   ruby 3.0.3p157
 
 
 BUNDLED WITH
 BUNDLED WITH
-   2.2.20
+   2.2.32

+ 2 - 2
app/models/channel/email_parser.rb

@@ -4,7 +4,7 @@
 
 
 class Channel::EmailParser
 class Channel::EmailParser
   PROZESS_TIME_MAX = 180
   PROZESS_TIME_MAX = 180
-  EMAIL_REGEX = %r{.+@.+}.freeze
+  EMAIL_REGEX = %r{.+@.+}
   RECIPIENT_FIELDS = %w[to cc delivered-to x-original-to envelope-to].freeze
   RECIPIENT_FIELDS = %w[to cc delivered-to x-original-to envelope-to].freeze
   SENDER_FIELDS = %w[from reply-to return-path sender].freeze
   SENDER_FIELDS = %w[from reply-to return-path sender].freeze
   EXCESSIVE_LINKS_MSG = __('This message cannot be displayed because it contains over 5,000 links. Download the raw message below and open it via an Email client if you still wish to view it.').freeze
   EXCESSIVE_LINKS_MSG = __('This message cannot be displayed because it contains over 5,000 links. Download the raw message below and open it via an Email client if you still wish to view it.').freeze
@@ -540,7 +540,7 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
     part.body = force_japanese_encoding part.body.encoded.unpack1('M')
     part.body = force_japanese_encoding part.body.encoded.unpack1('M')
   end
   end
 
 
-  ISO2022JP_REGEXP = %r{=\?ISO-2022-JP\?B\?(.+?)\?=}.freeze
+  ISO2022JP_REGEXP = %r{=\?ISO-2022-JP\?B\?(.+?)\?=}
 
 
   # https://github.com/zammad/zammad/issues/3115
   # https://github.com/zammad/zammad/issues/3115
   def header_field_unpack_japanese(field)
   def header_field_unpack_japanese(field)

+ 1 - 1
app/models/channel/filter/base_external_check.rb

@@ -6,7 +6,7 @@ class Channel::Filter::BaseExternalCheck
   MAIL_HEADER        = 'x-example-header'.freeze
   MAIL_HEADER        = 'x-example-header'.freeze
 
 
   # regex to detect the id in the subject of the email
   # regex to detect the id in the subject of the email
-  SOURCE_ID_REGEX    = %r{\s(EXAMPLE-MATCH\d+)\s}.freeze
+  SOURCE_ID_REGEX    = %r{\s(EXAMPLE-MATCH\d+)\s}
 
 
   # External sync references source name prefix
   # External sync references source name prefix
   SOURCE_NAME_PREFIX = 'Example'.freeze
   SOURCE_NAME_PREFIX = 'Example'.freeze

+ 1 - 1
app/models/channel/filter/jira_check.rb

@@ -2,6 +2,6 @@
 
 
 class Channel::Filter::JiraCheck < Channel::Filter::BaseExternalCheck
 class Channel::Filter::JiraCheck < Channel::Filter::BaseExternalCheck
   MAIL_HEADER        = 'x-jira-fingerprint'.freeze
   MAIL_HEADER        = 'x-jira-fingerprint'.freeze
-  SOURCE_ID_REGEX    = %r{\[JIRA\]\s\((\w+-\d+)\)}.freeze
+  SOURCE_ID_REGEX    = %r{\[JIRA\]\s\((\w+-\d+)\)}
   SOURCE_NAME_PREFIX = 'Jira'.freeze
   SOURCE_NAME_PREFIX = 'Jira'.freeze
 end
 end

+ 1 - 1
app/models/channel/filter/service_now_check.rb

@@ -2,6 +2,6 @@
 
 
 class Channel::Filter::ServiceNowCheck < Channel::Filter::BaseExternalCheck
 class Channel::Filter::ServiceNowCheck < Channel::Filter::BaseExternalCheck
   MAIL_HEADER        = 'x-servicenow-generated'.freeze
   MAIL_HEADER        = 'x-servicenow-generated'.freeze
-  SOURCE_ID_REGEX    = %r{\s(INC\d+)\s}.freeze
+  SOURCE_ID_REGEX    = %r{\s(INC\d+)\s}
   SOURCE_NAME_PREFIX = 'ServiceNow'.freeze
   SOURCE_NAME_PREFIX = 'ServiceNow'.freeze
 end
 end

+ 2 - 2
app/models/knowledge_base/search.rb

@@ -45,8 +45,8 @@ class KnowledgeBase
         sql_helper = ::SqlHelper.new(object: self)
         sql_helper = ::SqlHelper.new(object: self)
         order_sql  = sql_helper.get_order(options[:sort_by], options[:order_by], "#{table_name}.updated_at ASC")
         order_sql  = sql_helper.get_order(options[:sort_by], options[:order_by], "#{table_name}.updated_at ASC")
 
 
-        # - stip out * we already search for *query* -
-        query.delete! '*'
+        # - strip out * we already search for *query* -
+        query = query.delete '*'
 
 
         search_fallback("%#{query}%", options: options)
         search_fallback("%#{query}%", options: options)
           .where(kb_locale: kb_locales)
           .where(kb_locale: kb_locales)

Некоторые файлы не были показаны из-за большого количества измененных файлов