diff --git a/init.rb b/init.rb index 2b7da04..cf83bcc 100644 --- a/init.rb +++ b/init.rb @@ -1,25 +1,16 @@ -require 'redmine' -Rails.configuration.to_prepare do - require_dependency 'project' - require_dependency 'principal' - require_dependency 'user' - require_dependency 'issue' - require_dependency 'issue_query' - require_dependency 'mailer' - - unless Issue.included_modules.include? CustomUsersAsAssignees::IssuePatch - Issue.send :include, CustomUsersAsAssignees::IssuePatch - end - unless User.included_modules.include? CustomUsersAsAssignees::UserPatch - User.send :include, CustomUsersAsAssignees::UserPatch - end - unless IssueQuery.included_modules.include? CustomUsersAsAssignees::IssueQueryPatch - IssueQuery.send :include, CustomUsersAsAssignees::IssueQueryPatch - end - unless Mailer.included_modules.include? CustomUsersAsAssignees::MailerPatch - Mailer.send :include, CustomUsersAsAssignees::MailerPatch - end +require File.expand_path('lib/custom_users_as_assignees', __dir__) +unless Issue.included_modules.include? CustomUsersAsAssignees::IssuePatch + Issue.send :include, CustomUsersAsAssignees::IssuePatch +end +unless User.included_modules.include? CustomUsersAsAssignees::UserPatch + User.send :include, CustomUsersAsAssignees::UserPatch +end +unless IssueQuery.included_modules.include? CustomUsersAsAssignees::IssueQueryPatch + IssueQuery.send :include, CustomUsersAsAssignees::IssueQueryPatch +end +unless Mailer.included_modules.include? CustomUsersAsAssignees::MailerPatch + Mailer.send :include, CustomUsersAsAssignees::MailerPatch end Redmine::Plugin.register :custom_users_as_assignees do @@ -30,3 +21,4 @@ url 'https://github.com/preciousplum/custom_users_as_assignees' author_url 'https://github.com/preciousplum/' end +