sudar / wp-plugin-in-github

Collection of shell scripts that I am using to manage and deploy WordPress Plugins from github into svn
http://sudarmuthu.com/blog/developing-wordpress-plugins-in-github
76 stars 20 forks source link

On deploy POT will always change and be commited. #12

Open wedi opened 11 years ago

wedi commented 11 years ago

The check in deploy-plugin.sh#L150 is nice but will always evaluate to true as makepot.php will change a timestamp in the POT file on every call.

Some RegEx magic is needed again to revert the file if nothing except the timestamp POT-Creation-Date: 2013-10-18 21:42:46+00:00\n" has changed.

I posted an issue and asked for a change of that behaviour at my preferred WP i18n tools variant: grappler/i18n#4 as this issue should eventually be mitigated at the source.

sudar commented 11 years ago

Agreed. Let me see if I am able to come up with that magic RegEx :)

grappler commented 11 years ago

It would be great if you could contribute to i18n.

gMagicScott commented 10 years ago

I have used this shell script as a pre-commit git hook. In it's current form, it needs customized to your directory structure, but won't commit the regenerated pot file if nothing changed.

#!/usr/bin/env bash

php wp-i18n-tools/makepot.php wp-plugin plugin-name plugin-folder/languages/plugin-name.pot

if  git diff-files --shortstat plugin-folder/languages/plugin-name.pot | grep "1 insertion(+), 1 deletion(-)" &> /dev/null ; then
        git checkout HEAD -- plugin-folder/languages/plugin-name.pot
    exit 0
else
    git add plugin-folder/languages/plugin-name.pot
fi
sudar commented 10 years ago

@gMagicScott Thanks for sharing this snippet. I will try to merge with deploy-plugin.sh