Patch workload plugin to work properly with zeitwerk.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
10
Dockerfile
10
Dockerfile
@@ -17,6 +17,11 @@ RUN set -eux; \
|
|||||||
# Remove default cron mess
|
# Remove default cron mess
|
||||||
rm -f /etc/cron.daily/*; \
|
rm -f /etc/cron.daily/*; \
|
||||||
rm -f /etc/cron.d/*; \
|
rm -f /etc/cron.d/*; \
|
||||||
|
# Apply patches
|
||||||
|
git apply project_identifier.patch; \
|
||||||
|
git apply workload_module.patch; \
|
||||||
|
mv plugins/redmine_workload/lib/redmine_workload/hooks/plugin.rb plugins/redmine_workload/lib/redmine_workload/hooks/after_plugins_loaded_hook.rb; \
|
||||||
|
rm *.patch; \
|
||||||
# Install plugin dependencies
|
# Install plugin dependencies
|
||||||
bundle check || bundle install; \
|
bundle check || bundle install; \
|
||||||
# For hourglass plugin
|
# For hourglass plugin
|
||||||
@@ -24,21 +29,16 @@ RUN set -eux; \
|
|||||||
echo "production:" >> ./config/database.yml; \
|
echo "production:" >> ./config/database.yml; \
|
||||||
echo " adapter: mysql2" >> ./config/database.yml; \
|
echo " adapter: mysql2" >> ./config/database.yml; \
|
||||||
mv plugins/000_redmine_x_ux_upgrade/init.rb plugins/000_redmine_x_ux_upgrade/init.rb.orig; \
|
mv plugins/000_redmine_x_ux_upgrade/init.rb plugins/000_redmine_x_ux_upgrade/init.rb.orig; \
|
||||||
mv plugins/redmine_workload /tmp/; \
|
|
||||||
# WARNING: the next command makes the image larger by almost 100 MB
|
# WARNING: the next command makes the image larger by almost 100 MB
|
||||||
echo Hourglass::Assets.compile|rails console; \
|
echo Hourglass::Assets.compile|rails console; \
|
||||||
rm ./config/database.yml; \
|
rm ./config/database.yml; \
|
||||||
mv plugins/000_redmine_x_ux_upgrade/init.rb.orig plugins/000_redmine_x_ux_upgrade/init.rb; \
|
mv plugins/000_redmine_x_ux_upgrade/init.rb.orig plugins/000_redmine_x_ux_upgrade/init.rb; \
|
||||||
mv /tmp/redmine_workload plugins/; \
|
|
||||||
# end hourglass plugin
|
# end hourglass plugin
|
||||||
chmod +x /pre-entrypoint.sh; \
|
chmod +x /pre-entrypoint.sh; \
|
||||||
# setting ENTRYPOINT destroys CMD so replace the entrypoint script and call it later
|
# setting ENTRYPOINT destroys CMD so replace the entrypoint script and call it later
|
||||||
# (see bottom note in https://docs.docker.com/engine/reference/builder/#entrypoint)
|
# (see bottom note in https://docs.docker.com/engine/reference/builder/#entrypoint)
|
||||||
mv /docker-entrypoint.sh /orig-entrypoint.sh; \
|
mv /docker-entrypoint.sh /orig-entrypoint.sh; \
|
||||||
mv /pre-entrypoint.sh /docker-entrypoint.sh; \
|
mv /pre-entrypoint.sh /docker-entrypoint.sh; \
|
||||||
# Apply patches
|
|
||||||
git apply project_identifier.patch; \
|
|
||||||
rm *.patch; \
|
|
||||||
# Clean-up
|
# Clean-up
|
||||||
apt-mark auto '.*' > /dev/null; \
|
apt-mark auto '.*' > /dev/null; \
|
||||||
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
|
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
|
||||||
|
|||||||
243
patches/workload_module.patch
Normal file
243
patches/workload_module.patch
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload.rb
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require_relative 'redmine_workload/extensions/user_patch'
|
||||||
|
-require_relative 'redmine_workload/hooks/plugin'
|
||||||
|
+require_relative 'redmine_workload/hooks/after_plugins_loaded_hook'
|
||||||
|
require_relative 'redmine_workload/group_workload_preparer'
|
||||||
|
require_relative 'redmine_workload/user_workload_preparer'
|
||||||
|
require_relative 'redmine_workload/wl_calculation_restrictions'
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/group_workload_preparer.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/group_workload_preparer.rb
|
||||||
|
@@ -1,5 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
+module RedmineWorkload
|
||||||
|
+
|
||||||
|
require 'forwardable'
|
||||||
|
|
||||||
|
class GroupWorkloadPreparer
|
||||||
|
@@ -44,3 +46,5 @@ class GroupWorkloadPreparer
|
||||||
|
|
||||||
|
attr_writer :data, :params
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+end
|
||||||
|
\ No newline at end of file
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/user_workload_preparer.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/user_workload_preparer.rb
|
||||||
|
@@ -1,5 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
+module RedmineWorkload
|
||||||
|
+
|
||||||
|
require 'forwardable'
|
||||||
|
|
||||||
|
class UserWorkloadPreparer
|
||||||
|
@@ -36,3 +38,5 @@ class UserWorkloadPreparer
|
||||||
|
|
||||||
|
attr_writer :data, :params
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+end
|
||||||
|
\ No newline at end of file
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/wl_calculation_restrictions.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/wl_calculation_restrictions.rb
|
||||||
|
@@ -1,5 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
+module RedmineWorkload
|
||||||
|
+
|
||||||
|
module WlCalculationRestrictions
|
||||||
|
def consider_parent_issues?
|
||||||
|
settings['workload_of_parent_issues'].present?
|
||||||
|
@@ -9,3 +11,5 @@ module WlCalculationRestrictions
|
||||||
|
Setting.plugin_redmine_workload
|
||||||
|
end
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+end
|
||||||
|
\ No newline at end of file
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/wl_csv_exporter.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/wl_csv_exporter.rb
|
||||||
|
@@ -1,5 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
+module RedmineWorkload
|
||||||
|
+
|
||||||
|
require 'forwardable'
|
||||||
|
|
||||||
|
class WlCsvExporter
|
||||||
|
@@ -106,3 +108,5 @@ class WlCsvExporter
|
||||||
|
data.time_span.map { |date| format_date(date) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+end
|
||||||
|
\ No newline at end of file
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/wl_date_tools.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/wl_date_tools.rb
|
||||||
|
@@ -1,5 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
+module RedmineWorkload
|
||||||
|
+
|
||||||
|
require_relative 'wl_user_data_defaults'
|
||||||
|
|
||||||
|
class WlDateTools
|
||||||
|
@@ -85,3 +87,5 @@ class WlDateTools
|
||||||
|
!WlUserVacation.where('user_id = ? AND date_from <= ? AND date_to >= ?', assignee.id, day, day).empty?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+end
|
||||||
|
\ No newline at end of file
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/wl_issue_query.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/wl_issue_query.rb
|
||||||
|
@@ -1,5 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
+module RedmineWorkload
|
||||||
|
+
|
||||||
|
module WlIssueQuery
|
||||||
|
include WlCalculationRestrictions
|
||||||
|
##
|
||||||
|
@@ -38,3 +40,5 @@ module WlIssueQuery
|
||||||
|
issues.split.flatten
|
||||||
|
end
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+end
|
||||||
|
\ No newline at end of file
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/wl_issue_state.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/wl_issue_state.rb
|
||||||
|
@@ -1,5 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
+module RedmineWorkload
|
||||||
|
+
|
||||||
|
module WlIssueState
|
||||||
|
##
|
||||||
|
# Redefines the overdue state of an issue. Instead of comparing issue.due_date
|
||||||
|
@@ -10,3 +12,5 @@ module WlIssueState
|
||||||
|
issue.due_date.present? && (issue.due_date < date) && !issue.closed?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+end
|
||||||
|
\ No newline at end of file
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/wl_user_data_defaults.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/wl_user_data_defaults.rb
|
||||||
|
@@ -1,5 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
+module RedmineWorkload
|
||||||
|
+
|
||||||
|
##
|
||||||
|
# Provides the default values for WlUserData object
|
||||||
|
#
|
||||||
|
@@ -14,3 +16,5 @@ module WlUserDataDefaults
|
||||||
|
Setting['plugin_redmine_workload']
|
||||||
|
end
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+end
|
||||||
|
\ No newline at end of file
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/wl_user_data_finder.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/wl_user_data_finder.rb
|
||||||
|
@@ -1,5 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
+module RedmineWorkload
|
||||||
|
+
|
||||||
|
##
|
||||||
|
# Finder method for WLUserData
|
||||||
|
#
|
||||||
|
@@ -14,3 +16,5 @@ module WlUserDataFinder
|
||||||
|
@user_workload_data
|
||||||
|
end
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+end
|
||||||
|
\ No newline at end of file
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/app/controllers/wl_national_holiday_controller.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/app/controllers/wl_national_holiday_controller.rb
|
||||||
|
@@ -3,7 +3,7 @@
|
||||||
|
require 'json'
|
||||||
|
|
||||||
|
class WlNationalHolidayController < ApplicationController
|
||||||
|
- include WlUserDataFinder
|
||||||
|
+ include RedmineWorkload::WlUserDataFinder
|
||||||
|
|
||||||
|
before_action :authorize_global, only: %i[create update destroy]
|
||||||
|
before_action :find_user_workload_data
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/app/controllers/wl_user_datas_controller.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/app/controllers/wl_user_datas_controller.rb
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class WlUserDatasController < ApplicationController
|
||||||
|
- include WlUserDataFinder
|
||||||
|
+ include RedmineWorkload::WlUserDataFinder
|
||||||
|
|
||||||
|
helper :workloads
|
||||||
|
helper :wl_user_datas
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/app/controllers/wl_user_vacations_controller.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/app/controllers/wl_user_vacations_controller.rb
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class WlUserVacationsController < ApplicationController
|
||||||
|
- include WlUserDataFinder
|
||||||
|
+ include RedmineWorkload::WlUserDataFinder
|
||||||
|
|
||||||
|
helper :workloads
|
||||||
|
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/app/controllers/workloads_controller.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/app/controllers/workloads_controller.rb
|
||||||
|
@@ -11,7 +11,7 @@ class WorkloadsController < ApplicationController
|
||||||
|
helper :workloads
|
||||||
|
|
||||||
|
include QueriesHelper
|
||||||
|
- include WlUserDataFinder
|
||||||
|
+ include RedmineWorkload::WlUserDataFinder
|
||||||
|
include WorkloadsHelper
|
||||||
|
|
||||||
|
before_action :authorize_global, only: %i[index]
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/app/models/user_workload.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/app/models/user_workload.rb
|
||||||
|
@@ -6,8 +6,8 @@
|
||||||
|
#
|
||||||
|
class UserWorkload
|
||||||
|
include Redmine::I18n
|
||||||
|
- include WlIssueQuery
|
||||||
|
- include WlIssueState
|
||||||
|
+ include RedmineWorkload::WlIssueQuery
|
||||||
|
+ include RedmineWorkload::WlIssueState
|
||||||
|
|
||||||
|
attr_reader :assignees, :issues, :time_span, :today
|
||||||
|
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/app/models/wl_default_user_data.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/app/models/wl_default_user_data.rb
|
||||||
|
@@ -4,7 +4,7 @@
|
||||||
|
# Holds default user related data for workload calculation.
|
||||||
|
#
|
||||||
|
class WlDefaultUserData
|
||||||
|
- include WlUserDataDefaults
|
||||||
|
+ include RedmineWorkload::WlUserDataDefaults
|
||||||
|
|
||||||
|
def threshold_lowload_min
|
||||||
|
default_attributes[:threshold_lowload_min].to_f
|
||||||
|
--- a/plugins/redmine_workload/lib/redmine_workload/app/models/wl_user_data.rb
|
||||||
|
+++ b/plugins/redmine_workload/lib/redmine_workload/app/models/wl_user_data.rb
|
||||||
|
@@ -4,7 +4,7 @@
|
||||||
|
# Holds user related data for workload calculation.
|
||||||
|
#
|
||||||
|
class WlUserData < ActiveRecord::Base
|
||||||
|
- include WlUserDataDefaults
|
||||||
|
+ include RedmineWorkload::WlUserDataDefaults
|
||||||
|
|
||||||
|
belongs_to :user, inverse_of: :wl_user_data, optional: true
|
||||||
|
self.table_name = 'wl_user_datas'
|
||||||
Reference in New Issue
Block a user