How often does it happen: There is a perfect pre-made add-on / plugin available for your CMS however the web project has a specific requirement that this add-on doesnt quite meet.
The patching begins.
On Aldryn, currently there are some drawbacks with Add-On development:
- Adding an add-on requires rebuilding the docker container and this is slow.
- There is no way to “install” an existing add-on and then patch it, and include the changed code in the source code repository.
- Forks of existing add-ons need to be public on github so that the deploy process can install them (with pip). That doesn’t fly for project-specific patched versions.
I have tested a way to make this patching process cleaner. Below I try to sketch it out.
It requires a virtualenv setup and the command line aldryn client.
- Now, a public add-on repo (like aldryn-events) can be duplicated (git clone & git rm remote origin, then add your own repo’s remote)
- This private ‘fork’ can now be cloned into Aldryn’s project
/addons-dev
. - Install it by adding
-e /absolute/path/to/Projects/project-name/addons-dev/project-name-aldryn-events
torequirements.in
andpip install -r requirements.in
- Add the app name to
settings.py
and maybe run./manage.py migrate
- Now you can patch, test and commit to your own private repo.
- Once you are happy with the patched version you can go into
/addons-dev/project-aldryn-events
andaldryn addons register "Project Name Aldryn Events" project-aldryn-events
andaldryn addons upload
. From the Aldryn web console you can then install the new add-on into the system (in the virtualenv, dogit pull
andpip install -r requirements.in
) - For the installed addons to work the addons in
addons-dev
have to be renamed (I rename them to addon-name-dev).
Note: For easier upgrading it is even possible to diff the patched version with the original open source version:
- add the original version as remote: `git remote add upstream git-url`
- Then `git checkout -b original upstream/master`
- Now a pull request between your patched branch and `original` can be made on github