fixed makepot task

- added proper grunt module (grunt-cli)
- updated translations extract code to remove warnings when no translations are found
This commit is contained in:
Jonathan Labreuille
2016-03-17 15:08:38 +01:00
parent a099174226
commit 97dd0abea2
4 changed files with 2758 additions and 155 deletions

View File

@ -89,14 +89,14 @@ class RoboFile extends \Robo\Tasks {
} }
function makepot() { function makepot() {
$this->_exec('grunt makepot'. $this->_exec('./node_modules/.bin/grunt makepot'.
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'. ' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
' --base_path '.__DIR__ ' --base_path '.__DIR__
); );
} }
function pushpot() { function pushpot() {
$this->_exec('grunt pushpot'. $this->_exec('./node_modules/.bin/grunt pushpot'.
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'. ' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
' --base_path '.__DIR__ ' --base_path '.__DIR__
); );
@ -123,7 +123,7 @@ class RoboFile extends \Robo\Tasks {
$this->compileJs(); $this->compileJs();
$this->_exec(join(' ', array( $this->_exec(join(' ', array(
'./node_modules/mocha/bin/mocha', './node_modules/.bin/mocha',
'-r tests/javascript/mochaTestHelper.js', '-r tests/javascript/mochaTestHelper.js',
'tests/javascript/testBundles/**/*.js' 'tests/javascript/testBundles/**/*.js'
))); )));

File diff suppressed because it is too large Load Diff

View File

@ -45,7 +45,7 @@
"amd-inject-loader": "latest", "amd-inject-loader": "latest",
"chai": "2.2.0", "chai": "2.2.0",
"chai-jq": "0.0.8", "chai-jq": "0.0.8",
"grunt": "^0.4.5", "grunt-cli": "latest",
"jquery": "2.1.4", "jquery": "2.1.4",
"jsdom": "3.1.2", "jsdom": "3.1.2",
"mocha": "2.2.1", "mocha": "2.2.1",

View File

@ -178,9 +178,10 @@ class StringExtractor {
* - line - line number * - line - line number
*/ */
public function find_function_calls( $function_names, $code, $extension = '.php') { public function find_function_calls( $function_names, $code, $extension = '.php') {
$function_calls = array();
if($extension === 'php') { if($extension === 'php') {
$tokens = token_get_all( $code ); $tokens = token_get_all( $code );
$function_calls = array();
$latest_comment = false; $latest_comment = false;
$in_func = false; $in_func = false;
foreach( $tokens as $token ) { foreach( $tokens as $token ) {