Add dedicated methods for injecting EE modules into CE code
Currently EE modules are injected into classes/modules using
Object#prepend. In order to move to a single codebase, we need to be able to somehow disable or remove these lines. This is necessary in order to disable EE specific features when CE is used, and to allow complete removal of proprietary code when building CE packages.
The easiest way that I can think of is to do the following:
- We define the methods
Object#ee_prepend. These methods are available in both CE and EE.
- These methods take a string instead of a constant.
- When these methods detect EE is used, they resolve the string into a constant and inject the corresponding module.
- When CE is used, these methods don't do anything
In this setup, building CE is just a matter of running
rm -rf ee/ and we're good to go. Implementation wise these methods would be as simple as the following:
def ee_prepend(name) return unless we_are_using_enterprise_edition self.prepend(name.constantize) end