grunt-upx
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "grunt-upx", | ||
"description": "By using upx.exe this plugin is able to compress executables files up to 85% of their original size.", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"homepage": "https://github.com/pirumpi/grunt-upx", | ||
@@ -42,2 +42,2 @@ "author": { | ||
] | ||
} | ||
} |
/* | ||
* grunt-upx | ||
* https://github.com/pirumpi/grunt-upx | ||
* | ||
* Copyright (c) 2015 Carlos Martin | ||
* Licensed under the MIT license. | ||
*/ | ||
* grunt-upx | ||
* https://github.com/pirumpi/grunt-upx | ||
* | ||
* Copyright (c) 2015 Carlos Martin | ||
* Licensed under the MIT license. | ||
*/ | ||
@@ -14,3 +14,3 @@ 'use strict'; | ||
var path = require('path'); | ||
var upx = path.resolve('tasks', 'bin', 'upx.exe'); | ||
var upx = path.resolve('node_modules','grunt-upx','tasks', 'bin', 'upx.exe'); | ||
@@ -55,2 +55,22 @@ module.exports = function(grunt) { | ||
grunt.event.once('filesCreated', function(){ | ||
compressFiles(done, options, grunt); | ||
}); | ||
grunt.event.once('folderChecked',function(){ | ||
grunt.log.writeln('Checking files'); | ||
data.files.src.forEach(function(f){ | ||
if(destFolder !== null){ | ||
var movedFile = path.resolve(destFolder, path.basename(f)); | ||
fs.writeFileSync(movedFile, fs.readFileSync(f)); | ||
fileList.push(movedFile); | ||
}else{ | ||
fileList.push(f); | ||
} | ||
grunt.log.writeln('file copied'); | ||
}); | ||
grunt.event.emit('filesCreated'); | ||
}); | ||
if(destFolder !== null){ | ||
@@ -62,2 +82,4 @@ fs.exists(destFolder, function(exist){ | ||
grunt.event.emit('folderChecked'); | ||
}else{ | ||
error(err, grunt, done); | ||
} | ||
@@ -72,28 +94,8 @@ grunt.log.writeln('folder created'); | ||
}else{ | ||
grunt.log.writeln('no destination folder found'); | ||
grunt.event.emit('folderChecked'); | ||
grunt.log.writeln('no destination folder found'); | ||
} | ||
grunt.event.once('folderChecked',function(){ | ||
data.files.src.forEach(function(f){ | ||
if(destFolder !== null){ | ||
var movedFile = path.resolve(destFolder, path.basename(f)); | ||
fs.writeFileSync(movedFile, fs.readFileSync(f)); | ||
fileList.push(movedFile); | ||
}else{ | ||
fileList.push(f); | ||
} | ||
grunt.log.writeln('file copied'); | ||
}); | ||
grunt.event.emit('filesCreated'); | ||
}); | ||
grunt.event.once('filesCreated', function(){ | ||
compressFiles(done, options, grunt); | ||
}); | ||
}); | ||
}; |
495216
179