Skip to content

Instantly share code, notes, and snippets.

@grayside
Created August 22, 2014 21:41
Show Gist options
  • Save grayside/9d4cc1e4ed84b5a478f4 to your computer and use it in GitHub Desktop.
Save grayside/9d4cc1e4ed84b5a478f4 to your computer and use it in GitHub Desktop.
Expose all shellscripts in a bin/ directory suffixed .sh as grunt tasks
module.exports = function(grunt) {
/**
* Define "bin" wrapper tasks.
*/
var files = grunt.file.expand("bin/*.sh");
if (files) {
for (var f in files) {
var name = files[f].split('/').pop().split('.').shift();
grunt.config(['shell', name], {
command: 'bash ' + files[f]
});
grunt.registerTask(name, ['shell:' + name]);
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment