Move all EE-specific code to ee/ and spec/ee/ directories
We're trying to move all our EE-specific code out of files shared with GitLab CE and into EE-specific modules, which are prepended to their CE equivalents. These go into EE subdirectories, of which there are currently many:
./app/assets/javascripts/vue_merge_request_widget/ee
./app/controllers/ee
./app/helpers/ee
./app/mailers/emails/ee
./app/models/concerns/ee
./app/models/ee
./app/policies/ee
./app/services/ee
./app/workers/ee
./app/views/groups/ee
./app/views/projects/ee
./app/views/projects/variables/ee
./app/views/shared/members/ee
./app/views/shared/issuable/form/ee
./lib/gitlab/email/handler/ee
./lib/ee
./lib/banzai/reference_parser/ee
./qa/qa/ee
./spec/requests/api/ee
./spec/policies/ee
./spec/models/ee
./spec/workers/ee
./spec/services/ee
./spec/helpers/ee
./spec/views/layouts/nav/ee
./spec/features/projects/settings/ee
./spec/features/projects/ee
./spec/features/projects/milestones/ee
./spec/features/issues/ee
./spec/features/groups/ee
./spec/features/boards/ee
./spec/fixtures/api/schemas/public_api/v4/ee
./spec/support/ee
./spec/lib/gitlab/email/handler/ee
./spec/lib/gitlab/ee
./spec/lib/ee
./spec/controllers/ee
The is no universal convention on where to place an EE-only file, and this leads to muddles.
If we instead use ee/
as an unconditional top-level prefix, we have a simple, clear idiom to follow, and the EE-specific code can be screened out with a single rule: ee/*
. Our directory tree might then look like:
./ee/app/assets/javascripts/vue_merge_request_widget
./ee/app/controllers
./ee/app/helpers
./ee/app/mailers
./ee/app/models
./ee/app/policies
./ee/app/services
./ee/app/workers
./ee/app/views
./ee/lib
./ee/qa
./ee/spec
It's also possible that, by following this rule, we could eventually do away with the manual prepend ::EE::...
lines we currently have to add to CE files. Instead, we could traverse the ee/{app,lib}
directory tree, require
each file and its CE equivalent, then run ce_class.prepend(ee_module)
at startup, or cleverly hooked into the autoloading mechanism somehow.
Database migrations and schema left as an exercise for the reader.
/cc @DouweM