6

When a create a new Joomla component or module, the most part of coding and development is done inside the CMS structure, with the component already installed.

- administrator
    - cache
    - components
        - com_component
            - <arquivos do componente>
    - help
    - includes
    - language
    - logs
    - manifests
    - modules
    - templates
- bin
- cache
- cli
- components
    - com_component
        - <arquivos do componente>
- images
- includes
- installation
- language
- layouts
- libraries
- media
- modules
- plugins
- templates
- tmp

My question is about how i version the project files inside this structure.

If i use .gitignore to ignore ALL the other Joomla files, my git repository looks like:

- administrator
    - components
        - com_component
            - <arquivos do componente>
- components
    - com_component
        - <arquivos do componente>

But i would like that my repository looks like a component ready to be installed (just zip and install it by joomla installer)

- admin
    - <arquivos do componente>
- site
    - <arquivos do componente>
- manifest.xml
4

One approach I read about to making your component a proper format for versioning and zipping 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/

3

You did not mention which editor you are using. However most editors such as Eclipse supports ANT build files and can automatically build whenever any change done to the source code.

So here is how I do my development.

  • I use separate workspace for all my projects
  • I structure my component like what you mentioned in your last code block i.e. only the component structure and no Joomla! folders.
  • I use ANT build file to build and send all changed files to my Joomla local installation folder
  • Finally when needed, I use same build file (with different target) to build my final package.

Here is my structure of the package folder:

pkg_extension
  - com_extension
    - site
    - language
    - admin
    - extension.xml
    - script.php
  - plg_someplugin
  - mod_somemod
  - pkg_extension.xml
  - build.xml

And here is sample of my build.xml looks like

<?xml version="1.0" encoding="UTF-8"?>
<project name="Extension" default="copyall" basedir=".">
   <property name="site3" value="d:/xampp/htdocs/joomla/components/com_extension" />
   <property name="admin3" value="d:/xampp/htdocs/joomla/administrator/components/com_extension" />
   <property name="sitelang3" value="d:/xampp/htdocs/joomla/language/" />
   <property name="adminlang3" value="d:/xampp/htdocs/joomla/administrator/language" />
   <target name="copyall">
      <copy todir="${site3}"><fileset dir="com_extension/site"><include name="**"/></fileset></copy>
      <copy todir="${admin3}" ><fileset dir="com_extension/admin"><include name="**" /><exclude name="language/**"/></fileset></copy>
      <copy todir="${sitelang3}"><fileset dir="com_extension/site/language"><include name="**"/></fileset></copy>
      <copy todir="${adminlang3}"><fileset dir="com_extension/admin/language"><include name="**"/></fileset></copy>
   </target>
</project>

You need not use the same approach and can write build file in whatever the way you like, this is just an example how you can do it.

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.