Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e1168216
Commit
e1168216
authored
Oct 23, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update EE docs to allow not having EE namespace
parent
39c285d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
20 deletions
+36
-20
doc/development/ee_features.md
doc/development/ee_features.md
+36
-20
No files found.
doc/development/ee_features.md
View file @
e1168216
...
...
@@ -23,31 +23,49 @@ spec helper `stub_licensed_features` in `EE::LicenseHelpers`.
## Separation of EE code
Merging changes from GitLab CE to EE can result in numerous conflicts.
To reduce conflicts, EE code should be separated in to the
`EE`
module
as much as possible.
When referencing constants
*outside*
of the
`EE`
namespace from within it, you
should always use absolute constants - e.g.,
`::User`
instead of
`User`
. This
will prevent
`::EE::User`
from being picked instead of
`::User`
. Follow this
rule even if the constant doesn't exist in the
`EE`
namespace at present - it
may be added in the future.
### Classes vs. Module Mixins
If the feature being developed is not present in any form in CE,
separation is easy - build the class entirely in the
`EE`
namespace.
We want a
[
single code base
][]
eventually, but before we reach the goal,
we still need to merge changes from GitLab CE to EE. To help us get there,
we should make sure that we no longer edit CE files in place in order to
implement EE features.
Instead, all EE codes should be put inside the
`ee/`
top-level directory, and
tests should be put inside
`spec/ee/`
. We don't use
`ee/spec`
for now due to
technical limitation. The rest of codes should be as close as to the CE files.
[
single code base
]:
https://gitlab.com/gitlab-org/gitlab-ee/issues/2952#note_41016454
### EE-only features
If the feature being developed is not present in any form in CE, we don't
need to put the codes under
`EE`
namespace. For example, an EE model could
go into:
`ee/app/models/awesome.rb`
using
`Awesome`
as the class name. This
is applied not only to models. Here's a list of other examples:
-
`ee/app/controllers/foos_controller.rb`
-
`ee/app/finders/foos_finder.rb`
-
`ee/app/helpers/foos_helper.rb`
-
`ee/app/mailers/foos_mailer.rb`
-
`ee/app/models/foo.rb`
-
`ee/app/policies/foo_policy.rb`
-
`ee/app/serializers/foo_entity.rb`
-
`ee/app/serializers/foo_serializer.rb`
-
`ee/app/services/foo/create_service.rb`
-
`ee/app/validators/foo_attr_validator.rb`
-
`ee/app/workers/foo_worker.rb`
### EE features based on CE features
For features that build on existing CE features, write a module in the
`EE`
namespace and
`prepend`
it in the CE class. This makes conflicts
less likely to happen during CE to EE merges because only one line is
added to the CE class - the
`prepend`
line.
### Adding EE-only files
Since the module would require an
`EE`
namespace, the file should also be
put in an
`ee/`
sub-directory. For example, we want to extend the user model
in EE, so we have a module called
`::EE::User`
put inside
`ee/app/models/ee/user.rb`
.
Place EE-only controllers, finders, helpers, mailers, models, policies,
serializers/entities, services, validators and workers in the top-level
`EE`
module namespace, and in the
`ee/`
specific sub-directory:
This is also not just applied to models. Here's a list of other examples:
-
`ee/app/controllers/ee/foos_controller.rb`
-
`ee/app/finders/ee/foos_finder.rb`
...
...
@@ -61,8 +79,6 @@ serializers/entities, services, validators and workers in the top-level
-
`ee/app/validators/ee/foo_attr_validator.rb`
-
`ee/app/workers/ee/foo_worker.rb`
This applies to both EE-only classes and EE module mixins.
#### Overriding CE methods
To override a method present in the CE codebase, use
`prepend`
. It
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment