grunt-contrib-concat
Advanced tools
Comparing version 0.1.1 to 0.1.2-rc5
@@ -32,2 +32,3 @@ /* | ||
// Configuration to be run (and then tested). | ||
banner_property: 'AWESOME', | ||
concat: { | ||
@@ -41,4 +42,4 @@ default_options: { | ||
options: { | ||
separator: ': ', | ||
punctuation: ' !!!' | ||
separator: '\n;\n', | ||
banner: '/* THIS TEST IS <%= banner_property %> */\n', | ||
}, | ||
@@ -48,3 +49,8 @@ files: { | ||
} | ||
} | ||
}, | ||
handling_invalid_files: { | ||
src: ['test/fixtures/file1', 'invalid_file/should_warn/but_not_fail', 'test/fixtures/file2'], | ||
dest: 'tmp/handling_invalid_files', | ||
nonull: true, | ||
}, | ||
}, | ||
@@ -51,0 +57,0 @@ |
{ | ||
"name": "grunt-contrib-concat", | ||
"description": "Concatenate files.", | ||
"version": "0.1.1", | ||
"version": "0.1.2rc5", | ||
"homepage": "https://github.com/gruntjs/grunt-contrib-concat", | ||
@@ -25,14 +25,13 @@ "author": { | ||
"engines": { | ||
"node": ">= 0.6.0" | ||
"node": ">= 0.8.0" | ||
}, | ||
"scripts": { | ||
"test": "./node_modules/.bin/grunt test" | ||
"test": "grunt test" | ||
}, | ||
"devDependencies": { | ||
"grunt-contrib-jshint": "~0.1.0", | ||
"grunt-contrib-nodeunit": "~0.1.0", | ||
"grunt-contrib-clean": "0.4.0a", | ||
"grunt-contrib-jshint": "~0.1.1rc5", | ||
"grunt-contrib-nodeunit": "~0.1.2rc5", | ||
"grunt-contrib-clean": "~0.4.0rc5", | ||
"grunt-contrib-internal": "*", | ||
"grunt": "~0.4.0a", | ||
"grunt-cli": "~0.1.1" | ||
"grunt": "~0.4.0rc5" | ||
}, | ||
@@ -39,0 +38,0 @@ "keywords": [ |
@@ -209,2 +209,3 @@ # grunt-contrib-concat [![Build Status](https://secure.travis-ci.org/gruntjs/grunt-contrib-concat.png?branch=master)](http://travis-ci.org/gruntjs/grunt-contrib-concat) | ||
* 2013-01-08 v0.1.2rc5 Updating to work with grunt v0.4.0rc5. Switching back to this.files api. | ||
* 2012-11-12 v0.1.1 Switch to this.file api internally. | ||
@@ -217,2 +218,2 @@ * 2012-10-02 v0.1.0 Work in progress, not yet officially released. | ||
*This file was generated on Wed Nov 28 2012 08:48:05.* | ||
*This file was generated on Wed Jan 09 2013 14:12:18.* |
@@ -32,34 +32,35 @@ /* | ||
// The source files to be concatenated. The "nonull" option is used | ||
// to retain invalid files/patterns so they can be warned about. | ||
var files = grunt.file.expand({nonull: true}, this.file.srcRaw); | ||
// Iterate over all src-dest file pairs. | ||
this.files.forEach(function(f) { | ||
// Concat banner + specified files. | ||
var src = banner + f.src.filter(function(filepath) { | ||
// Warn on and remove invalid source files (if nonull was set). | ||
if (!grunt.file.exists(filepath)) { | ||
grunt.log.warn('Source file "' + filepath + '" not found.'); | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
}).map(function(filepath) { | ||
// Read file source. | ||
var src = grunt.file.read(filepath); | ||
// Process files as templates if requested. | ||
if (options.process) { | ||
src = grunt.template.process(src, options.process); | ||
} | ||
// Strip banners if requested. | ||
if (options.stripBanners) { | ||
src = comment.stripBanner(src, options.stripBanners); | ||
} | ||
return src; | ||
}).join(grunt.util.normalizelf(options.separator)); | ||
// Concat banner + specified files. | ||
var src = banner + files.map(function(filepath) { | ||
// Warn if a source file/pattern was invalid. | ||
if (!grunt.file.exists(filepath)) { | ||
grunt.log.error('Source file "' + filepath + '" not found.'); | ||
return ''; | ||
} | ||
// Read file source. | ||
var src = grunt.file.read(filepath); | ||
// Process files as templates if requested. | ||
if (options.process) { | ||
src = grunt.template.process(src, options.process); | ||
} | ||
// Strip banners if requested. | ||
if (options.stripBanners) { | ||
src = comment.stripBanner(src, options.stripBanners); | ||
} | ||
return src; | ||
}).join(grunt.util.normalizelf(options.separator)); | ||
// Write the destination file. | ||
grunt.file.write(f.dest, src); | ||
// Write the destination file. | ||
grunt.file.write(this.file.dest, src); | ||
// Print a success message. | ||
grunt.log.writeln('File "' + this.file.dest + '" created.'); | ||
// Print a success message. | ||
grunt.log.writeln('File "' + f.dest + '" created.'); | ||
}); | ||
}); | ||
}; |
@@ -21,7 +21,15 @@ 'use strict'; | ||
var expected = grunt.file.read('test/expected/custom_options'); | ||
test.equal(actual, expected, 'should describe what the custom option(s) behavior is.'); | ||
test.equal(actual, expected, 'should utilize custom banner and separator.'); | ||
test.done(); | ||
}, | ||
handling_invalid_files: function(test) { | ||
test.expect(1); | ||
var actual = grunt.file.read('tmp/handling_invalid_files'); | ||
var expected = grunt.file.read('test/expected/handling_invalid_files'); | ||
test.equal(actual, expected, 'will have warned, but should not fail.'); | ||
test.done(); | ||
}, | ||
strip_banner: function(test) { | ||
@@ -28,0 +36,0 @@ test.expect(7); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24123
5
27
208
218
1