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
e379e1e2
Commit
e379e1e2
authored
Aug 21, 2017
by
Toon Claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always use `prepend` (over `include`) and document where to put views
parent
5e725418
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
17 deletions
+20
-17
doc/development/ee_features.md
doc/development/ee_features.md
+20
-17
No files found.
doc/development/ee_features.md
View file @
e379e1e2
...
@@ -28,6 +28,16 @@ Merging changes from GitLab CE to EE can result in numerous conflicts.
...
@@ -28,6 +28,16 @@ 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
To reduce conflicts, EE code should be separated in to the
`EE`
module
as much as possible.
as much as possible.
### 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.
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
### Adding EE-only files
Place EE-only controllers, finders, helpers, mailers, models, policies,
Place EE-only controllers, finders, helpers, mailers, models, policies,
...
@@ -46,13 +56,7 @@ serializers/entities, services, validators and workers in the top-level
...
@@ -46,13 +56,7 @@ serializers/entities, services, validators and workers in the top-level
-
`ee/app/validators/ee/foo_attr_validator.rb`
-
`ee/app/validators/ee/foo_attr_validator.rb`
-
`ee/app/workers/ee/foo_worker.rb`
-
`ee/app/workers/ee/foo_worker.rb`
### Classes vs. Module Mixins
This applies to both EE-only classes and EE module mixins.
If the feature being developed is not present in any form in CE, separation is
easier - build the class entirely in the
`EE`
namespace. For features that build
on existing CE features, write a module in the
`EE`
namespace and include it
in the CE class. This makes conflicts less likely during CE to EE merges
because only one line is added to the CE class - the
`include`
statement.
#### Overriding CE methods
#### Overriding CE methods
...
@@ -67,12 +71,8 @@ There are a few gotchas with it:
...
@@ -67,12 +71,8 @@ There are a few gotchas with it:
renamed in CE, the EE override won't be silently forgotten.
renamed in CE, the EE override won't be silently forgotten.
-
when the "overrider" would add a line in the middle of the CE
-
when the "overrider" would add a line in the middle of the CE
implementation, you should refactor the CE method and split it in
implementation, you should refactor the CE method and split it in
smaller methods.
smaller methods. Or create a "hook" method that is empty in CE,
-
when the original implementation contains a guard clause (e.g.
and with the EE-specific implementation in EE.
`return unless condition`
), it doesn't return from the overriden method (it's
actually the same behavior as with method overridding via inheritance). In
this case, it's usually better to create a "hook" method that is empty in CE,
and with the EE-specific implementation in EE
When prepending, place them in the
`ee/`
specific sub-directory, and
When prepending, place them in the
`ee/`
specific sub-directory, and
wrap class or module in
`module EE`
to avoid naming conflicts.
wrap class or module in
`module EE`
to avoid naming conflicts.
...
@@ -224,9 +224,12 @@ view. For instance the approval code in the project's settings page.
...
@@ -224,9 +224,12 @@ view. For instance the approval code in the project's settings page.
**Mitigations**
**Mitigations**
Blocks of code that are EE-specific should be moved to partials as much as
Blocks of code that are EE-specific should be moved to partials. This
possible to avoid conflicts with big chunks of HAML code that that are not
avoids conflicts with big chunks of HAML code that that are not fun to
fun to resolve when you add the indentation to the equation.
resolve when you add the indentation to the equation.
EE-specific views should be placed in
`ee/app/views/ee/`
, using extra
sub-directories if appropriate.
### Code in `lib/`
### Code in `lib/`
...
@@ -242,7 +245,7 @@ When you're testing EE-only features, avoid adding examples to the
...
@@ -242,7 +245,7 @@ When you're testing EE-only features, avoid adding examples to the
existing CE specs. Also do no change existing CE examples, since they
existing CE specs. Also do no change existing CE examples, since they
should remain working as-is when EE is running without a license.
should remain working as-is when EE is running without a license.
Instead place EE specs in the
`
/
spec/ee/spec`
folder.
Instead place EE specs in the
`spec/ee/spec`
folder.
## JavaScript code in `assets/javascripts/`
## JavaScript code in `assets/javascripts/`
...
...
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