forked from jquery-validation/jquery-validation
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d9fa30
commit 9a4d711
Showing
2 changed files
with
91 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,95 +1,100 @@ | |||
/*global config:true, task:true*/ | /*global config:true, task:true*/ | ||
config.init({ | module.exports = function(grunt) { | ||
pkg: '<json:package.json>', |
|
||
meta: { | grunt.initConfig({ | ||
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + | pkg: '<json:package.json>', | ||
'<%= template.today("m/d/yyyy") %>\n' + | meta: { | ||
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + | banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + | ||
'* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' + | '<%= grunt.template.today("m/d/yyyy") %>\n' + | ||
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' | '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + | ||
}, | '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + | ||
concat: { | ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' | ||
'dist/jquery.validate.js': ['<banner>', '<file_strip_banner:jquery.validate.js>'], | }, | ||
'dist/additional-methods.js': ['<banner>', '<file_strip_banner:additional-methods.js>'] | concat: { | ||
}, | 'dist/jquery.validate.js': ['<banner>', '<file_strip_banner:jquery.validate.js>'], | ||
min: { | 'dist/additional-methods.js': ['<banner>', '<file_strip_banner:additional-methods.js>'] | ||
'dist/jquery.validate.min.js': ['<banner>', 'dist/jquery.validate.js'], | }, | ||
'dist/additional-methods.min.js': ['<banner>', 'dist/additional-methods.js'] | min: { | ||
}, | 'dist/jquery.validate.min.js': ['<banner>', 'dist/jquery.validate.js'], | ||
zip: { | 'dist/additional-methods.min.js': ['<banner>', 'dist/additional-methods.js'] | ||
dist: { | }, | ||
src: [ | zip: { | ||
'dist/additional-methods.js', | dist: { | ||
'dist/additional-methods.min.js', | src: [ | ||
'dist/jquery.validate.js', | 'dist/additional-methods.js', | ||
'dist/jquery.validate.min.js', | 'dist/additional-methods.min.js', | ||
'README.md', | 'dist/jquery.validate.js', | ||
'changelog.txt', | 'dist/jquery.validate.min.js', | ||
'grunt.js', | 'README.md', | ||
'package.json', | 'changelog.txt', | ||
'demo/**/*', | 'grunt.js', | ||
'lib/**/*', | 'package.json', | ||
'localization/**/*', | 'demo/**/*.*', | ||
'test/**/*' | 'lib/**/*.*', | ||
], | 'localization/**/*.*', | ||
dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.zip' | 'test/**/*.*' | ||
} | ], | ||
}, | dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.zip' | ||
qunit: { | } | ||
files: ['test/index.html'] | }, | ||
}, | qunit: { | ||
lint: { | files: ['test/index.html'] | ||
files: ['jquery.validate.js'] | }, | ||
}, | lint: { | ||
jshint: { | files: ['jquery.validate.js'] | ||
options: { | }, | ||
curly: true, | jshint: { | ||
eqeqeq: true, | options: { | ||
immed: true, | curly: true, | ||
latedef: true, | eqeqeq: true, | ||
newcap: true, | immed: true, | ||
noarg: true, | latedef: true, | ||
sub: true, | newcap: true, | ||
undef: true, | noarg: true, | ||
eqnull: true, | sub: true, | ||
browser: true | undef: true, | ||
}, | eqnull: true, | ||
globals: { | browser: true | ||
jQuery: true, | }, | ||
$: true, | globals: { | ||
console: true | jQuery: true, | ||
} | $: true, | ||
} | console: true | ||
} | |||
} | |||
}); | }); | ||
|
|
||
task.registerBasicTask('zip', 'Create a zip file for release', function(data) { | grunt.registerMultiTask('zip', 'Create a zip file for release', function() { | ||
var files = file.expand(data.src); | var files = grunt.file.expand(this.file.src); | ||
log.writeln("Creating zip file " + data.dest); | // grunt.log.writeln(require('util').inspect(files)); | ||
grunt.log.writeln("Creating zip file " + this.file.dest); | |||
|
|
||
var done = this.async(); | var done = this.async(); | ||
|
|
||
var zipstream = require('zipstream'); | var zipstream = require('zipstream'); | ||
var fs = require('fs'); | var fs = require('fs'); | ||
|
|
||
var out = fs.createWriteStream(data.dest); | var out = fs.createWriteStream(this.file.dest); | ||
var zip = zipstream.createZip({ level: 1 }); | var zip = zipstream.createZip({ level: 1 }); | ||
|
|
||
zip.pipe(out); | zip.pipe(out); | ||
|
|
||
function addFile() { | function addFile() { | ||
if (!files.length) { | if (!files.length) { | ||
zip.finalize(function(written) { | zip.finalize(function(written) { | ||
log.writeln(written + ' total bytes written'); | grunt.log.writeln(written + ' total bytes written'); | ||
done(); | done(); | ||
}); | }); | ||
return; | return; | ||
} | } | ||
var file = files.shift(); | var file = files.shift(); | ||
log.verbose.writeln('Zipping ' + file); | grunt.log.verbose.writeln('Zipping ' + file); | ||
zip.addFile(fs.createReadStream(file), { name: file }, addFile); | zip.addFile(fs.createReadStream(file), { name: file }, addFile); | ||
} | } | ||
addFile(); | addFile(); | ||
}); | }); | ||
|
|
||
task.registerTask('default', 'lint qunit'); | grunt.registerTask('default', 'lint qunit'); | ||
task.registerTask('release', 'default concat min zip'); | grunt.registerTask('release', 'default concat min zip'); | ||
|
|||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters