Fork me on GitHub

Watch

GitHub Core

Show your support for Zikula! Sign up at Github account and watch the Core project!




GitHub Modules

Forum Activity

Forum feed

» Visit forum | » View latest posts

News

Articles | Development

Articles: Git Repository Layout

Contributed by drak on Dec 17, 2012 - 02:56 PM

Development

In response to a common complaint I am announcing some changes to the recommended module repository structures in GIT. This doesn’t affect modules in Zikula Core 1.3 in any way but this change will make it easier to checkout modules directly into your Zikula modules/ folder.

The other reason is when a module is tagged it at Github, the archive will be autocreated without any

Most modules are currently using following the structure.

 src/
     modules/
         ModuleName/
             lib/
                 ModuleName/
                     Controller/
                         Admin.php
                         User.php
             templates/
                 modulename_user_view.tpl

The problem with this is that you cannot checkout repositories directly into Zikula’s modules/ without using cumbersome symbolic links. This vastly complicates things and is a constant source of frustration.

The following structural change should be done now for all 1.3 modules. Here is a simple example using EZComments as an example. Were’ simply going to move all the files from src/modules/EZComments up to the module’s root folder.

    git clone git@github.com:/zikula-modules/EZComments
    cd EZComments
    git mv src/modules/EZComments/* .
    git commit -a -m “Restructure repository layout”
    git push origin master

Done.

Footnote: This assumes the 1.3 module version is in the master branch. If you do have lower versions that are 1.3 compatible you should apply the changes to the lower lower branch, then switch to master and merge.

Footnote:

Another other benefit is when a module is tagged it at Github, the archive will be auto-created with the right structure.

 

Share    

Comments

Comment by:
espaan's Avatar
espaan
17 Dec 2012 - 03:58AM
modules that have a themes, config or userdata folder
How to proceed with modules having
- config
- themes
- userdata
folders present in the src folder, next to modules, the README.md will now also get into the modules structure.

where should the tests go, several modules have now
- src
- tests
for instance MOST modules.
 
Comment by:
drak's Avatar
drak
17 Dec 2012 - 04:28AM
The best way forward would be to create a Resources/ folder. Bearing in mind the following will be reserved in 1.4

Resources/config (configuration files)
Resources/docs (documentation)
Resources/locale (translation)
Resources/public (assets - images, CSS, js)
Resources/views (templates)

So you could put Resources/extras

Tests go in Tests/ which is how it's done in Symfony Bundles/Components.
 
Comment by:
craigh's Avatar
craigh
17 Dec 2012 - 04:41AM
that also seems awkward. exchanging one problem for another.
 
Comment by:
drak's Avatar
drak
17 Dec 2012 - 05:00AM
Which part is awkward?
 
Comment by:
phaidon's Avatar
phaidon
17 Dec 2012 - 05:42AM
I dont know if Resources/extras/themes/rss/.. is an elegant solution
 
Comment by:
craigh's Avatar
craigh
17 Dec 2012 - 08:26AM
what phaidon said - it is awkward to put stuff IN a module directory that is supposed to be moved out and elsewhere.
 
Comment by:
Jusuff's Avatar
Jusuff
17 Dec 2012 - 06:37PM
I don't thing modules should store anything outside it's own dir.
Maybe "Resources/whatever" is awkward but at least module stuff would be separated.
 
Comment by:
espaan's Avatar
espaan
18 Dec 2012 - 08:39AM
So where to put themes
Resources/extras/themes ?

Then people will need to manually move the files for the RSS theme to the themes/RSS/.. folder. In the past when uploading the modules this was automatic, since the themes/RSS/templates/modules/Content/... was uploaded too.
 
Comment by:
Jusuff's Avatar
Jusuff
19 Dec 2012 - 11:26AM
Maybe core should support this somehow, for example allow to register theme parts in Resources/extras/themes (parts, not full themes which should not be shipped with modules)?
 
Comment by:
portugao's Avatar
portugao
23 Dec 2012 - 05:14AM
Want to understand
The problem with this is that you cannot checkout repositories directly into Zikula’s modules/ without using cumbersome symbolic links. This vastly complicates things and is a constant source of frustration.

@drak
I would like to understand what does it mean. At the moment I do not. What exactly is the reason for your frustration?
 
Comment by:
rallek's Avatar
rallek
24 Dec 2012 - 12:37AM
where do we collect these rules?
I think it would be a good idea to collect these kind of rules somewhere in a developer documentation
 
Comment by:
Jusuff's Avatar
Jusuff
24 Dec 2012 - 01:00PM
@portugao

Right now we have repositories with following structure:
1. Core:
src/config/
src/docs/
...
src/modules/...

2. Modules - eg News
src/modules/News/lib/
src/modules/News/templates/
etc

This was old (probably required by Extensions DB) layout, which in git environment is causing one essential issue: you cannot easily clone News module sources to Core. Git does not allow to "mix" two repos. You can clone 3-rd party repo but in has to be placed in single directory. This means that if you would like to clone News module to Core, the only possibility would be:
src/modules/[News] <- and here News repo would be placed.
But this would mean wrong structure:
src/modules/[News]/src/modules/News/[and here News stuff]

With Drak's change modules repository structure would be "flatten" and would allow to clone modules repositories directly into Core:
src/modules/[News] <= this would be repo, which wouldn't contain problematic 'src/modules' part.
 
Only logged in users are allowed to comment. register/log in