forked from mdp/gibberish-aes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
87 lines (74 loc) · 2.68 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*global module:false*/
module.exports = function(grunt) {
"use strict";
var pkg, config;
pkg = grunt.file.readJSON('package.json');
config = {
banner : [
'/**',
' * <%= pkg.name %> v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>',
' * <%= pkg.description %>',
' *',
' * Author: <%= pkg.author %>',
' * Copyright: Mark Percival - http://mpercival.com 2008',
' *',
' * With thanks to:',
' * Josh Davis - http://www.josh-davis.org/ecmaScrypt',
' * Chris Veness - http://www.movable-type.co.uk/scripts/aes.html',
' * Michel I. Gallant - http://www.jensign.com/',
' * Jean-Luc Cooke <[email protected]> 2012-07-12: added strhex + invertArr to compress G2X/G3X/G9X/GBX/GEX/SBox/SBoxInv/Rcon saving over 7KB, and added encString, decString, also made the MD5 routine more easlier compressible using yuicompressor.',
' *',
' * License: <%= pkg.license %>',
' *',
' * Usage: GibberishAES.enc("secret", "password")',
' * Outputs: AES Encrypted text encoded in Base64',
' */\n'
].join('\n'),
pkg : pkg,
uglifyFiles: {},
src : 'src/gibberish-aes.js'
};
// setup dynamic filenames
config.versioned = [config.pkg.name, config.pkg.version].join('-').toLowerCase();
config.dist = ['dist/', '.js'].join(config.versioned);
config.uglifyFiles[['dist/', '.min.js'].join(config.versioned)] = config.dist;
// Project configuration.
grunt.initConfig({
pkg : config.pkg,
clean : {
dist : ['dist/']
},
copy: {
dist: {
files: [{
src: config.src,
dest: config.dist
}]
}
},
uglify : {
options : {
mangle : true,
banner: config.banner
},
dist : {
files : config.uglifyFiles
}
},
jshint : {
options : {
jshintrc : 'jshint.json'
},
source : 'src/*.js'
},
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
// might be nice to add automatic testing eventually
// grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.registerTask('build', ['clean', 'jshint', 'copy', 'uglify']);
// Default task.
grunt.registerTask('default', ['build']);
};