Skip to content

Commit

Permalink
Use lodash directly. Fixes GH-177.
Browse files Browse the repository at this point in the history
  • Loading branch information
shama committed Apr 1, 2016
1 parent ff37330 commit 2edf867
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"dependencies": {
"archiver": "^0.21.0",
"chalk": "^1.1.1",
"lodash": "^4.7.0",
"pretty-bytes": "^3.0.1",
"stream-buffers": "^2.1.0"
},
Expand Down
3 changes: 2 additions & 1 deletion tasks/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
'use strict';

module.exports = function(grunt) {
var _ = require('lodash');
var compress = require('./lib/compress')(grunt);

grunt.registerMultiTask('compress', 'Compress files.', function() {
Expand All @@ -24,7 +25,7 @@ module.exports = function(grunt) {

compress.options.mode = compress.options.mode || compress.autoDetectMode(compress.options.archive);

if (grunt.util._.include(['zip', 'tar', 'tgz', 'gzip', 'deflate', 'deflateRaw'], compress.options.mode) === false) {
if (_.includes(['zip', 'tar', 'tgz', 'gzip', 'deflate', 'deflateRaw'], compress.options.mode) === false) {
grunt.fail.warn('Mode ' + String(compress.options.mode).cyan + ' not supported.');
}

Expand Down
3 changes: 2 additions & 1 deletion tasks/lib/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var chalk = require('chalk');
var zlib = require('zlib');
var archiver = require('archiver');
var streamBuffers = require('stream-buffers');
var _ = require('lodash');

module.exports = function(grunt) {

Expand Down Expand Up @@ -239,7 +240,7 @@ module.exports = function(grunt) {
if (!dest) {
return 'gzip';
}
if (grunt.util._.endsWith(dest, '.tar.gz')) {
if (_.endsWith(dest, '.tar.gz')) {
return 'tgz';
}
var ext = path.extname(dest).replace('.', '');
Expand Down

1 comment on commit 2edf867

@amitesh786
Copy link

@amitesh786 amitesh786 commented on 2edf867 Feb 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Warning: _ is not defined Use --force to continue.
Aborted due to warnings."
I have verify all the code...."Line 18" we have defined "var _" but still warning is present... ;(

Please sign in to comment.