META-INF.resources.bower_components.cldrjs.Gruntfile.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jwebmp-globalize Show documentation
Show all versions of jwebmp-globalize Show documentation
The JWebSwing implementation for a full Globalization
The newest version!
module.exports=function(grunt){"use strict";var isConnectTestRunning,rdefineEnd=/\}\);[^}\w]*$/,pkg=grunt.file.readJSON("package.json");function camelCase(input){return input.toLowerCase().replace(/[_/](.)/g,function(match,group1){return group1.toUpperCase()})}function mountFolder(connect,path){return connect.static(require("path").resolve(path))}function replaceConsts(content){return content.replace(/@VERSION/g,pkg.version).replace(/@DATE/g,(new Date).toISOString().replace(/:\d+\.\d+Z$/,"Z"))}grunt.initConfig({pkg:pkg,connect:{options:{port:9001,hostname:"localhost"},test:{options:{middleware:function(connect){return[mountFolder(connect,"."),mountFolder(connect,"test")]}}}},jshint:{source:{src:["src/**/*.js","!src/build/**"],options:{jshintrc:"src/.jshintrc"}},grunt:{src:["Gruntfile.js"],options:{jshintrc:".jshintrc"}},metafiles:{src:["bower.json","package.json"],options:{jshintrc:".jshintrc"}},test:{src:["test/**/*.js"],options:{jshintrc:"test/.jshintrc"}},dist:{src:["dist/**/*.js"],options:{jshintrc:"src/.dist_jshintrc"}}},dco:{current:{options:{exceptionalAuthors:{"[email protected]":"Rafael Xavier de Souza"}}}},mocha:{unit:{options:{log:true,urls:["http://localhost:<%= connect.options.port %>/unit.html","http://localhost:<%= connect.options.port %>/unit_unresolved.html"]}},functional:{options:{log:true,urls:["http://localhost:<%= connect.options.port %>/functional.html"]}}},requirejs:{options:{dir:"dist/.build",appDir:"src",baseUrl:".",optimize:"none",paths:{EventEmitter:"../bower_components/eventEmitter/EventEmitter"},skipSemiColonInsertion:true,skipModuleInsertion:true,onBuildWrite:function(id,path,contents){var name=id.replace(/util\/|common\//,"");if(/^EventEmitter$/.test(id)){contents=contents.replace(/.*\buse strict\b.*/,"").replace(/(\(function \(\) {)/,"var EventEmitter;\n/* jshint ignore:start */\nEventEmitter = $1").replace(/\/\/ Expose the class either via AMD, CommonJS[\S\s]*}\.call\(this\)\);/,"return EventEmitter;\n}());\n/* jshint ignore:end */");return contents}contents=contents.replace(/define\([^{]*?{/,"").replace(rdefineEnd,"").replace(/define\(\[[^\]]+\]\)[\W\n]+$/,"");if(["item/lookup","util/json/merge"].indexOf(id)!==-1){contents="\tvar "+camelCase(name)+" = (function() {"+contents+"}());"}else if(/\//.test(id)){contents=contents.replace(/ return/,"\tvar "+camelCase(name)+" =")}return contents}},bundle:{options:{modules:[{name:"cldr",include:["core"],create:true,override:{wrap:{startFile:"src/build/intro_core.js",endFile:"src/build/outro.js"}}},{name:"cldr_event",include:["event"],exclude:["core"],create:true,override:{wrap:{startFile:"src/build/intro_event.js",endFile:"src/build/outro.js"}}},{name:"cldr_supplemental",include:["supplemental"],exclude:["core"],create:true,override:{wrap:{startFile:"src/build/intro_supplemental.js",endFile:"src/build/outro.js"}}},{name:"cldr_unresolved",include:["unresolved"],exclude:["core"],create:true,override:{wrap:{startFile:"src/build/intro_unresolved.js",endFile:"src/build/outro.js"}}}]}}},copy:{options:{processContent:function(content){content=content.replace(/define\(".*/,"");return replaceConsts(content)}},dist_cldr:{expand:true,cwd:"dist/.build/",src:["cldr.js"],dest:"dist/"},dist_modules:{expand:true,cwd:"dist/.build/",src:["cldr*.js","!cldr.js"],dest:"dist/cldr",rename:function(dest,src){return require("path").join(dest,src.replace(/cldr_/,""))}},dist_node_main:{src:"src/build/node_main.js",dest:"dist/node_main.js"}},uglify:{options:{banner:replaceConsts(grunt.file.read("src/build/intro.min.js"))},dist:{files:{"tmp/cldr.min.js":["dist/cldr.js"],"tmp/cldr/event.min.js":["dist/cldr/event.js"],"tmp/cldr/supplemental.min.js":["dist/cldr/supplemental.js"],"tmp/cldr/unresolved.min.js":["dist/cldr/unresolved.js"]}}},compare_size:{files:["tmp/cldr.min.js","tmp/cldr/*min.js"],options:{compress:{gz:function(fileContents){return require("gzip-js").zip(fileContents,{}).length}}}}});require("matchdep").filterDev("grunt-*").forEach(grunt.loadNpmTasks);grunt.registerTask("test",function(){var args=[].slice.call(arguments);if(!isConnectTestRunning){grunt.task.run("connect:test");isConnectTestRunning=true}grunt.task.run(["mocha"].concat(args).join(":"))});grunt.registerTask("default",["jshint:metafiles","jshint:grunt","jshint:source","jshint:test","test:unit","requirejs","copy","jshint:dist","test:functional","uglify","compare_size","dco"])};