Browse Source

Maintenance: Switch to Ruby 3.0.3.

Martin Gruner 3 years ago
parent
commit
aca7a6c496

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

@@ -36,7 +36,7 @@ jobs:
       - name: Set up Ruby
         uses: ruby/setup-ruby@v1
         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)
         run: |
           sudo apt-get install -y mysql-client

+ 3 - 3
.gitlab-ci.yml

@@ -1,5 +1,5 @@
 default:
-  image: $CI_REGISTRY/docker/zammad-ci:2.7.4
+  image: $CI_REGISTRY/docker/zammad-ci:3.0.3
 
 include:
   - local: '/.gitlab/ci/base.yml'
@@ -39,9 +39,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.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:
-  key: "centos7ruby274"
+  key: "centos7ruby303"
   paths:
     - vendor/ruby
     # 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'
 
 # core - base
-ruby '2.7.4'
+ruby '3.0.3'
 gem 'rails', '~> 6.1.0'
 
 # core - rails additions
@@ -97,11 +97,13 @@ gem 'omniauth-weibo-oauth2'
 # channels
 gem 'gmail_xoauth'
 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'
 
 # channels - email additions
 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 'mime-types'
 gem 'rchardet', '>= 1.8.0'
@@ -194,7 +196,9 @@ group :development, :test do
   gem 'overcommit'
   gem 'rubocop'
   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-rails'
   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
   remote: https://github.com/zammad-deps/autodiscover
   revision: ee9b53dfa797ce6d4f970b82beea7fbdd2df56bb
@@ -476,10 +493,6 @@ GEM
     rubocop-faker (1.1.0)
       faker (>= 2.12.0)
       rubocop (>= 0.82.0)
-    rubocop-inflector (0.1.1)
-      activesupport
-      rubocop
-      rubocop-rspec
     rubocop-performance (1.13.3)
       rubocop (>= 1.7.0, < 2.0)
       rubocop-ast (>= 0.4.0)
@@ -530,8 +543,6 @@ GEM
       activesupport (>= 5.2)
       sprockets (>= 3.0.0)
     tcr (0.2.2)
-    telegramAPI (1.4.2)
-      rest-client (~> 2.0, >= 2.0.2)
     telephone_number (1.4.14)
     test-unit (3.5.3)
       power_assert
@@ -677,7 +688,7 @@ DEPENDENCIES
   rszr
   rubocop
   rubocop-faker
-  rubocop-inflector
+  rubocop-inflector!
   rubocop-performance
   rubocop-rails
   rubocop-rspec
@@ -689,7 +700,7 @@ DEPENDENCIES
   spring
   sprockets (~> 3.7.2)
   tcr
-  telegramAPI
+  telegramAPI!
   telephone_number
   test-unit
   twilio-ruby
@@ -704,7 +715,7 @@ DEPENDENCIES
   zendesk_api
 
 RUBY VERSION
-   ruby 2.7.4p191
+   ruby 3.0.3p157
 
 BUNDLED WITH
-   2.2.20
+   2.2.32

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

@@ -4,7 +4,7 @@
 
 class Channel::EmailParser
   PROZESS_TIME_MAX = 180
-  EMAIL_REGEX = %r{.+@.+}.freeze
+  EMAIL_REGEX = %r{.+@.+}
   RECIPIENT_FIELDS = %w[to cc delivered-to x-original-to envelope-to].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
@@ -540,7 +540,7 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
     part.body = force_japanese_encoding part.body.encoded.unpack1('M')
   end
 
-  ISO2022JP_REGEXP = %r{=\?ISO-2022-JP\?B\?(.+?)\?=}.freeze
+  ISO2022JP_REGEXP = %r{=\?ISO-2022-JP\?B\?(.+?)\?=}
 
   # https://github.com/zammad/zammad/issues/3115
   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
 
   # 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
   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
   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
 end

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

@@ -2,6 +2,6 @@
 
 class Channel::Filter::ServiceNowCheck < Channel::Filter::BaseExternalCheck
   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
 end

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

@@ -45,8 +45,8 @@ class KnowledgeBase
         sql_helper = ::SqlHelper.new(object: self)
         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)
           .where(kb_locale: kb_locales)

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