Git Package Management: Beta release

Git Package Management: Beta release

Finally! GPM is already on GitHub with transport package. Read more to get info what's new and how to use it.

What's new

Removed cloning from git

After a lots of troubles with using git from the package on Windows, I have decided to remove option to directly clone git repository. What this means for you is, that you have to clone repository by your self (don't think that this will be a big deal for anyone). In future, I will maybe bring back this functionality and let you turn it on/off by system settings.

Added support for basic Template Variables

You can specify in config new type of element, yes, the new element is Template Variable. You can set only few basic options, but in future, number of options will grow.

Added update package

Maybe the biggest change is that you are now able to update package. There are two ways how to update it. First is without DB, it means that DB remain unchanged and everything else will synchronize based on your updated config file. The second way is updating with DB, this will do the same, but also include DB tables (it recreates them, so all your data will be lost!). Currently you have to increase your package version in config to be able to update it, I am considering removing this version check, to make the update process faster and let you change version, when you want.

GitHub

GPM is now on GitHub. Also there are some wiki pages, where you can find tutorial how to install GPM (nothing different, just download, install and set some system settings, dont worry) and how to create config file for your packages.

Please fill issues with any bugs you find, or features that you want to see included. And for all that want to help with development, feel free to fork repository and send pull requests.

Setting up development environment

Lets have http://localhost pointing to your /www folder. We will create new folder /www/modx and in this folder we will copy all MODX files. After this, you can run setup on http://localhost/modx/setup and install new instance of MODX.

Now download and install the latest version of GPM to your newly installed MODX. I usually have all packages (that I want to install with GPM) in /www folder, but you can place it whenever you want, for example to /www/packages folder.

Just make sure, when your packages root folder is not accessible from http://localhost/ you have to set the Packages base URL system setting (for example, when your packages are in /www/packages and this folder can be accessed from http://localhost/packages set this setting to /packages).

Now you will need to set some system settings, set session_cookie_path to / and session_name to something you like (for example modxlocaldev), to name your session. This will ensure that all in http://localhost will share session with MODX.

I usually turn off settings compress_css and compress_js and all caching, but this is optional.

Clear cache!

Now you are ready to go, so lets clone some repository that already has a config file, for example ChromePHP or UrlShortener. Clone it into /www/chromephp or /www/urlshortener folder (if /www is your packages root folder). After this will come the hardest, open MODX manager, go to components/Git Package Management hit Add package button, type folder's name (chromephp or urlshortener), hit save button.

Wait untill end of installation process, clear cache and that's all.

You can try install articles as well, just follow this.

MODX cloud? Why not

If you want to push your package to MODX cloud to let others to see changes, you could!

Install GPM on your cloud, create packages folder in MODX root, set Packages base URL system setting to /packages/ and Packages directory to /path/to/www/packages/ (for example on my cloud it is /paas/c1776/www/packages/, you can find the start of the path in core.config.php file).

Upload package and install it same way as on localhost.

Last words

Please note that not all components will work after installing, because they are not developed to be run outside MODX root folder.

You can create config file to whatever package you want. Clone package, create config.json in _build folder and fill it with lines from the tutorial how to create config.

Post By John Peca MODX