4

My goal is to setup a proper development environment using Ubuntu 16.04 to build Joomla extensions.

Until now I've just been zipping my extension and reinstalling it. That should drive anyone crazy.

As I sometimes also want to debug using Xdebug and I want to directly view the effect of my code changes I thought it would be nice to develop the extension directly inside the Joomla installation directory and then copy it back again to an extension.

I've read https://docs.joomla.org/Extension_development_using_eclipse_and_phing.

They use Phing there as a build tool and propose some example build scripts for both development directions (from extension to Joomla installation directory and vice versa).

Then I found this Git repository: https://github.com/enav/phing-joomla-extension-builder. Which works and seems to be usable in tandem with Git.

Still, I'd like to know if someone already has come up with a more efficient and proven development environment?

Or maybe someone has some pointers for creating a sane development environment? I'm open to suggestions.

For anyone looking for the part about the file permissions issue: as suggested in the comments I've split up this question and placed it here:

https://stackoverflow.com/q/46852847/694400

7
  • I wouldn't normally say this, but it might be an idea to also post your question on Stack Overflow, where it may receive more attention – Lodder Oct 19 '17 at 11:10
  • @Lodder Thanks, I've followed your advice and created a very similar question here at StackOverflow: stackoverflow.com/questions/46832534/… – Wieger Oct 19 '17 at 14:42
  • 4
    For people looking at starting a dev environment, I would recommend checking out this tutorial -> vdespa.com/joomla-3-getting-started-with-extension-development It has a lot of good pointers. – TryHarder Oct 19 '17 at 22:40
  • 1
    @TryHarder Thank you for your suggestion and also the link you posted. I have split up the question. I will also read the page you posted regarding the development environment and test it. – Wieger Oct 20 '17 at 15:57
  • 1
    @TryHarder It is a pity that IDE is not free and I don't know if we will have enough RAM available for using a virtual machine (Vagrant) on top of the already running Ubuntu 16.04. Still, the tutorial is much appreciated, especially the tip of using symbolic links for extensions! – Wieger Nov 4 '17 at 23:54
1

Once a user recomend to me build a development environment using Ant

How to version a Joomla component

Also, you can build a structure usint git submodules. Where the project will be split in the joomla folders, and somewhere you'll keep a master git project for each components with all the submodules togheter. This will become the zip file

1

My question was answered in the comments section by user TryHarder. I'll formulate it as follows:

The approach I'm using is this:

  • Take a copy of your component and install it;
  • Remove the installed component folders within your Joomla installation (administrator/components/com_component, components/com_component, media/com_component);
  • Then create symbolic links from those folders to folders within a copy of your component;
  • The referenced copy of your component can be properly versioned using Git.

If there are any database changes (e.g. SQL installation script changes) then one can execute some commands (e.g. ALTER TABLE or CREATE TABLE) to add the fields or tables, if one does not want to reinstall the component.

Another option is to just run the SQL uninstall script for your database and then run the SQL install script again, maybe even via a Git hook or semi-automatic via a script which invokes MySQL (or some other database) to execute the SQL.

Of course one can always remove the component from the Joomla installation and install again. If so, then the process in this post above needs to be repeated.

The creating of symbolic links could be automated using a script.

If you want your component to live inside the Joomla installation directory, this is also possible, e.g. living in say _source/components/com_mycomponent, then you just need to add the _source folder to your .gitignore file.

Source: http://vdespa.com/joomla-3-getting-started-with-extension-development/ (via user TryHarder).

1

Could that be a use case for Docker?

  • Run official Joomla docker image in a specific version, and you can swap for another version for testing various environments
  • If a specific website is using the extensions, a snapshot of the website can be turned into a docker image
  • Docker image should have xdebug ready to go and be able to remote debug. Visual Studio Code now have a way to use docker image as workspace, or via ssh tunnel.
  • Probably the most tricky part.. manipulate extension code seamlessly:
    • Sync files when saving or running command (rsync via ssh) ?
    • Docker volumes (requires volume for each extension "entry point" like site, admin, media, etc).
    • Package extension and install using CLI via ssh ..not great for development, but maybe tests.
    • ...
2
  • Are you planning on finishing this answer? The ... feels like such a cliffhanger. – mickmackusa Jan 5 at 1:01
  • Welcome to JSE, Iso. Please take our tour and feel free to wear a hat that you have earned -- visit your profile to see your Winter Bash hat list. – mickmackusa Jan 5 at 1:03
0

For local development, there is nothing better than a Docker. We develop exclusively in a Docker.
That's no magic either. Simple LAMP conatiner, install joomla once, dump db and store everything together in Git. All plugins, modules, components are included as submodules.

The main repo of a component consists of several submodules (site, admin, media,...) which are furthermore included as submodules at the respective places. For the language files we have a script that copies the file to the appropriate places.

Only the handling of database changes is still a problem from my point of view. Here we usually work manually. Actually, it's a pity that Joomla doesn't work like Moodle, for example, where database changes are recognized and an update step is required. Possibly, in the medium term, a contribution to the Joomla Core could be made for this. Would be in any case an interesting challenge!

Oh well, to make an installation package out of it later, it is enough to check out and zip the submodule of the respective plugin/module or the main repo of the component at any place (outside of Docker).

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.