From 3675737ffaf649576519f2948051825402764d37 Mon Sep 17 00:00:00 2001 From: Bartvds Date: Mon, 29 Apr 2013 20:12:18 +0200 Subject: [PATCH] readme expanded, enchanced tests --- Gruntfile.js | 3 +++ README.md | 24 ++++++++++++------- .../{extra.js => extra.tagged.js} | 0 test/grunt-wrap_test.js | 6 ++--- 4 files changed, 22 insertions(+), 11 deletions(-) rename test/expected/wrapfunction/{extra.js => extra.tagged.js} (100%) diff --git a/Gruntfile.js b/Gruntfile.js index 6430ac9..6b0aa35 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -44,6 +44,9 @@ module.exports = function (grunt) { src: ['extra.js'], dest: 'test/tmp/wrapfunction', expand: true, + rename: function(dest, src) { + return path.join(dest, src.replace(/(\.[\w]+)$/g, '.tagged$1')); + }, options: { seperator:'\n', testValue: 'yo!', diff --git a/README.md b/README.md index 927ec8f..0155f81 100644 --- a/README.md +++ b/README.md @@ -21,16 +21,24 @@ grunt.initConfig({ // wrap my modules with define wrap: { - modules: { + basic: { src: ['assets/*.js'], dest: 'dist/', wrapper: ['define(function (require, exports, module) {\n', '\n});'] - // wrapper can also be a function, like so: - // - // wrapper: function(filepath, options) { - // // ... - // return ['define(function (require, exports, module) {\n', '\n});']; - // } + }, + advanced: { + cwd: 'files/' + expand: true, + src: ['**/*.js', '**/*.css'], + dest: 'dist/', + seperator: '\n', + indent: '\t', + wrapper: function(filepath, options) { + return ['// ' + filepath, '']; + }, + rename: function(dest, src) { + return path.join(dest, src.replace(/(\.[\w]+)$/g, '.tagged$1')); + } } }, @@ -46,7 +54,7 @@ In lieu of a formal styleguide, take care to maintain the existing coding style. for any new or changed functionality. Lint and test your code using [grunt][grunt]. ## Release History -* 2013 Arp 30 - v0.3.0 - Rewrite with improved grunt file/option convention support, added unit test (Bartvds), grunt version bump to 0.4.1 +* 2013 Apr 30 - v0.3.0 - Rewrite with grunt file/option convention, unit test (Bartvds), grunt version to 0.4.1 * 2013 Jan 31 - v0.2.0 - Implements grunt 0.4 compatibility measures, breaking support for grunt 0.3.x * 2012 Oct 4 - v0.1.0 - Initial release. diff --git a/test/expected/wrapfunction/extra.js b/test/expected/wrapfunction/extra.tagged.js similarity index 100% rename from test/expected/wrapfunction/extra.js rename to test/expected/wrapfunction/extra.tagged.js diff --git a/test/grunt-wrap_test.js b/test/grunt-wrap_test.js index c5f56fd..b7a128a 100644 --- a/test/grunt-wrap_test.js +++ b/test/grunt-wrap_test.js @@ -48,10 +48,10 @@ exports.gruntwrap = { var expected, actual; - test.ok(grunt.file.exists('test/tmp/wrapfunction/extra.js'), 'should respect extra.js'); + test.ok(grunt.file.exists('test/tmp/wrapfunction/extra.tagged.js'), 'should output extra.tagged.js'); - expected= grunt.file.read('test/expected/wrapfunction/extra.js'); - actual = grunt.file.read('test/tmp/wrapfunction/extra.js'); + expected= grunt.file.read('test/expected/wrapfunction/extra.tagged.js'); + actual = grunt.file.read('test/tmp/wrapfunction/extra.tagged.js'); test.equal(expected, actual, 'should wrap extra.js using function correctly'); test.done();