]> source.dussan.org Git - jquery.git/commitdiff
Mine and munge date from full source license header
authorRick Waldron <waldron.rick@gmail.com>
Sat, 23 Jul 2011 23:18:41 +0000 (19:18 -0400)
committerRick Waldron <waldron.rick@gmail.com>
Sat, 23 Jul 2011 23:18:41 +0000 (19:18 -0400)
build/post-compile.js

index ea93c50ff32fec8b593eed76da8986ee56afa24e..965bad28ee62b47cf6dce304b70ef6867130565b 100644 (file)
@@ -5,15 +5,26 @@ var print = require( "sys" ).print,
        src = fs.readFileSync( process.argv[2], "utf8" ),
        version = fs.readFileSync( "version.txt", "utf8" ),
        // License Template
-       license = "/*! jQuery v@VERSION @DATE http://jquery.com/ | http://jquery.org/license */";
+       license = "/*! jQuery v@VERSION @DATE http://jquery.com/ | http://jquery.org/license */",
+       date;
 
 
-license = license.replace( "@VERSION", version )
-                                               .replace( "@DATE", (new Date()).toLocaleString() );
-
 // Previously done in sed but reimplemented here due to portability issues
 src = src.replace( /^(\s*\*\/)(.+)/m, "$1\n$2" ) + ";";
 
+// Mine & Munge Date information
+src.split( "\n" ).forEach(function( line, idx ) {
+       var data = line.split( " * Date: " );
+
+       if ( data.length && data[ 1 ] ) {
+               date = data[ 1 ];
+       }
+});
+
+// Set minimal license block vars
+license = license.replace( "@VERSION", version )
+                                               .replace( "@DATE", date );
+
 // Replace license block with minimal license
 src = src.replace( /\/\/.*?\/?\*.+?(?=\n|\r|$)|\/\*[\s\S]*?\/\/[\s\S]*?\*\//, license );