@@ -24,7 +24,7 @@ var releaseVersion,
24
24
branch = "master" ,
25
25
26
26
// Windows needs the .cmd version but will find the non-.cmd
27
- // On Windows, run from the Windows prompt, not a Cygwin shell
27
+ // On Windows, ensure the HOME environment variable is set
28
28
gruntCmd = process . platform === "win32" ? "grunt.cmd" : "grunt" ,
29
29
30
30
devFile = "dist/jquery.js" ,
@@ -61,9 +61,6 @@ function initialize( next ) {
61
61
patch = version [ 3 ] ,
62
62
xbeta = version [ 4 ] ;
63
63
64
- if ( debug ) {
65
- console . warn ( "=== DEBUG MODE ===" ) ;
66
- }
67
64
68
65
releaseVersion = process . argv [ 2 ] ;
69
66
isBeta = ! ! xbeta ;
@@ -72,23 +69,25 @@ function initialize( next ) {
72
69
die ( "Usage: " + process . argv [ 1 ] + " releaseVersion" ) ;
73
70
}
74
71
if ( xbeta === "pre" ) {
75
- die ( "Cannot release a 'pre' version" ) ;
72
+ die ( "Cannot release a 'pre' version! " ) ;
76
73
}
77
74
if ( ! ( fs . existsSync || path . existsSync ) ( "package.json" ) ) {
78
75
die ( "No package.json in this directory" ) ;
79
76
}
80
-
77
+ if ( debug ) {
78
+ console . warn ( "=== DEBUG MODE ===" ) ;
79
+ }
81
80
pkg = JSON . parse ( fs . readFileSync ( "package.json" ) ) ;
82
81
83
82
console . log ( "Current version is " + pkg . version + "; generating release " + releaseVersion ) ;
84
83
version = pkg . version . match ( rversion ) ;
85
- oldver = ( + version [ 1 ] ) * 10000 + ( + version [ 2 ] * 100 ) + ( + version [ 3 ] )
86
- newver = ( + major ) * 10000 + ( + minor * 100 ) + ( + patch ) ;
84
+ oldver = ( + version [ 1 ] ) * 10000 + ( + version [ 2 ] * 100 ) + ( + version [ 3 ] )
85
+ newver = ( + major ) * 10000 + ( + minor * 100 ) + ( + patch ) ;
87
86
if ( newver < oldver ) {
88
87
die ( "Next version is older than current version!" ) ;
89
88
}
90
89
91
- nextVersion = major + "." + minor + "." + ( isBeta ? patch : + patch + 1 ) + "pre" ;
90
+ nextVersion = major + "." + minor + "." + ( isBeta ? patch : + patch + 1 ) + "pre" ;
92
91
next ( ) ;
93
92
}
94
93
function checkGitStatus ( next ) {
@@ -134,28 +133,18 @@ function uploadToCDN( next ) {
134
133
135
134
Object . keys ( finalFiles ) . forEach ( function ( name ) {
136
135
cmds . push ( function ( x ) {
137
- exec ( "scp " + name + " " + scpURL , x ) ;
136
+ exec ( "scp " + name + " " + scpURL , x , skipRemote ) ;
138
137
} ) ;
139
138
cmds . push ( function ( x ) {
140
- exec ( "curl '" + cdnURL + name + "?reload'" , x ) ;
139
+ exec ( "curl '" + cdnURL + name + "?reload'" , x , skipRemote ) ;
141
140
} ) ;
142
141
} ) ;
143
142
cmds . push ( next ) ;
144
143
145
- if ( skipRemote ) {
146
- console . warn ( "Skipping remote file copies" ) ;
147
- next ( ) ;
148
- } else {
149
- steps . apply ( this , cmds ) ;
150
- }
144
+ steps . apply ( this , cmds ) ;
151
145
}
152
146
function pushToGithub ( next ) {
153
- if ( skipRemote ) {
154
- console . warn ( "Skipping git push --tags" ) ;
155
- next ( ) ;
156
- } else {
157
- exec ( "git push --tags " + repoURL + " " + branch , next ) ;
158
- }
147
+ exec ( "git push --tags " + repoURL + " " + branch , next , skipRemote ) ;
159
148
}
160
149
161
150
//==============================
@@ -181,11 +170,12 @@ function copy( oldFile, newFile ) {
181
170
fs . writeFileSync ( newFile , fs . readFileSync ( oldFile , "utf8" ) ) ;
182
171
}
183
172
}
184
- function exec ( cmd , fn ) {
185
- console . log ( cmd ) ;
186
- if ( debug ) {
173
+ function exec ( cmd , fn , skip ) {
174
+ if ( debug || skip ) {
175
+ console . log ( "# " + cmd ) ;
187
176
fn ( ) ;
188
177
} else {
178
+ console . log ( cmd ) ;
189
179
child . exec ( cmd , { env : process . env } , function ( err , stdout , stderr ) {
190
180
if ( err ) {
191
181
die ( stderr || stdout || err ) ;
@@ -195,7 +185,7 @@ function exec( cmd, fn ) {
195
185
}
196
186
}
197
187
function die ( msg ) {
198
- console . error ( "Error : " + msg ) ;
188
+ console . error ( "ERROR : " + msg ) ;
199
189
process . exit ( 1 ) ;
200
190
}
201
191
function exit ( ) {
0 commit comments