Release: Distribute files to distribution repo
[jquery.git] / build / release / release-notes.js
blob00cdc8659bbd50e37b56553bcdded042be924850
1 #!/usr/bin/env node
2 /*
3  * jQuery Release Note Generator
4  */
6 var http = require("http"),
7         extract = /<a href="\/ticket\/(\d+)" title="View ticket">(.*?)<[^"]+"component">\s*(\S+)/g,
8         version = process.argv[2];
10 if ( !/^\d+\.\d+/.test( version ) ) {
11         console.error( "Invalid version number: " + version );
12         process.exit( 1 );
15 http.request({
16         host: "bugs.jquery.com",
17         port: 80,
18         method: "GET",
19         path: "/query?status=closed&resolution=fixed&max=400&" +
20                 "component=!web&order=component&milestone=" + version
21 }, function( res ) {
22         var data = [];
24         res.on( "data", function( chunk ) {
25                 data.push( chunk );
26         });
28         res.on( "end", function() {
29                 var match, cur, cat,
30                         file = data.join("");
32                 while ( (match = extract.exec( file )) ) {
33                         if ( "#" + match[1] !== match[2] ) {
34                                 cat = match[3];
36                                 if ( !cur || cur !== cat ) {
37                                         if ( cur ) {
38                                                 console.log("</ul>");
39                                         }
40                                         cur = cat;
41                                         console.log( "<h3>" + cat.charAt(0).toUpperCase() + cat.slice(1) + "</h3>" );
42                                         console.log("<ul>");
43                                 }
45                                 console.log(
46                                         "  <li><a href=\"http://bugs.jquery.com/ticket/" + match[1] + "\">#" +
47                                         match[1] + ": " + match[2] + "</a></li>"
48                                 );
49                         }
50                 }
51                 if ( cur ) {
52                         console.log("</ul>");
53                 }
55         });
56 }).end();