When developing Magento modules, it is quite tedious to create packages for Magento Connect. That is why there are often modules that are not present in this one but available elsewhere, eg on GitHub. I will present here a very fast way to install Magento modules available on Git repositories through
modgit (for Module Git) is neither more nor less than a shell script to clone a Git repository and deploy the code in your project. Directly inspired by the great modman,
modgit has the advantage of including or excluding a portion of the repository and not to create symlinks but physically copy the files into your project.
modgit is available on GitHub: https://github.com/jreinke/modgit. Once downloaded:
$ cp /path/to/modgit /usr/local/bin # (or any folder in your $PATH) $ cd /usr/local/bin $ chmod +x modgit
Install a Magento module with modgit
For our example, we will install the excellent PHPUnit Magento module developed by Ivan Chepurnyi and available on GitHub: https://github.com/IvanChepurnyi/EcomDev_PHPUnit.
Here is the procedure:
$ cd /path/to/magento $ modgit init $ modgit clone ecomdev-phpunit https://github.com/IvanChepurnyi/EcomDev_PHPUnit.git
And that’s it! The code is deployed on your Magento tree like this:
Now, you just have to clean Magento cache.
Note: we can see that files were deployed to the root of the tree and which are not required to operate the module. We’ll see how a little further exclude them during installation.
Update installed modules
modgit, you can update a specific module or all modules at once.
Update a specific module:
$ modgit update <module>
Update all installed modules:
$ modgit update-all
List all installed modules
$ modgit list
Remove a module
$ modgit remove <module>
modgit is able to include or exclude files and folders of your choice. Taking the example above, all files of EcomDev_PHPUnit repository have been copied into Magento tree and we end up with unwanted files in root folder. To exclude LICENSE.txt, README.md and modman files, simply exclude them as below when installing:
$ modgit -e LICENSE.txt -e README.md -e modman clone ecomdev-phpunit https://github.com/IvanChepurnyi/EcomDev_PHPUnit.git
To include only a portion of the repository, the operation is the same, just specify the list of files and folders you want to copy using the
modgit gives you the ability to install, update and remove quickly any Magento module available on a Git repository. It is therefore very useful if you want to quickly test a module, if a module is not available on Magento Connect or if you’re just a little allergic to it .