Maintenance: Updated to Ruby 2.7.3.
This commit is contained in:
parent
ca56de3648
commit
22e0fc5520
23 changed files with 49 additions and 65 deletions
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
|
@ -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
|
||||
|
|
|
@ -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".
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 @@
|
|||
2.6.6
|
||||
2.7.3
|
||||
|
|
4
Gemfile
4
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
|
||||
|
|
16
Gemfile.lock
16
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -377,7 +377,7 @@ returns
|
|||
|
||||
def self.sender_attributes(from)
|
||||
if from.is_a?(HashWithIndifferentAccess)
|
||||
from = SENDER_FIELDS.map { |f| from[f] }.compact
|
||||
from = SENDER_FIELDS.filter_map { |f| from[f] }
|
||||
.map(&:to_utf8).reject(&:blank?)
|
||||
.partition { |address| address.match?(EMAIL_REGEX) }
|
||||
.flatten.first
|
||||
|
@ -743,7 +743,7 @@ process unprocessable_mails (tmp/unprocessable_mail/*.eml) again
|
|||
end
|
||||
|
||||
# for some broken sm mail clients (X-MimeOLE: Produced By Microsoft Exchange V6.5)
|
||||
filename ||= file.header[:content_location].to_s.force_encoding('utf-8')
|
||||
filename ||= file.header[:content_location].to_s.dup.force_encoding('utf-8')
|
||||
|
||||
file_body = String.new(file.body.to_s)
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ module ChecksClientNotification
|
|||
end
|
||||
|
||||
def notify_clients_data(event)
|
||||
class_name = self.class.name
|
||||
class_name.gsub!(%r{::}, '')
|
||||
class_name = self.class.name.gsub(%r{::}, '')
|
||||
|
||||
{
|
||||
message: {
|
||||
|
|
|
@ -309,7 +309,7 @@ returns
|
|||
.map { |p| p.slice(:from, :to) }
|
||||
.map(&:values).flatten
|
||||
.pluck(:user_id).compact
|
||||
.map { |user_id| User.lookup(id: user_id) }.compact
|
||||
.filter_map { |user_id| User.lookup(id: user_id) }
|
||||
.each.with_object({}) { |user, a| user.assets(a) }
|
||||
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ class KnowledgeBase
|
|||
es_response = SearchIndexBackend.search(query, name, options)
|
||||
es_response = search_es_filter(es_response, query, kb_locales, options) if defined? :search_es_filter
|
||||
|
||||
es_response.map { |item| lookup(id: item[:id]) }.compact
|
||||
es_response.filter_map { |item| lookup(id: item[:id]) }
|
||||
end
|
||||
|
||||
def search_sql(query, kb_locales, options)
|
||||
|
|
|
@ -230,8 +230,7 @@ class Link < ApplicationModel
|
|||
|
||||
def self.reduce_assets(assets, link_references)
|
||||
link_items = link_references
|
||||
.map { |elem| lookup_linked_object(elem) }
|
||||
.compact
|
||||
.filter_map { |elem| lookup_linked_object(elem) }
|
||||
|
||||
ApplicationModel::CanAssets.reduce(link_items, assets)
|
||||
end
|
||||
|
|
|
@ -12,11 +12,11 @@ lookup by name and create tag item
|
|||
=end
|
||||
|
||||
def self.lookup_by_name_and_create(name)
|
||||
name.strip!
|
||||
lookup = name.strip
|
||||
|
||||
tag_object = Tag::Object.lookup(name: name)
|
||||
tag_object = Tag::Object.lookup(name: lookup)
|
||||
return tag_object if tag_object
|
||||
|
||||
Tag::Object.create(name: name)
|
||||
Tag::Object.create(name: lookup)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
if Kernel.respond_to?(:open_uri_original_open)
|
||||
module Kernel
|
||||
|
||||
module_function
|
||||
|
||||
# see: https://github.com/ruby/ruby/pull/1675
|
||||
def open(name, *rest, &block)
|
||||
if name.respond_to?(:open) && name.method(:open).parameters.present?
|
||||
name.open(*rest, &block)
|
||||
elsif name.respond_to?(:to_str) &&
|
||||
%r{\A[A-Za-z][A-Za-z0-9+\-.]*://} =~ name &&
|
||||
(uri = URI.parse(name)).respond_to?(:open)
|
||||
uri.open(*rest, &block)
|
||||
else
|
||||
open_uri_original_open(name, *rest, &block)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -83,7 +83,7 @@ class KnowledgeBase
|
|||
|
||||
def all_ids_present?
|
||||
old_ids = scope.pluck(:id)
|
||||
new_ids = @menu_items_data.map { |elem| elem[:id]&.to_i }.compact
|
||||
new_ids = @menu_items_data.filter_map { |elem| elem[:id]&.to_i }
|
||||
|
||||
old_ids.sort == new_ids.sort
|
||||
end
|
||||
|
|
|
@ -136,13 +136,13 @@ class Ldap
|
|||
end
|
||||
|
||||
def group_user_dns_memberuid(entry)
|
||||
entry[:memberuid].collect do |uid|
|
||||
entry[:memberuid].filter_map do |uid|
|
||||
dn = nil
|
||||
@ldap.search("(&(uid=#{uid})#{Import::Ldap.config[:user_filter]})", attributes: %w[dn]) do |user|
|
||||
dn = user.dn
|
||||
end
|
||||
dn
|
||||
end.compact
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -261,8 +261,7 @@ remove whole data from index
|
|||
end
|
||||
|
||||
index
|
||||
.map { |local_index| search_by_index(query, local_index, options) }
|
||||
.compact
|
||||
.filter_map { |local_index| search_by_index(query, local_index, options) }
|
||||
.flatten(1)
|
||||
end
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@ class Sequencer
|
|||
ids = ews_folder_ids
|
||||
ids ||= []
|
||||
|
||||
ews_folder.id_folder_map.collect do |id, folder|
|
||||
ews_folder.id_folder_map.filter_map do |id, folder|
|
||||
next if ids.present? && ids.exclude?(id)
|
||||
next if folder.total_count.blank?
|
||||
next if folder.total_count.zero?
|
||||
|
||||
[id, ews_folder.display_path(folder)]
|
||||
end.compact.to_h
|
||||
end.to_h
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ class Sequencer
|
|||
|
||||
def process
|
||||
state.provide(:associations) do
|
||||
associations.collect do |association|
|
||||
associations.filter_map do |association|
|
||||
|
||||
logger.debug { "Checking association '#{association}'" }
|
||||
next if !mapped.key?(association)
|
||||
|
@ -30,7 +30,7 @@ class Sequencer
|
|||
|
||||
logger.debug { "Using value of association '#{association}'" }
|
||||
[association, value]
|
||||
end.compact.to_h
|
||||
end.to_h
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,8 +12,7 @@ class Sequencer
|
|||
private
|
||||
|
||||
def groups
|
||||
remote_ids.map { |remote_id| group_map[remote_id] }
|
||||
.compact
|
||||
remote_ids.filter_map { |remote_id| group_map[remote_id] }
|
||||
.map { |local_id| ::Group.find(local_id) }
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue