Commit 1112fec4 authored by Yorick Peterse's avatar Yorick Peterse

Inject EE modules in a CE compatible fashion

All instances of injecting an EE specific module have been changed to
use the new methods for this: prepend_if_ee, extend_if_ee, and
include_if_ee. This allows these lines to be included in CE, even when
the modules to inject do not exist. This in turn allows us to backport
these lines to CE and keep them there, instead of having to strip them
out.
parent 3e18bf13
Pipeline #73724035 failed with stages
in 78 minutes and 17 seconds
......@@ -9,4 +9,4 @@ class Admin::ApplicationController < ApplicationController
layout 'admin'
end
Admin::ApplicationController.prepend(EE::Admin::ApplicationController)
Admin::ApplicationController.prepend_if_ee('EE::Admin::ApplicationController')
......@@ -147,4 +147,4 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end
end
Admin::ApplicationSettingsController.prepend(EE::Admin::ApplicationSettingsController)
Admin::ApplicationSettingsController.prepend_if_ee('EE::Admin::ApplicationSettingsController')
......@@ -16,4 +16,4 @@ class Admin::DashboardController < Admin::ApplicationController
# rubocop: enable CodeReuse/ActiveRecord
end
Admin::DashboardController.prepend(EE::Admin::DashboardController)
Admin::DashboardController.prepend_if_ee('EE::Admin::DashboardController')
......@@ -96,4 +96,4 @@ class Admin::GroupsController < Admin::ApplicationController
end
end
Admin::GroupsController.prepend(EE::Admin::GroupsController)
Admin::GroupsController.prepend_if_ee('EE::Admin::GroupsController')
......@@ -12,4 +12,4 @@ class Admin::HealthCheckController < Admin::ApplicationController
end
end
Admin::HealthCheckController.prepend(EE::Admin::HealthCheckController)
Admin::HealthCheckController.prepend_if_ee('EE::Admin::HealthCheckController')
......@@ -21,4 +21,4 @@ class Admin::LogsController < Admin::ApplicationController
end
end
Admin::LogsController.prepend(EE::Admin::LogsController)
Admin::LogsController.prepend_if_ee('EE::Admin::LogsController')
......@@ -77,4 +77,4 @@ class Admin::ProjectsController < Admin::ApplicationController
end
end
Admin::ProjectsController.prepend(EE::Admin::ProjectsController)
Admin::ProjectsController.prepend_if_ee('EE::Admin::ProjectsController')
......@@ -242,4 +242,4 @@ class Admin::UsersController < Admin::ApplicationController
end
end
Admin::UsersController.prepend(EE::Admin::UsersController)
Admin::UsersController.prepend_if_ee('EE::Admin::UsersController')
......@@ -530,4 +530,4 @@ class ApplicationController < ActionController::Base
end
end
ApplicationController.prepend(EE::ApplicationController)
ApplicationController.prepend_if_ee('EE::ApplicationController')
......@@ -47,4 +47,4 @@ class AutocompleteController < ApplicationController
end
end
AutocompleteController.prepend(EE::AutocompleteController)
AutocompleteController.prepend_if_ee('EE::AutocompleteController')
......@@ -84,4 +84,4 @@ module Boards
end
end
Boards::ListsController.prepend(EE::Boards::ListsController)
Boards::ListsController.prepend_if_ee('EE::Boards::ListsController')
......@@ -235,4 +235,4 @@ class Clusters::ClustersController < Clusters::BaseController
end
end
Clusters::ClustersController.prepend(EE::Clusters::ClustersController)
Clusters::ClustersController.prepend_if_ee('EE::Clusters::ClustersController')
......@@ -45,4 +45,4 @@ module BoardsActions
end
end
BoardsActions.prepend(EE::BoardsActions)
BoardsActions.prepend_if_ee('EE::BoardsActions')
......@@ -87,4 +87,4 @@ module BoardsResponses
end
end
BoardsResponses.prepend(EE::BoardsResponses)
BoardsResponses.prepend_if_ee('EE::BoardsResponses')
......@@ -46,4 +46,4 @@ module InternalRedirect
end
end
InternalRedirect.prepend(EE::InternalRedirect)
InternalRedirect.prepend_if_ee('EE::InternalRedirect')
......@@ -224,4 +224,4 @@ module IssuableActions
end
end
IssuableActions.prepend(EE::IssuableActions)
IssuableActions.prepend_if_ee('EE::IssuableActions')
......@@ -215,4 +215,4 @@ module IssuableCollections
# rubocop:enable Gitlab/ModuleWithInstanceVariables
end
IssuableCollections.prepend(EE::IssuableCollections)
IssuableCollections.prepend_if_ee('EE::IssuableCollections')
......@@ -129,4 +129,4 @@ module LfsRequest
end
end
LfsRequest.prepend(EE::LfsRequest)
LfsRequest.prepend_if_ee('EE::LfsRequest')
......@@ -56,4 +56,4 @@ module RoutableActions
end
end
RoutableActions.prepend(EE::RoutableActions)
RoutableActions.prepend_if_ee('EE::RoutableActions')
......@@ -86,4 +86,4 @@ module ServiceParams
end
end
ServiceParams.prepend(EE::ServiceParams)
ServiceParams.prepend_if_ee('EE::ServiceParams')
......@@ -32,4 +32,4 @@ class ConfirmationsController < Devise::ConfirmationsController
end
end
ConfirmationsController.prepend(EE::ConfirmationsController)
ConfirmationsController.prepend_if_ee('EE::ConfirmationsController')
......@@ -90,4 +90,4 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
end
end
Dashboard::ProjectsController.prepend(EE::Dashboard::ProjectsController)
Dashboard::ProjectsController.prepend_if_ee('EE::Dashboard::ProjectsController')
......@@ -39,4 +39,4 @@ class Groups::ApplicationController < ApplicationController
end
end
Groups::ApplicationController.prepend(EE::Groups::ApplicationController)
Groups::ApplicationController.prepend_if_ee('EE::Groups::ApplicationController')
......@@ -45,4 +45,4 @@ class Groups::GroupMembersController < Groups::ApplicationController
alias_method :membershipable, :group
end
Groups::GroupMembersController.prepend(EE::Groups::GroupMembersController)
Groups::GroupMembersController.prepend_if_ee('EE::Groups::GroupMembersController')
......@@ -119,4 +119,4 @@ class Groups::MilestonesController < Groups::ApplicationController
end
end
Groups::MilestonesController.prepend(EE::Groups::MilestonesController)
Groups::MilestonesController.prepend_if_ee('EE::Groups::MilestonesController')
......@@ -233,4 +233,4 @@ class GroupsController < Groups::ApplicationController
end
end
GroupsController.prepend(EE::GroupsController)
GroupsController.prepend_if_ee('EE::GroupsController')
......@@ -8,4 +8,4 @@ class IdeController < ApplicationController
end
end
IdeController.prepend(EE::IdeController)
IdeController.prepend_if_ee('EE::IdeController')
......@@ -187,4 +187,4 @@ class Import::GithubController < Import::BaseController
end
end
Import::GithubController.prepend(EE::Import::GithubController)
Import::GithubController.prepend_if_ee('EE::Import::GithubController')
......@@ -32,4 +32,4 @@ class Ldap::OmniauthCallbacksController < OmniauthCallbacksController
end
end
Ldap::OmniauthCallbacksController.prepend(EE::Ldap::OmniauthCallbacksController)
Ldap::OmniauthCallbacksController.prepend_if_ee('EE::Ldap::OmniauthCallbacksController')
......@@ -215,4 +215,4 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
end
end
OmniauthCallbacksController.prepend(EE::OmniauthCallbacksController)
OmniauthCallbacksController.prepend_if_ee('EE::OmniauthCallbacksController')
......@@ -65,4 +65,4 @@ class PasswordsController < Devise::PasswordsController
end
end
PasswordsController.prepend(EE::PasswordsController)
PasswordsController.prepend_if_ee('EE::PasswordsController')
......@@ -31,4 +31,4 @@ class Profiles::AccountsController < Profiles::ApplicationController
end
end
Profiles::AccountsController.prepend(EE::Profiles::AccountsController)
Profiles::AccountsController.prepend_if_ee('EE::Profiles::AccountsController')
......@@ -51,4 +51,4 @@ class Profiles::PreferencesController < Profiles::ApplicationController
end
end
Profiles::PreferencesController.prepend(::EE::Profiles::PreferencesController)
Profiles::PreferencesController.prepend_if_ee('::EE::Profiles::PreferencesController')
......@@ -44,4 +44,4 @@ class Projects::AutocompleteSourcesController < Projects::ApplicationController
end
end
Projects::AutocompleteSourcesController.prepend(EE::Projects::AutocompleteSourcesController)
Projects::AutocompleteSourcesController.prepend_if_ee('EE::Projects::AutocompleteSourcesController')
......@@ -256,4 +256,4 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end
end
Projects::EnvironmentsController.prepend(EE::Projects::EnvironmentsController)
Projects::EnvironmentsController.prepend_if_ee('EE::Projects::EnvironmentsController')
......@@ -115,4 +115,4 @@ class Projects::GitHttpClientController < Projects::ApplicationController
end
end
Projects::GitHttpClientController.prepend(EE::Projects::GitHttpClientController)
Projects::GitHttpClientController.prepend_if_ee('EE::Projects::GitHttpClientController')
......@@ -111,4 +111,4 @@ class Projects::GitHttpController < Projects::GitHttpClientController
end
end
Projects::GitHttpController.prepend(EE::Projects::GitHttpController)
Projects::GitHttpController.prepend_if_ee('EE::Projects::GitHttpController')
......@@ -54,4 +54,4 @@ class Projects::GroupLinksController < Projects::ApplicationController
end
end
Projects::GroupLinksController.prepend(EE::Projects::GroupLinksController)
Projects::GroupLinksController.prepend_if_ee('EE::Projects::GroupLinksController')
......@@ -74,4 +74,4 @@ class Projects::ImportsController < Projects::ApplicationController
end
end
Projects::ImportsController.prepend(EE::Projects::ImportsController)
Projects::ImportsController.prepend_if_ee('EE::Projects::ImportsController')
......@@ -285,4 +285,4 @@ class Projects::IssuesController < Projects::ApplicationController
end
end
Projects::IssuesController.prepend(EE::Projects::IssuesController)
Projects::IssuesController.prepend_if_ee('EE::Projects::IssuesController')
......@@ -217,4 +217,4 @@ class Projects::JobsController < Projects::ApplicationController
end
end
Projects::JobsController.prepend(EE::Projects::JobsController)
Projects::JobsController.prepend_if_ee('EE::Projects::JobsController')
......@@ -124,4 +124,4 @@ class Projects::LfsApiController < Projects::GitHttpClientController
end
end
Projects::LfsApiController.prepend(EE::Projects::LfsApiController)
Projects::LfsApiController.prepend_if_ee('EE::Projects::LfsApiController')
......@@ -60,4 +60,4 @@ class Projects::MergeRequests::ApplicationController < Projects::ApplicationCont
end
end
Projects::MergeRequests::ApplicationController.prepend(EE::Projects::MergeRequests::ApplicationController)
Projects::MergeRequests::ApplicationController.prepend_if_ee('EE::Projects::MergeRequests::ApplicationController')
......@@ -118,4 +118,4 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
end
end
Projects::MergeRequests::DiffsController.prepend(EE::Projects::MergeRequests::DiffsController)
Projects::MergeRequests::DiffsController.prepend_if_ee('EE::Projects::MergeRequests::DiffsController')
......@@ -338,4 +338,4 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
end
end
Projects::MergeRequestsController.prepend(EE::Projects::MergeRequestsController)
Projects::MergeRequestsController.prepend_if_ee('EE::Projects::MergeRequestsController')
......@@ -91,4 +91,4 @@ class Projects::MirrorsController < Projects::ApplicationController
end
end
Projects::MirrorsController.prepend(EE::Projects::MirrorsController)
Projects::MirrorsController.prepend_if_ee('EE::Projects::MirrorsController')
......@@ -198,4 +198,4 @@ class Projects::PipelinesController < Projects::ApplicationController
end
end
Projects::PipelinesController.prepend(EE::Projects::PipelinesController)
Projects::PipelinesController.prepend_if_ee('EE::Projects::PipelinesController')
......@@ -33,4 +33,4 @@ module Projects
end
end
Projects::Prometheus::MetricsController.prepend(EE::Projects::Prometheus::MetricsController)
Projects::Prometheus::MetricsController.prepend_if_ee('EE::Projects::Prometheus::MetricsController')
......@@ -66,4 +66,4 @@ class Projects::ProtectedRefsController < Projects::ApplicationController
end
end
Projects::ProtectedRefsController.prepend(EE::Projects::ProtectedRefsController)
Projects::ProtectedRefsController.prepend_if_ee('EE::Projects::ProtectedRefsController')
......@@ -87,4 +87,4 @@ class Projects::RepositoriesController < Projects::ApplicationController
end
end
Projects::RepositoriesController.prepend(EE::Projects::RepositoriesController)
Projects::RepositoriesController.prepend_if_ee('EE::Projects::RepositoriesController')
......@@ -123,4 +123,4 @@ module Projects
end
end
Projects::Settings::CiCdController.prepend(EE::Projects::Settings::CiCdController)
Projects::Settings::CiCdController.prepend_if_ee('EE::Projects::Settings::CiCdController')
......@@ -26,4 +26,4 @@ module Projects
end
end
Projects::Settings::IntegrationsController.prepend(EE::Projects::Settings::IntegrationsController)
Projects::Settings::IntegrationsController.prepend_if_ee('EE::Projects::Settings::IntegrationsController')
......@@ -70,4 +70,4 @@ module Projects
end
end
Projects::Settings::OperationsController.prepend(::EE::Projects::Settings::OperationsController)
Projects::Settings::OperationsController.prepend_if_ee('::EE::Projects::Settings::OperationsController')
......@@ -105,4 +105,4 @@ module Projects
end
end
Projects::Settings::RepositoryController.prepend(EE::Projects::Settings::RepositoryController)
Projects::Settings::RepositoryController.prepend_if_ee('EE::Projects::Settings::RepositoryController')
......@@ -42,4 +42,4 @@ class Projects::VariablesController < Projects::ApplicationController
end
end
Projects::VariablesController.prepend(EE::Projects::VariablesController)
Projects::VariablesController.prepend_if_ee('EE::Projects::VariablesController')
......@@ -467,4 +467,4 @@ class ProjectsController < Projects::ApplicationController
end
end
ProjectsController.prepend(EE::ProjectsController)
ProjectsController.prepend_if_ee('EE::ProjectsController')
......@@ -136,4 +136,4 @@ class RegistrationsController < Devise::RegistrationsController
end
end
RegistrationsController.prepend(EE::RegistrationsController)
RegistrationsController.prepend_if_ee('EE::RegistrationsController')
......@@ -63,4 +63,4 @@ class RootController < Dashboard::ProjectsController
end
end
RootController.prepend(EE::RootController)
RootController.prepend_if_ee('EE::RootController')
......@@ -37,4 +37,4 @@ class SentNotificationsController < ApplicationController
end
end
SentNotificationsController.prepend(EE::SentNotificationsController)
SentNotificationsController.prepend_if_ee('EE::SentNotificationsController')
......@@ -251,4 +251,4 @@ class SessionsController < Devise::SessionsController
end
end
SessionsController.prepend(EE::SessionsController)
SessionsController.prepend_if_ee('EE::SessionsController')
......@@ -168,4 +168,4 @@ class UsersController < ApplicationController
end
end
UsersController.prepend(EE::UsersController)
UsersController.prepend_if_ee('EE::UsersController')
......@@ -94,4 +94,4 @@ module Autocomplete
end
end
Autocomplete::UsersFinder.prepend(EE::Autocomplete::UsersFinder)
Autocomplete::UsersFinder.prepend_if_ee('EE::Autocomplete::UsersFinder')
......@@ -35,4 +35,4 @@ class GroupMembersFinder < UnionFinder
# rubocop: enable CodeReuse/ActiveRecord
end
GroupMembersFinder.prepend(EE::GroupMembersFinder)
GroupMembersFinder.prepend_if_ee('EE::GroupMembersFinder')
......@@ -146,4 +146,4 @@ class IssuesFinder < IssuableFinder
end
end
IssuesFinder.prepend(EE::IssuesFinder)
IssuesFinder.prepend_if_ee('EE::IssuesFinder')
......@@ -102,4 +102,4 @@ class MergeRequestsFinder < IssuableFinder
end
end
MergeRequestsFinder.prepend(EE::MergeRequestsFinder)
MergeRequestsFinder.prepend_if_ee('EE::MergeRequestsFinder')
......@@ -154,4 +154,4 @@ class NotesFinder
end
end
NotesFinder.prepend(EE::NotesFinder)
NotesFinder.prepend_if_ee('EE::NotesFinder')
......@@ -96,4 +96,4 @@ class UsersFinder
end
end
UsersFinder.prepend(EE::UsersFinder)
UsersFinder.prepend_if_ee('EE::UsersFinder')
......@@ -20,4 +20,4 @@ module Types
end
end
Types::GroupType.prepend(EE::Types::GroupType)
Types::GroupType.prepend_if_ee('EE::Types::GroupType')
......@@ -58,4 +58,4 @@ module Types
end
end
Types::IssueType.prepend(::EE::Types::IssueType)
Types::IssueType.prepend_if_ee('::EE::Types::IssueType')
......@@ -18,4 +18,4 @@ module Types
end
end
::Types::MutationType.prepend(::EE::Types::MutationType)
::Types::MutationType.prepend_if_ee('::EE::Types::MutationType')
......@@ -24,4 +24,4 @@ module Types
end
end
Types::Notes::NoteableType.extend(::EE::Types::Notes::NoteableType)
Types::Notes::NoteableType.extend_if_ee('::EE::Types::Notes::NoteableType')
......@@ -13,4 +13,4 @@ module Types
end
end
Types::PermissionTypes::Issue.prepend(::EE::Types::PermissionTypes::Issue)
Types::PermissionTypes::Issue.prepend_if_ee('::EE::Types::PermissionTypes::Issue')
......@@ -21,4 +21,4 @@ module Types
end
end
Types::PermissionTypes::Project.prepend(EE::Types::PermissionTypes::Project)
Types::PermissionTypes::Project.prepend_if_ee('EE::Types::PermissionTypes::Project')
......@@ -79,4 +79,4 @@ module AppearancesHelper
end
end
AppearancesHelper.prepend(EE::AppearancesHelper)
AppearancesHelper.prepend_if_ee('EE::AppearancesHelper')
......@@ -307,4 +307,4 @@ module ApplicationHelper
end
end
ApplicationHelper.prepend(EE::ApplicationHelper)
ApplicationHelper.prepend_if_ee('EE::ApplicationHelper')
......@@ -293,8 +293,8 @@ module ApplicationSettingsHelper
end
end
ApplicationSettingsHelper.prepend(EE::ApplicationSettingsHelper) # rubocop: disable Cop/InjectEnterpriseEditionModule
ApplicationSettingsHelper.prepend_if_ee('EE::ApplicationSettingsHelper') # rubocop: disable Cop/InjectEnterpriseEditionModule
# The methods in `EE::ApplicationSettingsHelper` should be available as both
# instance and class methods.
ApplicationSettingsHelper.extend(EE::ApplicationSettingsHelper)
ApplicationSettingsHelper.extend_if_ee('EE::ApplicationSettingsHelper')