Skip to content

Support Redmine 5.0 #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,7 @@
# FCSV = CSV
#end

if Rails::VERSION::MAJOR < 3
require 'dispatcher'
object_to_prepare = Dispatcher
else
object_to_prepare = Rails.configuration
# if redmine plugins were railties:
# object_to_prepare = config
end

object_to_prepare.to_prepare do
if Rails::VERSION::MAJOR >= 6
require_dependency 'project'
require_dependency 'principal'
require_dependency 'user'
Expand All @@ -30,6 +21,30 @@
rescue LoadError
# TimeEntryActivity is not available
end
else
if Rails::VERSION::MAJOR < 3
require 'dispatcher'
object_to_prepare = Dispatcher
else
object_to_prepare = Rails.configuration
# if redmine plugins were railties:
# object_to_prepare = config
end

object_to_prepare.to_prepare do
require_dependency 'project'
require_dependency 'principal'
require_dependency 'user'
Project.send(:include, RedmineTimesheetPlugin::Patches::ProjectPatch)
User.send(:include, RedmineTimesheetPlugin::Patches::UserPatch)

# Needed for the compatibility check
begin
require_dependency 'time_entry_activity'
rescue LoadError
# TimeEntryActivity is not available
end
end
end

unless Redmine::Plugin.registered_plugins.keys.include?(:redmine_timesheet_plugin)
Expand Down