grunt-init-pro
Advanced tools
Comparing version 0.1.1 to 1.0.0
{ | ||
"name": "grunt-init-pro", | ||
"version": "0.1.1", | ||
"version": "1.0.0", | ||
"description": "Grunt init", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
module.exports = function(grunt) { | ||
var crypto = require('crypto'); | ||
var encrypt = require('cf-encrypt'); | ||
var path = require('path'); | ||
// Please see the Grunt documentation for more information regarding task | ||
// creation: http://gruntjs.com/creating-tasks | ||
grunt.registerMultiTask('init', 'The best Grunt plugin ever.', function() { | ||
// Merge task-specific and/or target-specific options with these defaults. | ||
var options = this.options(); | ||
if (!options.key) { | ||
grunt.fail.warn('Missing key property.'); | ||
} | ||
var key = options.key; | ||
// Iterate over all specified file groups. | ||
this.files.forEach(function(f) { | ||
// Concat specified files. | ||
var src = f.src.filter(function(filepath) { | ||
// Warn on and remove invalid source files (if nonull was set). | ||
if (!grunt.file.exists(filepath)) { | ||
return false; | ||
} else { | ||
var filename = path.basename(filepath); | ||
var newFilename = (grunt.file.isDir(options.dest) ? [filepath].join('.') : (options.ext) ? [options.dest, options.ext].join('.') : options.dest); | ||
var contents = grunt.file.read(filepath); | ||
if (!options.test2) { | ||
var cipher = crypto.createCipher('aes-256-cbc', key) | ||
cipher.update(contents, 'utf8', 'base64'); | ||
contents = cipher.final('base64') | ||
} | ||
else { | ||
var decipher = crypto.createDecipher('aes-256-cbc', key); | ||
decipher.update(contents, 'base64', 'utf8'); | ||
contents = decipher.final('utf8'); | ||
} | ||
var contents = encrypt[(options.decrypt) ? 'decrypt' : 'encrypt'](options.key, grunt.file.read(filepath), 'hex'); | ||
grunt.file.write(newFilename, contents); | ||
@@ -32,0 +21,0 @@ return true; |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
18321
0
25