diff --git a/Gruntfile.js b/Gruntfile.js index 8d66413..5a707ff 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -12,7 +12,7 @@ module.exports = function(grunt) { }, trimtrailingspaces: { main: { - src: ['/tmp/test/*'], + src: ['<%= cwd %>/**/*'], options: { filter: 'isFile', encoding: 'utf8', @@ -25,6 +25,10 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-trimtrailingspaces'); grunt.loadNpmTasks('grunt-contrib-watch'); + var cwd = grunt.option('cwd'); grunt.registerTask('default', []); - grunt.registerTask('fixwhitespace', ['trimtrailingspaces']); + grunt.registerTask('fixwhitespace', function() { + grunt.config.set('cwd', cwd); + grunt.task.run('trimtrailingspaces'); + }); }; diff --git a/README.md b/README.md index e6ab934..791b3cb 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,14 @@ # Global Runners +## Setup + +Add an alias to your rc file + +```alias rt="grunt --gruntfile ~/grunt-test/Gruntfile.js -cwd=`pwd`"``` + ## Usage -grunt --gruntfile ~/grunt-test/Gruntfile.js TASK - -alias rt="grunt --gruntfile ~/grunt-test/Gruntfile.js TASK" +```rt TASK_NAME``` ## Tasks