Last active
May 5, 2016 15:56
-
-
Save alebianco/85500551f92bcc578a3328f013c1833a to your computer and use it in GitHub Desktop.
grunt-run-task issue #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (grunt) { | |
grunt.initConfig({}); | |
grunt.registerTask('test', 'testing grunt-run-task', function() { | |
var runTask = require('grunt-run-task'); | |
runTask.loadNpmTasks("grunt-fileindex"); | |
function createConfig(folder) { | |
return { | |
resources: { | |
options: { | |
format: 'json_flat', | |
pretty: true | |
}, | |
files: [{ | |
src: '**/*.*', | |
dest: folder + '/resources.json' | |
}] | |
} | |
}; | |
} | |
function createTask(config) { | |
console.log("create task"); | |
var task = runTask.task('fileindex', config); | |
return task; | |
} | |
function executeTask(task) { | |
console.log("running task"); | |
task.run("resources", function (error, task) { | |
if (error) { | |
console.error(error); | |
} | |
console.log("task complete"); | |
}); | |
} | |
// expected: should exectute "fileindex:resources" 5 times | |
// actual: tries to execute "fileindex:resources:resources" and doesn't even throw an error | |
var folders = ["one", "two", "three", "four", "five"]; | |
folders.map(createConfig).map(createTask).forEach(executeTask); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment