grunt-contrib-compress
Advanced tools
Comparing version 0.2.2 to 0.3.0
{ | ||
"name": "grunt-contrib-compress", | ||
"description": "Compress files and folders.", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"homepage": "https://github.com/gruntjs/grunt-contrib-compress", | ||
@@ -35,7 +35,7 @@ "author": { | ||
"rimraf": "~2.0.2", | ||
"grunt-contrib-lib": "~0.2.0" | ||
"grunt-contrib-lib": "~0.3.0" | ||
}, | ||
"devDependencies": { | ||
"grunt": "~0.3.15", | ||
"grunt-contrib-clean": "~0.2.0" | ||
"grunt-contrib-clean": "~0.3.0" | ||
}, | ||
@@ -45,2 +45,2 @@ "keywords": [ | ||
] | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# grunt-contrib-compress | ||
# grunt-contrib-compress [![Build Status](https://secure.travis-ci.org/gruntjs/grunt-contrib-compress.png?branch=master)](http://travis-ci.org/gruntjs/grunt-contrib-compress) | ||
> Compress files and folders (part of the [grunt-contrib](https://github.com/gruntjs/grunt-contrib) collection). Submitted by [Chris Talkington](https://github.com/ctalkington). | ||
@@ -38,3 +38,3 @@ | ||
As of v0.2.2, this is now automatically detected per dest:src pair but can be overridden per target if desired. | ||
As of v0.3.0, this is now automatically detected per dest:src pair but can be overridden per target if desired. | ||
@@ -79,3 +79,4 @@ ##### basePath ```string``` | ||
* 2012/09/24 - v0.3.0 - general cleanup and consolidation. global options depreciated. | ||
* 2012/09/18 - v0.2.2 - test refactoring. no valid source check. automatic mode detection. | ||
* 2012/09/10 - v0.2.0 - refactored from grunt-contrib into individual repo. |
@@ -23,5 +23,2 @@ /* | ||
var _ = grunt.util._; | ||
var async = grunt.util.async; | ||
var kindOf = grunt.util.kindOf; | ||
var helpers = require('grunt-contrib-lib').init(grunt); | ||
@@ -47,10 +44,3 @@ | ||
if (options.basePath && kindOf(options.basePath) === 'string') { | ||
options.basePath = path.normalize(options.basePath); | ||
options.basePath = _(options.basePath).trim(path.sep); | ||
} else { | ||
options.basePath = false; | ||
} | ||
if (options.rootDir && kindOf(options.rootDir) === 'string') { | ||
if (grunt.util.kindOf(options.rootDir) === 'string' && options.rootDir.length >= 1) { | ||
options.rootDir = path.normalize(options.rootDir).split(path.sep)[0]; | ||
@@ -67,3 +57,3 @@ } else { | ||
async.forEachSeries(this.files, function(file, next) { | ||
grunt.util.async.forEachSeries(this.files, function(file, next) { | ||
srcFiles = grunt.file.expandFiles(file.src); | ||
@@ -78,3 +68,3 @@ destDir = path.dirname(file.dest); | ||
if (_.include(supportedModes, mode) === false) { | ||
if (grunt.util._.include(supportedModes, mode) === false) { | ||
grunt.fail.warn('Mode ' + mode.cyan + ' not supported.'); | ||
@@ -110,20 +100,4 @@ } | ||
var findBasePath = function(srcFiles) { | ||
var basePaths = []; | ||
var dirName; | ||
srcFiles.forEach(function(srcFile) { | ||
dirName = path.dirname(srcFile); | ||
dirName = path.normalize(dirName); | ||
basePaths.push(dirName.split(path.sep)); | ||
}); | ||
basePaths = _.intersection.apply([], basePaths); | ||
return path.join.apply(path, basePaths); | ||
}; | ||
var autoDetectMode = function(dest) { | ||
if (_.endsWith(dest, '.tar.gz')) { | ||
if (grunt.util._.endsWith(dest, '.tar.gz')) { | ||
return 'tgz'; | ||
@@ -149,3 +123,3 @@ } | ||
var basePath = options.basePath || findBasePath(srcFiles); | ||
var basePath = helpers.findBasePath(srcFiles, options.basePath); | ||
var rootDir = options.rootDir; | ||
@@ -160,7 +134,7 @@ | ||
relative = ''; | ||
} else if (basePath && basePath.length > 1) { | ||
relative = _(relative).chain().strRight(basePath).trim(path.sep).value(); | ||
} else if (basePath && basePath.length >= 1) { | ||
relative = grunt.util._(relative).strRight(basePath).trim(path.sep); | ||
} | ||
if (rootDir && rootDir.length > 1) { | ||
if (rootDir && rootDir.length >= 1) { | ||
relative = path.join(options.rootDir, relative); | ||
@@ -193,3 +167,3 @@ } | ||
var zipFiles = _.uniq(copyResult[0]); | ||
var zipFiles = grunt.util._.uniq(copyResult[0]); | ||
var zipMeta = copyResult[1]; | ||
@@ -234,7 +208,7 @@ | ||
if (options.rootDir && options.rootDir.length > 1) { | ||
if (options.rootDir && options.rootDir.length >= 1) { | ||
tarDir = options.rootDir; | ||
options.rootDir = false; | ||
} else { | ||
tarDir = _(destFile).strLeftBack(destFileExt); | ||
tarDir = grunt.util._(destFile).strLeftBack(destFileExt); | ||
} | ||
@@ -241,0 +215,0 @@ |
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
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
27
80
53278
372
+ Addedgrunt-contrib-lib@0.3.0(transitive)
- Removedgrunt-contrib-lib@0.2.1(transitive)
Updatedgrunt-contrib-lib@~0.3.0