Organization of Component in a Repository
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
Forum rules
-
- Joomla! Apprentice
- Posts: 7
- Joined: Thu Sep 13, 2007 12:57 am
- Location: New York, USA
- Contact:
Organization of Component in a Repository
Hello,
I am looking for some advice on how to organize a component in a repository, such as Subversion. What I have noticed with many components, is that typically there is a disjoint between how a .zip distribution of a component is organized, and how those files actually get placed into Joomla. So in other words, the file structure of the .zip does not match the actual file structure of how those files will get placed into Joomla, once the component is installed.
Why is this the case? Doesn't that make version control more difficult?
If anyone is familiar with this concept: http://svnbook.red-bean.com/en/1.1/ch07s05.html , that is essentially what I am looking to do. And I haven't been able to figure out how to do it with anything other than Joomla's core, because there's no issue with directory structure there (the .zip IS the file structure of Joomla).
Any advice is appreciated.
I am looking for some advice on how to organize a component in a repository, such as Subversion. What I have noticed with many components, is that typically there is a disjoint between how a .zip distribution of a component is organized, and how those files actually get placed into Joomla. So in other words, the file structure of the .zip does not match the actual file structure of how those files will get placed into Joomla, once the component is installed.
Why is this the case? Doesn't that make version control more difficult?
If anyone is familiar with this concept: http://svnbook.red-bean.com/en/1.1/ch07s05.html , that is essentially what I am looking to do. And I haven't been able to figure out how to do it with anything other than Joomla's core, because there's no issue with directory structure there (the .zip IS the file structure of Joomla).
Any advice is appreciated.
- Vince Cardillo
-
- Joomla! Apprentice
- Posts: 41
- Joined: Sat Dec 15, 2007 3:02 pm
- Location: Washington DC Metro
Re: Organization of Component in a Repository
Vince, straight up, I'll admit that I'm new to Joomla and diving right into 1.5. But I've been working on development my own component using EasyEclipse for PHP and Subversion.
Basically, the repository will be the new component itself (start a new project named com_componentname). All files and subdirectories relating to the front-end will be contained directly beneath the com_componentname directory. Back-end files and subdirectories will be placed in an admin/ folder.
Correct formation of the xml file is critical to proper uploading and initialization of the component through Joomla's Extension Manager. The initialization process recognizes those files in the area of the xml file and puts them in the administrator/ subdirectory on your server.
A good example of a component xml file can be found at: http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,components:xml_installfile/
I would also suggest a good read-through of the MVC model for components: http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,jbeginners:introduction/ (see Week 4, Model-View-Controller)
Basically, the repository will be the new component itself (start a new project named com_componentname). All files and subdirectories relating to the front-end will be contained directly beneath the com_componentname directory. Back-end files and subdirectories will be placed in an admin/ folder.
Correct formation of the xml file is critical to proper uploading and initialization of the component through Joomla's Extension Manager. The initialization process recognizes those files in the
A good example of a component xml file can be found at: http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,components:xml_installfile/
I would also suggest a good read-through of the MVC model for components: http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,jbeginners:introduction/ (see Week 4, Model-View-Controller)
Denise
-
- Joomla! Apprentice
- Posts: 7
- Joined: Thu Sep 13, 2007 12:57 am
- Location: New York, USA
- Contact:
Re: Organization of Component in a Repository
Thanks for this advice.
So, how do you setup your working project? For example, you obviously can't test the component, unless it is installed into a working copy of Joomla. But since your working file structure, and your SVN repository structure are differing, I am at a loss as to how you check-in your code, and continually test the component. Can you possibly give me a more detailed explanation of how you setup a project? I have always been confused about this, since the resulting structure of the .zip does not match the structure of the component when it is installed into Joomla. Add to that the fact that you have:
-Root
--components
--modules
--administrator
--mambots
Three to four disjointed folders that may contain files for the component. How do you manage to check these things into subversion properly?
Thanks for any advice.
So, how do you setup your working project? For example, you obviously can't test the component, unless it is installed into a working copy of Joomla. But since your working file structure, and your SVN repository structure are differing, I am at a loss as to how you check-in your code, and continually test the component. Can you possibly give me a more detailed explanation of how you setup a project? I have always been confused about this, since the resulting structure of the .zip does not match the structure of the component when it is installed into Joomla. Add to that the fact that you have:
-Root
--components
--modules
--administrator
--mambots
Three to four disjointed folders that may contain files for the component. How do you manage to check these things into subversion properly?
Thanks for any advice.
- Vince Cardillo
-
- Joomla! Apprentice
- Posts: 7
- Joined: Thu Sep 13, 2007 12:57 am
- Location: New York, USA
- Contact:
Re: Organization of Component in a Repository
Can a moderator let me know if this question is in the appropriate forum? I would really appreciate being able to speak with a developer about how one goes about this sort of thing.
- Vince Cardillo
Re: Organization of Component in a Repository
This is a great question for this forum, I think. I'm not a developer, but I have some experience working with this and building components.
When I first started out, I would create two directories in my SVN tree: site and admin. Then, I would install the component, and then checkout those directories in the appropriate location. This worked okay...
Nowadays, I will create a directory structure in my SVN tree that matches where the files actually go. So if I were building a component called example, I would have the following directory structure:
components/com_example
administrator/components/com_example
and I put all my files in those directories.
I checkout a copy of the repository into my Joomla! working directory, and then I export a copy of the SVN repository over top of it. Whenever I want to update Joomla!, I just do another svn export.
I have a basic bash script that I use to generate the final archive from this repository.
Ian
When I first started out, I would create two directories in my SVN tree: site and admin. Then, I would install the component, and then checkout those directories in the appropriate location. This worked okay...
Nowadays, I will create a directory structure in my SVN tree that matches where the files actually go. So if I were building a component called example, I would have the following directory structure:
components/com_example
administrator/components/com_example
and I put all my files in those directories.
I checkout a copy of the repository into my Joomla! working directory, and then I export a copy of the SVN repository over top of it. Whenever I want to update Joomla!, I just do another svn export.
I have a basic bash script that I use to generate the final archive from this repository.
Ian
Help test my Component XML Generator Tool!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
-
- Joomla! Apprentice
- Posts: 7
- Joined: Thu Sep 13, 2007 12:57 am
- Location: New York, USA
- Contact:
Re: Organization of Component in a Repository
Thanks Ian. I have a few questions now. This is where you lost me:
What do you mean by that? Why would you checkout and export into the same working copy?
and then I export a copy of the SVN repository over top of it. Whenever I want to update Joomla!, I just do another svn export.
What do you mean by that? Why would you checkout and export into the same working copy?
- Vince Cardillo
Re: Organization of Component in a Repository
oh...
didn't clarify that...
So, you checkout the working copy of your repository. And then you export the Joomla! repository over top of it (or just use the Joomla! 1.5 stable package).
Ian
didn't clarify that...
So, you checkout the working copy of your repository. And then you export the Joomla! repository over top of it (or just use the Joomla! 1.5 stable package).
Ian
Help test my Component XML Generator Tool!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
-
- Joomla! Apprentice
- Posts: 7
- Joined: Thu Sep 13, 2007 12:57 am
- Location: New York, USA
- Contact:
Re: Organization of Component in a Repository
That is an interesting idea. Do you maintain a separate working copy for each component you are developing?
- Vince Cardillo
Re: Organization of Component in a Repository
I usually give each component its own repository or at least its own folder...
Ian
Ian
Help test my Component XML Generator Tool!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
-
- Joomla! Apprentice
- Posts: 7
- Joined: Thu Sep 13, 2007 12:57 am
- Location: New York, USA
- Contact:
Re: Organization of Component in a Repository
But do you run an installation of Joomla per component your are developing, or just one overall Joomla installation to house all the components you are developing? The problem I see with that, is that Subversion does not like it when you checkout a project inside of another project.
- Vince Cardillo
Re: Organization of Component in a Repository
The best way is to work under linux and use symbolic links... That way, you just checkout your component anywhere, and link the "site" and "admin" folders to the proper path of your webserver.
It works particularly well with joomla 1.5 as even the modules have their own folders, so you don't have to link the modules files individually.
With windows if you are only working with single component, i would suggest Ian method (i first install the component, then delete the site and admin folders, and then proceed to the checkout).
If you are working with several components at the same time, you might want to have seperate checkouts for admin and site parts of each component, but it will be a mess to maintain, and you will have to commit separately both parts too (unless anybod has a trick).
Maybe some lamp server on windows allow to use symlinks too, but i couldn't find any.
It works particularly well with joomla 1.5 as even the modules have their own folders, so you don't have to link the modules files individually.
With windows if you are only working with single component, i would suggest Ian method (i first install the component, then delete the site and admin folders, and then proceed to the checkout).
If you are working with several components at the same time, you might want to have seperate checkouts for admin and site parts of each component, but it will be a mess to maintain, and you will have to commit separately both parts too (unless anybod has a trick).
Maybe some lamp server on windows allow to use symlinks too, but i couldn't find any.
-
- Joomla! Apprentice
- Posts: 7
- Joined: Thu Sep 13, 2007 12:57 am
- Location: New York, USA
- Contact:
Re: Organization of Component in a Repository
julienV,
Symlinks are a brilliant idea. That's the best thing I've heard so far. However, I am confused about something else. You guys keep referring to these "site" and "admin" folders. What is that? I have a bunch of .zip files here of components that I use, and I can't find any of them to be organized like that. I've looked at Docman, Community Builder, sh404SEF, and DS-Syndicate. They all seem to be organized kind of like this:
/
mambots/
images/
whatever/
-- Files
In the root of the zip folder, there is always admin.comfoo.html.php and the front-end comfoo.html.php files together. I've never seen a component's .zip file broken up properly into a site/admin folder structure. Why is this? What sense does it make to create .zip files that don't match the actual structure of the component once unzipped? I realize the .xml file is what takes care of describing which files go where, but doesn't this entire thing make version control all that more difficult??
Thanks for the help so far!
Symlinks are a brilliant idea. That's the best thing I've heard so far. However, I am confused about something else. You guys keep referring to these "site" and "admin" folders. What is that? I have a bunch of .zip files here of components that I use, and I can't find any of them to be organized like that. I've looked at Docman, Community Builder, sh404SEF, and DS-Syndicate. They all seem to be organized kind of like this:
/
mambots/
images/
whatever/
-- Files
In the root of the zip folder, there is always admin.comfoo.html.php and the front-end comfoo.html.php files together. I've never seen a component's .zip file broken up properly into a site/admin folder structure. Why is this? What sense does it make to create .zip files that don't match the actual structure of the component once unzipped? I realize the .xml file is what takes care of describing which files go where, but doesn't this entire thing make version control all that more difficult??
Thanks for the help so far!
Last edited by vcardillo on Mon Feb 11, 2008 5:20 pm, edited 1 time in total.
- Vince Cardillo
Re: Organization of Component in a Repository
I used "admin" and "site" terms in my posts as shortcut for /administrator/components/com_mycomponent and /components/com_mycomponent....
Now, the way you organize the zip can be different of the way you organized your repository. For example, for joomleague the repository matches the joomla folder structure, but to create the install zip, we just pack all the files from the 2 folders in the same, and zip.
Now, with joomla 1.5, you have a new possibility, which is to specify base path for the source files. That way, instead of having to merge admin and site part in order to build your zip, you can keep them in separated folder, which is cleaner.
EDIT: well, in fact the folder parameter was already working with 1.0.X![Wink ;)](./images/smilies/icon_wink.gif)
Now, the way you organize the zip can be different of the way you organized your repository. For example, for joomleague the repository matches the joomla folder structure, but to create the install zip, we just pack all the files from the 2 folders in the same, and zip.
Now, with joomla 1.5, you have a new possibility, which is to specify base path for the source files. That way, instead of having to merge admin and site part in order to build your zip, you can keep them in separated folder, which is cleaner.
EDIT: well, in fact the folder parameter was already working with 1.0.X
![Wink ;)](./images/smilies/icon_wink.gif)