Wednesday, April 17, 2013

GIT - Use global hooks / templates

There is an opportunity to use global hooks. So how you set up it? The configuration option init.templatedir will help us in that.

At first you can check exist value:
git config --global --get-all init.templatedir

If there is exist some you can check it. But if it's empty you can set up it by your path:
git config --global init.templatedir 'c:\Program Files (x86)\Git\share\git-core\templates\'
You may have another path from non-Windows system and in this way this link might help you.
It remains only put you hooks files into hooks directory:
c:\Program Files (x86)\Git\share\git-core\templates\hooks
and run command:
git init
Don't forget you have set up only templates. This templates don't used directly. By the last one command templates will copied to your .git directory. Also exist files cannot be overwritten.  So when you've created new project for copy hooks you have to run git init.

That's all.

Monday, April 8, 2013

PHPStorm - Supporting Factory methods in Magento

I'm pleased to present a new feature in new PhpStorm 6.0.1 EAP build 129.177/196 which supports generic Factory Method pattern.

How to use

So, all is ok but how to generate file .phpstorm.meta.php? We have good tool n98-magerun which can generate our needed file for Magento in the environment of PHPStorm.
So all we need that this command with expected result:

# php n98-magerun.phar dev:ide:phpstorm:meta
Generating definitions for blocks group
Generating definitions for helpers group
Generating definitions for models group
Generating definitions for resource helpers group
Generating definitions for resource models group
File .phpstorm.meta.php generated


That's all. Your IDE is supporting Magento Factory methods now. Also, in theory, this feature works for other libraries.