cedaro / grunt-wp-i18n

Internationalize WordPress themes and plugins with Grunt.
MIT License
160 stars 25 forks source link

`addtextdomain --dry-run` is not working #54

Closed tamarazuk closed 9 years ago

tamarazuk commented 9 years ago

When I try using dry run with the addtextdomain task I see a bunch of failed to open stream errors and don't see the expected changes:

Warning: file_get_contents(woocommerce-dev-helper): failed to open stream: No such file or directory in /*/node_modules/grunt-wp-i18n/vendor/wp-i18n-tools/add-textdomain.php on line 37

When dry run is used it looks like arguments are shifted and the domain gets passed here instead of the filepath

bradyvercher commented 9 years ago

Thanks for the report @tamarazuk! At some point, I think this prevented the argument from being passed to the PHP script. I'm not sure if something changed or if it really just never worked.

I imagine getting rid of that argument shifting hocus pocus in grunt-add-textdomain.php should fix this up, though.

tamarazuk commented 9 years ago

@bradyvercher Thanks for the quick reply :beers:

The task is always passing the second argument (but it's an empty string when we're doing a dry run) whereas the grunt-add-textdomain.php assumes the command was run in the shell so the argument might not exist. So I agree, removing the shifting hocus pocus and adjusting the indexes should fix it. Alternatively, moving the array_shift() here outside of the if can work too.

bradyvercher commented 9 years ago

Hey @tamarazuk, if you can let me know if that commit fixes your issue, I'll go ahead and push out a new release.

tamarazuk commented 9 years ago

@bradyvercher looks like that fixed it :smile_cat: Thanks!

bradyvercher commented 9 years ago

Just pushed this out in v0.5.3. Thanks again! :beers: