Grunt自定义任务,用于在运行shell命令和处理JavaScript之间切换

时间:2014-12-19 20:31:45

标签: javascript gruntjs grunt-shell

我发现了这个问题Grunt Shell output to other task,但我想做的事情有点复杂。

我想要一个在循环中使用grunt-shell命令的自定义任务。在每次循环迭代中,我还需要运行grunt函数来操作文件。伪代码就像

accept starting and ending git SHAs

loop over them:
check out the next revision (grunt-shell command)
loop over the files from the grunt task's src config (this.filesSrc) and count instances of a particular string (regex), adding the count for each file to a running total

after we've gathered the data from all commits from start to finish, output the results as JSON (grunt.log or write to a file)

我已经能够使用自定义grunt任务进行文件处理,并且使用grunt-shell发出shell命令很容易,只需通过config即可完成一次性独立任务。我想做的是知道如何在grunt自定义任务中偶尔发出命令。这个git repo取证是当前的例子,但我确定还有其他用例。

0 个答案:

没有答案