4
4
fs = require ( "fs" ) ,
5
5
shell = require ( "shelljs" ) ,
6
6
path = require ( "path" ) ,
7
+ os = require ( "os" ) ,
7
8
8
9
cdnFolder = "dist/cdn" ,
9
10
@@ -68,12 +69,13 @@ function makeArchives( Release, callback ) {
68
69
69
70
console . log ( "Creating production archive for " + cdn ) ;
70
71
71
- var sum ,
72
+ var i , sum , result ,
72
73
archiver = require ( "archiver" ) ( "zip" ) ,
73
74
md5file = cdnFolder + "/" + cdn + "-md5.txt" ,
74
75
output = fs . createWriteStream (
75
76
cdnFolder + "/" + cdn + "-jquery-" + Release . newVersion + ".zip"
76
77
) ,
78
+ rmd5 = / [ a - f 0 - 9 ] { 32 } / ,
77
79
rver = / V E R / ;
78
80
79
81
output . on ( "close" , callback ) ;
@@ -89,7 +91,18 @@ function makeArchives( Release, callback ) {
89
91
item . replace ( rver , Release . newVersion ) ;
90
92
} ) ;
91
93
92
- sum = Release . exec ( "md5 -r " + files . join ( " " ) , "Error retrieving md5sum" ) ;
94
+ if ( os . platform ( ) === "win32" ) {
95
+ sum = [ ] ;
96
+ for ( i = 0 ; i < files . length ; i ++ ) {
97
+ result = Release . exec (
98
+ "certutil -hashfile " + files [ i ] + " MD5" , "Error retrieving md5sum"
99
+ ) ;
100
+ sum . push ( rmd5 . exec ( result ) [ 0 ] + " " + files [ i ] ) ;
101
+ }
102
+ sum = sum . join ( "\n" ) ;
103
+ } else {
104
+ sum = Release . exec ( "md5 -r " + files . join ( " " ) , "Error retrieving md5sum" ) ;
105
+ }
93
106
fs . writeFileSync ( md5file , sum ) ;
94
107
files . push ( md5file ) ;
95
108
0 commit comments