Welcome, Guest
Username: Password: Remember me

TOPIC: forking: maintaining your project

forking: maintaining your project 19 May 2015 12:24 #13101

  • Romkabouter
  • Romkabouter's Avatar
  • Offline
  • Elite Member
  • Posts: 287
  • Thank you received: 123
  • Karma: 48

Since some time now I have been using j-cook. There is a lot of cool stuff in there, but the you probably need to fork some part of your component.
Maintaining that can be a struggle, so I wanted to share with you the way I work with forks.
I always want to be able to create an installable package, with all of my forks with it.
That package should be good for upgrading and fresh installs.

For this purpose I have created the following structure:
- I have a mainfolder, which is simple the name of my component
- Three subfolders: fork, generated, rtm (release to market)
- Merge batch file

In the generated folder I unpack the zipfile downloaded form the j-cook builder.
In my fork folder I have two subfolders following the structure of the generated source:
- admin, with a subfolder fork containing all my forked code for the administrator
- site, with a subfolder fork containing all my forked code for the frontend
I also have a subfolder in there called language, within it a admin and a site subfolder, keeping the language files apart.
And then I also have a component.xml in the fork folder, in that I have added the database update schema, according to Joomla standards:

My project folder looks like this
- fork
	    -forks in here
	    -forks in here
- generated => generated structure in here
- rtm => merged code
- merge_create.bat => batch file for mering.

Forking component.xml

The reason I have a component.xml is that I want the install to also install/upgrade the fork folders and be able to update the database
For installing/upgrading, add '<folder>fork</folder>' under both <files folder="admin"> and <files folder="site">
Also, to be able to use the joomla update scheme add
			<schemapath type="mysql">sql/updates/mysql</schemapath> 
just above the last </extension> tag
Do not forget to update the version info if you have a new version ;)

Forking language files

If you want to add some custom language keys, this is the way I work.
I create in rootfolder/fork/languages/admin and/or rootfolder/fork/languages/site a file named en-GB.com_mycomponent.ini
In there I create the extra languagekeys, my merge script does the rest.
It copies the keys from these files into the corresponding generated language files.

Forking layout xml files

As can be read here: www.j-cook.pro/index.php/f/forks, forking XML is not or not entirely possible.
With my information, you can probably figure out a good pratice.
I personally needed to be able to add paramters to a frontend menu item
Therefore I needed to fork the default.xml file, but just putting that in the fork folder does not work.
My merge batch files copies the default.xml to the non-forked code.

Batch script

This is my batch script, it merges the generated and fork folder to rtm and the create a zip file.
The zip file can be installed.
REM remove files in rtm and remove component.zip
rmdir rtm /S /Q
del component.zip
REM Copy generated
xcopy generated rtm /EYQI

REM Copy fork
xcopy fork\admin rtm\admin /EYQI
xcopy fork\site rtm\site /EYQI
xcopy fork rtm /YQ

REM Needed for params
copy fork\site\fork\views\teams\tmpl\default.xml rtm\site\views\teams\tmpl\default.xml

REM Merge language files
type fork\language\admin\en-GB.com_trailrides.ini >> rtm\admin\language\en-GB.com_trailrides.ini
type fork\language\site\en-GB.com_trailrides.ini >> rtm\site\language\en-GB.com_trailrides.ini

cd rtm
zip -r component.zip *
move component.zip ../
cd ../

Hopefully some people here can use this information to make life easier maintaining forked code or maybe some folks have a lot better ideas :D
The administrator has disabled public write access.
The following user(s) said Thank You: admin

forking: maintaining your project 19 May 2015 13:36 #13111

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3698
  • Thank you received: 971
  • Karma: 140
Excelent Topic. (I bookmark it)

My plans for future is to create a repackager. A developper tool to recreate the deployement of your component.
In that moment, I think we could discuss the best way to choose for achieving that.

Thank you for you contribution.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.071 seconds

Get Started