Skip to content

Commit 3b7bf19

Browse files
authored
Release: add support for md5 sums in windows
Close gh-5220
1 parent 63c3af4 commit 3b7bf19

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

build/release/cdn.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var
44
fs = require( "fs" ),
55
shell = require( "shelljs" ),
66
path = require( "path" ),
7+
os = require( "os" ),
78

89
cdnFolder = "dist/cdn",
910

@@ -68,12 +69,13 @@ function makeArchives( Release, callback ) {
6869

6970
console.log( "Creating production archive for " + cdn );
7071

71-
var sum,
72+
var i, sum, result,
7273
archiver = require( "archiver" )( "zip" ),
7374
md5file = cdnFolder + "/" + cdn + "-md5.txt",
7475
output = fs.createWriteStream(
7576
cdnFolder + "/" + cdn + "-jquery-" + Release.newVersion + ".zip"
7677
),
78+
rmd5 = /[a-f0-9]{32}/,
7779
rver = /VER/;
7880

7981
output.on( "close", callback );
@@ -89,7 +91,18 @@ function makeArchives( Release, callback ) {
8991
item.replace( rver, Release.newVersion );
9092
} );
9193

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+
}
93106
fs.writeFileSync( md5file, sum );
94107
files.push( md5file );
95108

0 commit comments

Comments
 (0)