grunt-i18n-abide
Advanced tools
Comparing version 0.0.16 to 0.0.17
{ | ||
"name": "grunt-i18n-abide", | ||
"description": "Grunt plugin for running jsxgettext against your codebase.", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"homepage": "https://github.com/mozilla/grunt-i18n-abide", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -7,2 +7,4 @@ var fs = require('fs'); | ||
var cmdPaths = [ '../../.bin/jsxgettext', '../node_modules/.bin/jsxgettext' ]; | ||
module.exports = function (grunt) { | ||
@@ -12,2 +14,19 @@ | ||
var cachedPath = null; | ||
var getPath = function(){ | ||
var _path; | ||
if (cachedPath) { | ||
return cachedPath; | ||
} | ||
for (var idx = 0; idx < cmdPaths.length; idx++) { | ||
_path = path.join(__dirname, cmdPaths[idx]); | ||
try { | ||
fs.statSync(_path); | ||
cachedPath = _path; | ||
return _path; | ||
} catch(err) {} | ||
} | ||
grunt.fail.fatal('Cannot find jsxgettext.'); | ||
}; | ||
grunt.registerMultiTask('abideExtract', 'Extracts gettext from js, EJS or Jinja (nunjucks).', function () { | ||
@@ -21,3 +40,3 @@ | ||
var cmd = helpers.getCommand(options.cmd || path.join(__dirname, '../node_modules/.bin/jsxgettext')); | ||
var cmd = helpers.getCommand(options.cmd || getPath() ); | ||
@@ -24,0 +43,0 @@ var args = []; |
Sorry, the diff of this file is not supported yet
43839
980