Maintenance: Only load gems when they are needed to save memory otherwise.
This commit is contained in:
parent
f37cf21092
commit
697661cbf2
18 changed files with 45 additions and 25 deletions
|
@ -10,6 +10,4 @@ slack:
|
||||||
- when: on_success
|
- when: on_success
|
||||||
script:
|
script:
|
||||||
- bundle exec rake zammad:db:unseeded
|
- bundle exec rake zammad:db:unseeded
|
||||||
- echo "gem 'slack-ruby-client'" >> Gemfile.local
|
|
||||||
- bundle install -j $(nproc)
|
|
||||||
- bundle exec rails test test/integration/slack_test.rb
|
- bundle exec rails test test/integration/slack_test.rb
|
||||||
|
|
21
Gemfile
21
Gemfile
|
@ -45,7 +45,7 @@ gem 'pundit'
|
||||||
gem 'rszr', '0.5.2'
|
gem 'rszr', '0.5.2'
|
||||||
|
|
||||||
# performance - Memcached
|
# performance - Memcached
|
||||||
gem 'dalli'
|
gem 'dalli', require: false
|
||||||
|
|
||||||
# asset handling - coffee-script
|
# asset handling - coffee-script
|
||||||
gem 'coffee-rails'
|
gem 'coffee-rails'
|
||||||
|
@ -95,7 +95,6 @@ gem 'omniauth-weibo-oauth2'
|
||||||
gem 'gmail_xoauth'
|
gem 'gmail_xoauth'
|
||||||
gem 'koala'
|
gem 'koala'
|
||||||
gem 'telegramAPI'
|
gem 'telegramAPI'
|
||||||
# Updating twitter to 'master' seems to break things, so freeze the revision for now.
|
|
||||||
gem 'twitter'
|
gem 'twitter'
|
||||||
|
|
||||||
# channels - email additions
|
# channels - email additions
|
||||||
|
@ -112,7 +111,7 @@ gem 'biz'
|
||||||
gem 'diffy'
|
gem 'diffy'
|
||||||
|
|
||||||
# feature - excel output
|
# feature - excel output
|
||||||
gem 'writeexcel'
|
gem 'writeexcel', require: false
|
||||||
|
|
||||||
# feature - device logging
|
# feature - device logging
|
||||||
gem 'browser'
|
gem 'browser'
|
||||||
|
@ -125,21 +124,20 @@ gem 'icalendar-recurrence'
|
||||||
gem 'telephone_number'
|
gem 'telephone_number'
|
||||||
|
|
||||||
# feature - SMS
|
# feature - SMS
|
||||||
gem 'twilio-ruby'
|
gem 'twilio-ruby', require: false
|
||||||
|
|
||||||
# feature - ordering
|
# feature - ordering
|
||||||
gem 'acts_as_list'
|
gem 'acts_as_list'
|
||||||
|
|
||||||
# integrations
|
# integrations
|
||||||
gem 'clearbit'
|
gem 'clearbit', require: false
|
||||||
gem 'net-ldap'
|
gem 'net-ldap'
|
||||||
gem 'slack-notifier'
|
gem 'slack-notifier', require: false
|
||||||
gem 'zendesk_api'
|
gem 'zendesk_api', require: false
|
||||||
|
|
||||||
# integrations - exchange
|
# integrations - exchange
|
||||||
gem 'autodiscover', git: 'https://github.com/zammad-deps/autodiscover'
|
gem 'autodiscover', git: 'https://github.com/zammad-deps/autodiscover', require: false
|
||||||
gem 'rubyntlm', git: 'https://github.com/wimm/rubyntlm'
|
gem 'viewpoint', require: false
|
||||||
gem 'viewpoint'
|
|
||||||
|
|
||||||
# integrations - S/MIME
|
# integrations - S/MIME
|
||||||
gem 'openssl'
|
gem 'openssl'
|
||||||
|
@ -218,6 +216,9 @@ group :development, :test do
|
||||||
|
|
||||||
# refresh ENVs in CI environment
|
# refresh ENVs in CI environment
|
||||||
gem 'dotenv', require: false
|
gem 'dotenv', require: false
|
||||||
|
|
||||||
|
# Slack helper for testing
|
||||||
|
gem 'slack-ruby-client', require: false
|
||||||
end
|
end
|
||||||
|
|
||||||
# Want to extend Zammad with additional gems?
|
# Want to extend Zammad with additional gems?
|
||||||
|
|
18
Gemfile.lock
18
Gemfile.lock
|
@ -1,9 +1,3 @@
|
||||||
GIT
|
|
||||||
remote: https://github.com/wimm/rubyntlm
|
|
||||||
revision: 53969639b87b9e5d5fef560f19cf0d977259591c
|
|
||||||
specs:
|
|
||||||
rubyntlm (0.1.2)
|
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/zammad-deps/autodiscover
|
remote: https://github.com/zammad-deps/autodiscover
|
||||||
revision: ee9b53dfa797ce6d4f970b82beea7fbdd2df56bb
|
revision: ee9b53dfa797ce6d4f970b82beea7fbdd2df56bb
|
||||||
|
@ -228,6 +222,8 @@ GEM
|
||||||
faraday (>= 0.8)
|
faraday (>= 0.8)
|
||||||
faraday-net_http (1.0.1)
|
faraday-net_http (1.0.1)
|
||||||
faraday-net_http_persistent (1.1.0)
|
faraday-net_http_persistent (1.1.0)
|
||||||
|
faraday_middleware (1.0.0)
|
||||||
|
faraday (~> 1.0)
|
||||||
ffi (1.15.3)
|
ffi (1.15.3)
|
||||||
ffi-compiler (1.0.1)
|
ffi-compiler (1.0.1)
|
||||||
ffi (>= 1.0.0)
|
ffi (>= 1.0.0)
|
||||||
|
@ -243,6 +239,7 @@ GEM
|
||||||
octokit (~> 4.6)
|
octokit (~> 4.6)
|
||||||
rainbow (>= 2.2.1)
|
rainbow (>= 2.2.1)
|
||||||
rake (>= 10.0)
|
rake (>= 10.0)
|
||||||
|
gli (2.20.1)
|
||||||
globalid (0.4.2)
|
globalid (0.4.2)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
gmail_xoauth (0.4.2)
|
gmail_xoauth (0.4.2)
|
||||||
|
@ -525,6 +522,7 @@ GEM
|
||||||
nokogiri (>= 1.10.5)
|
nokogiri (>= 1.10.5)
|
||||||
rexml
|
rexml
|
||||||
ruby2_keywords (0.0.4)
|
ruby2_keywords (0.0.4)
|
||||||
|
rubyntlm (0.6.3)
|
||||||
rubyzip (2.3.0)
|
rubyzip (2.3.0)
|
||||||
sassc (2.4.0)
|
sassc (2.4.0)
|
||||||
ffi (~> 1.9)
|
ffi (~> 1.9)
|
||||||
|
@ -553,6 +551,12 @@ GEM
|
||||||
simplecov (>= 0.4.1)
|
simplecov (>= 0.4.1)
|
||||||
simplecov_json_formatter (0.1.3)
|
simplecov_json_formatter (0.1.3)
|
||||||
slack-notifier (2.4.0)
|
slack-notifier (2.4.0)
|
||||||
|
slack-ruby-client (0.17.0)
|
||||||
|
faraday (>= 1.0)
|
||||||
|
faraday_middleware
|
||||||
|
gli
|
||||||
|
hashie
|
||||||
|
websocket-driver
|
||||||
slop (3.6.0)
|
slop (3.6.0)
|
||||||
spring (2.1.1)
|
spring (2.1.1)
|
||||||
spring-commands-rspec (1.0.4)
|
spring-commands-rspec (1.0.4)
|
||||||
|
@ -721,13 +725,13 @@ DEPENDENCIES
|
||||||
rubocop-performance
|
rubocop-performance
|
||||||
rubocop-rails
|
rubocop-rails
|
||||||
rubocop-rspec
|
rubocop-rspec
|
||||||
rubyntlm!
|
|
||||||
sassc-rails
|
sassc-rails
|
||||||
selenium-webdriver
|
selenium-webdriver
|
||||||
shoulda-matchers
|
shoulda-matchers
|
||||||
simplecov
|
simplecov
|
||||||
simplecov-rcov
|
simplecov-rcov
|
||||||
slack-notifier
|
slack-notifier
|
||||||
|
slack-ruby-client
|
||||||
spring
|
spring
|
||||||
spring-commands-rspec
|
spring-commands-rspec
|
||||||
spring-commands-testunit
|
spring-commands-testunit
|
||||||
|
|
|
@ -7,6 +7,7 @@ class Integration::ExchangeController < ApplicationController
|
||||||
|
|
||||||
def autodiscover
|
def autodiscover
|
||||||
answer_with do
|
answer_with do
|
||||||
|
require 'autodiscover' # Only load this gem when it is really used.
|
||||||
client = Autodiscover::Client.new(
|
client = Autodiscover::Client.new(
|
||||||
email: params[:user],
|
email: params[:user],
|
||||||
password: params[:password],
|
password: params[:password],
|
||||||
|
|
|
@ -142,6 +142,7 @@ class Channel::Driver::Sms::Twilio
|
||||||
private
|
private
|
||||||
|
|
||||||
def api(options)
|
def api(options)
|
||||||
|
require 'twilio-ruby' # Only load this gem when it is really used.
|
||||||
@api ||= ::Twilio::REST::Client.new options[:account_id], options[:token]
|
@api ||= ::Twilio::REST::Client.new options[:account_id], options[:token]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -168,6 +168,7 @@ class Transaction::Slack
|
||||||
|
|
||||||
Rails.logger.debug { "sent webhook (#{@item[:type]}/#{ticket.id}/#{local_config['webhook']})" }
|
Rails.logger.debug { "sent webhook (#{@item[:type]}/#{ticket.id}/#{local_config['webhook']})" }
|
||||||
|
|
||||||
|
require 'slack-notifier' # Only load this gem when it is really used.
|
||||||
notifier = Slack::Notifier.new(
|
notifier = Slack::Notifier.new(
|
||||||
local_config['webhook'],
|
local_config['webhook'],
|
||||||
channel: local_config['channel'],
|
channel: local_config['channel'],
|
||||||
|
|
|
@ -47,10 +47,11 @@ module Zammad
|
||||||
config.api_path = '/api/v1'
|
config.api_path = '/api/v1'
|
||||||
|
|
||||||
# define cache store
|
# define cache store
|
||||||
config.cache_store = if ENV['MEMCACHE_SERVERS'].present?
|
if ENV['MEMCACHE_SERVERS'].present?
|
||||||
[:mem_cache_store, ENV['MEMCACHE_SERVERS'], { expires_in: 7.days }]
|
require 'dalli' # Only load this gem when it is really used.
|
||||||
|
config.cache_store = [:mem_cache_store, ENV['MEMCACHE_SERVERS'], { expires_in: 7.days }]
|
||||||
else
|
else
|
||||||
[:zammad_file_store, Rails.root.join('tmp', "cache_file_store_#{Rails.env}"), { expires_in: 7.days }]
|
config.cache_store = [:zammad_file_store, Rails.root.join('tmp', "cache_file_store_#{Rails.env}"), { expires_in: 7.days }]
|
||||||
end
|
end
|
||||||
|
|
||||||
# define websocket session store
|
# define websocket session store
|
||||||
|
|
|
@ -148,6 +148,7 @@ module Enrichment
|
||||||
}
|
}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
require 'clearbit' # Only load this gem when it is really used.
|
||||||
::Clearbit.key = @config['api_key']
|
::Clearbit.key = @config['api_key']
|
||||||
result = ::Clearbit::Enrichment.find(email: @local_user.email, stream: true)
|
result = ::Clearbit::Enrichment.find(email: @local_user.email, stream: true)
|
||||||
record[:response] = { code: 200, content: result.to_s }
|
record[:response] = { code: 200, content: result.to_s }
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
class ExcelSheet
|
class ExcelSheet
|
||||||
|
|
||||||
def initialize(title:, header:, records:, locale:, timezone: nil)
|
def initialize(title:, header:, records:, locale:, timezone: nil)
|
||||||
|
|
||||||
|
require 'writeexcel' # Only load this gem when it is really used.
|
||||||
|
|
||||||
@title = title
|
@title = title
|
||||||
@header = header
|
@header = header
|
||||||
@records = records
|
@records = records
|
||||||
|
|
|
@ -11,6 +11,7 @@ class Sequencer
|
||||||
private
|
private
|
||||||
|
|
||||||
def ews_connection
|
def ews_connection
|
||||||
|
require 'viewpoint' # Only load this gem when it is really used.
|
||||||
Viewpoint::EWSClient.new(
|
Viewpoint::EWSClient.new(
|
||||||
config[:endpoint],
|
config[:endpoint],
|
||||||
config[:user],
|
config[:user],
|
||||||
|
|
|
@ -15,6 +15,7 @@ class Sequencer
|
||||||
end
|
end
|
||||||
|
|
||||||
def resource_collection
|
def resource_collection
|
||||||
|
require 'zendesk_api' # Only load this gem when it is really used.
|
||||||
@resource_collection ||= "::ZendeskAPI::#{resource_klass}".constantize.incremental_export(client, 1)
|
@resource_collection ||= "::ZendeskAPI::#{resource_klass}".constantize.incremental_export(client, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ class Sequencer
|
||||||
# that it returns max. 1000. That's why we need to update the total
|
# that it returns max. 1000. That's why we need to update the total
|
||||||
# number while importing in the resource loop
|
# number while importing in the resource loop
|
||||||
def request(object)
|
def request(object)
|
||||||
|
require 'zendesk_api' # Only load this gem when it is really used.
|
||||||
resource_class = "::ZendeskAPI::#{object.to_s.singularize}".safe_constantize
|
resource_class = "::ZendeskAPI::#{object.to_s.singularize}".safe_constantize
|
||||||
if resource_class.respond_to?(:incremental_export)
|
if resource_class.respond_to?(:incremental_export)
|
||||||
# read as: ::ZendeskAPI::Ticket.incremental_export(client, 1)
|
# read as: ::ZendeskAPI::Ticket.incremental_export(client, 1)
|
||||||
|
|
|
@ -10,6 +10,7 @@ class Sequencer
|
||||||
private
|
private
|
||||||
|
|
||||||
def client
|
def client
|
||||||
|
require 'zendesk_api' # Only load this gem when it is really used.
|
||||||
ZendeskAPI::Client.new do |config|
|
ZendeskAPI::Client.new do |config|
|
||||||
config.url = Setting.get('import_zendesk_endpoint')
|
config.url = Setting.get('import_zendesk_endpoint')
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
require 'autodiscover' # Only load this gem when it is really used.
|
||||||
|
|
||||||
RSpec.describe 'Exchange integration endpoint', type: :request do
|
RSpec.describe 'Exchange integration endpoint', type: :request do
|
||||||
before { authenticated_as(admin_with_admin_user_permissions) }
|
before { authenticated_as(admin_with_admin_user_permissions) }
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
require 'viewpoint' # Only load this gem when it is really used.
|
||||||
|
|
||||||
RSpec.describe Import::Exchange::Folder do
|
RSpec.describe Import::Exchange::Folder do
|
||||||
# see https://github.com/zammad/zammad/issues/2152
|
# see https://github.com/zammad/zammad/issues/2152
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
|
require 'zendesk_api' # Only load this gem when it is really used.
|
||||||
|
|
||||||
RSpec.shared_examples 'Sequencer::Unit::Import::Zendesk::SubSequence::Base' do
|
RSpec.shared_examples 'Sequencer::Unit::Import::Zendesk::SubSequence::Base' do
|
||||||
describe 'error handling' do
|
describe 'error handling' do
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
require 'autodiscover' # Only load this gem when it is really used.
|
||||||
|
|
||||||
RSpec.describe 'Exchange integration endpoint', type: :request do
|
RSpec.describe 'Exchange integration endpoint', type: :request do
|
||||||
before { authenticated_as(admin_with_admin_user_permissions) }
|
before { authenticated_as(admin_with_admin_user_permissions) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
require 'integration_test_helper'
|
require 'integration_test_helper'
|
||||||
require 'slack'
|
require 'slack-ruby-client' # Only load this gem when it is really used.
|
||||||
|
|
||||||
class SlackTest < ActiveSupport::TestCase
|
class SlackTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue