From c44ede722fef2415455887447c2d317475bbe644 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Thu, 11 Sep 2014 01:20:40 -0400 Subject: [PATCH] Move configs to individual files --- Gruntfile.js | 24 ++---------------------- config/pkg.json | 18 ++++++++++++++++++ config/trimtrailingspaces.json | 12 ++++++++++++ config/watch.json | 11 +++++++++++ package.json | 1 + 5 files changed, 44 insertions(+), 22 deletions(-) create mode 100644 config/pkg.json create mode 100644 config/trimtrailingspaces.json create mode 100644 config/watch.json diff --git a/Gruntfile.js b/Gruntfile.js index 484ddd3..141ac5a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,26 +1,6 @@ module.exports = function(grunt) { - grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - watch: { - scripts: { - files: ['/tmp/test/*'], - tasks: 'fixwhitespace', - options: { - spawn: false, - }, - }, - }, - trimtrailingspaces: { - main: { - src: ['<%= cwd %>/**/*'], - options: { - filter: 'isFile', - encoding: 'utf8', - failIfTrimmed: false - } - } - } - }); + var configs = require('load-grunt-configs')(grunt); + grunt.initConfig(configs); require('load-grunt-tasks')(grunt); diff --git a/config/pkg.json b/config/pkg.json new file mode 100644 index 0000000..d9e9044 --- /dev/null +++ b/config/pkg.json @@ -0,0 +1,18 @@ +{ + "name": "grunt-test", + "version": "0.0.1", + "description": "Grunt test global runners", + "main": "Grunfile.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Andrew Tomaka", + "license": "MIT", + "dependencies": { + "grunt": "^0.4.5", + "grunt-contrib-watch": "^0.6.1", + "grunt-trimtrailingspaces": "^0.4.0", + "load-grunt-configs": "^0.4.0", + "load-grunt-tasks": "^0.6.0" + } +} \ No newline at end of file diff --git a/config/trimtrailingspaces.json b/config/trimtrailingspaces.json new file mode 100644 index 0000000..94be1f6 --- /dev/null +++ b/config/trimtrailingspaces.json @@ -0,0 +1,12 @@ +{ + "main": { + "src": [ + "<%= cwd %>/**/*" + ], + "options": { + "filter": "isFile", + "encoding": "utf8", + "failIfTrimmed": false + } + } +} \ No newline at end of file diff --git a/config/watch.json b/config/watch.json new file mode 100644 index 0000000..ee51c27 --- /dev/null +++ b/config/watch.json @@ -0,0 +1,11 @@ +{ + "scripts": { + "files": [ + "/tmp/test/*" + ], + "tasks": "fixwhitespace", + "options": { + "spawn": false + } + } +} \ No newline at end of file diff --git a/package.json b/package.json index e9d1ef5..cb4ef43 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "grunt": "^0.4.5", "grunt-contrib-watch": "^0.6.1", "grunt-trimtrailingspaces": "^0.4.0", + "load-grunt-configs": "^0.4.0", "load-grunt-tasks": "^0.6.0" } }