Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1f5dd8d

Browse files
committed
Release: Add support for pre-releases.
1 parent7a45a47 commit1f5dd8d

File tree

1 file changed

+66
-23
lines changed

1 file changed

+66
-23
lines changed

‎build/release/release.js

Lines changed: 66 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#!/usr/bin/env node
22
/*global cat:true cd:true echo:true exec:true exit:true*/
33

4+
// Usage:
5+
// stable release: node release.js
6+
// pre-release: node release.js --pre-release {version}
7+
48
"use strict";
59

6-
varbaseDir,repoDir,prevVersion,newVersion,nextVersion,tagTime,
10+
varbaseDir,repoDir,prevVersion,newVersion,nextVersion,tagTime,preRelease,
711
fs=require("fs"),
812
path=require("path"),
913
// support: node <0.8
@@ -67,8 +71,12 @@ function cloneRepo() {
6771
if(exec("npm install").code!==0){
6872
abort("Error installing dependencies.");
6973
}
70-
if(exec("npm install download.jqueryui.com").code!==0){
71-
abort("Error installing dependencies.");
74+
// We need download.jqueryui.com in order to generate themes.
75+
// We only generate themes for stable releases.
76+
if(!preRelease){
77+
if(exec("npm install download.jqueryui.com").code!==0){
78+
abort("Error installing dependencies.");
79+
}
7280
}
7381
echo();
7482
}
@@ -104,32 +112,37 @@ function getVersions() {
104112
abort("The version must be a pre version.");
105113
}
106114

107-
newVersion=currentVersion.substr(0,currentVersion.length-3);
108-
parts=newVersion.split(".");
109-
major=parseInt(parts[0],10);
110-
minor=parseInt(parts[1],10);
111-
patch=parseInt(parts[2],10);
112-
113-
// TODO: handle 2.0.0
114-
if(minor===0){
115-
abort("This script is not smart enough to handle the 2.0.0 release.");
116-
}
115+
if(preRelease){
116+
newVersion=preRelease;
117+
// Note: prevVersion is not currently used for pre-releases. The TODO
118+
// below about 1.10.0 applies here as well.
119+
prevVersion=nextVersion=currentVersion;
120+
}else{
121+
newVersion=currentVersion.substr(0,currentVersion.length-3);
122+
parts=newVersion.split(".");
123+
major=parseInt(parts[0],10);
124+
minor=parseInt(parts[1],10);
125+
patch=parseInt(parts[2],10);
126+
127+
// TODO: handle 1.10.0
128+
// Also see comment above about pre-releases
129+
if(minor===0){
130+
abort("This script is not smart enough to handle the 1.10.0 release.");
131+
}
117132

118-
prevVersion=patch===0 ?
119-
[major,minor-1,0].join(".") :
120-
[major,minor,patch-1].join(".");
121-
// TODO: Remove version hack after 1.9.0 release
122-
if(prevVersion==="1.8.0"){
123-
prevVersion="1.8";
133+
prevVersion=patch===0 ?
134+
[major,minor-1,0].join(".") :
135+
[major,minor,patch-1].join(".");
136+
nextVersion=[major,minor,patch+1].join(".")+"pre";
124137
}
125-
nextVersion=[major,minor,patch+1].join(".")+"pre";
126138

127139
echo("We are going from "+prevVersion.cyan+" to "+newVersion.cyan+".");
128140
echo("After the release, the version will be "+nextVersion.cyan+".");
129141
}
130142

131143
functionbuildRelease(){
132-
varpkg;
144+
varpkg,
145+
releaseTask=preRelease ?"release" :"release_cdn";
133146

134147
echo("Creating "+"release".cyan+" branch...");
135148
git("checkout -b release","Error creating release branch.");
@@ -151,7 +164,7 @@ function buildRelease() {
151164
echo();
152165

153166
echo("Building release...");
154-
if(exec("gruntrelease_cdn").code!==0){
167+
if(exec("grunt"+releaseTask).code!==0){
155168
abort("Error building release.");
156169
}
157170
echo();
@@ -173,6 +186,11 @@ function pushRelease() {
173186
}
174187

175188
functionupdateBranchVersion(){
189+
// Pre-releases don't change the master version
190+
if(preRelease){
191+
return;
192+
}
193+
176194
varpkg;
177195

178196
echo("Checking out "+branch.cyan+" branch...");
@@ -189,11 +207,20 @@ function updateBranchVersion() {
189207
}
190208

191209
functionpushBranch(){
210+
// Pre-releases don't change the master version
211+
if(preRelease){
212+
return;
213+
}
214+
192215
echo("Pushing "+branch.cyan+" to GitHub...");
193216
git("push","Error pushing to GitHub.");
194217
}
195218

196219
functiongenerateChangelog(){
220+
if(preRelease){
221+
return;
222+
}
223+
197224
varcommits,
198225
changelogPath=baseDir+"/changelog",
199226
changelog=cat("build/release/changelog-shell")+"\n",
@@ -232,6 +259,10 @@ function generateChangelog() {
232259
}
233260

234261
functiongatherContributors(){
262+
if(preRelease){
263+
return;
264+
}
265+
235266
varcontributors,
236267
contributorsPath=baseDir+"/contributors";
237268

@@ -262,7 +293,9 @@ function gatherContributors() {
262293

263294
functionupdateTrac(){
264295
echo(newVersion.cyan+" was tagged at "+tagTime.cyan+".");
265-
echo("Close the "+newVersion.cyan+" Milestone.");
296+
if(!preRelease){
297+
echo("Close the "+newVersion.cyan+" Milestone.");
298+
}
266299
echo("Create the "+newVersion.cyan+" Version.");
267300
echo("When Trac asks for date and time, match the above. Should only change minutes and seconds.");
268301
echo("Create a Milestone for the next minor release.");
@@ -329,6 +362,16 @@ function writePackage( pkg ) {
329362
}
330363

331364
functionbootstrap(fn){
365+
console.log("Determining release type...");
366+
preRelease=process.argv.indexOf("--pre-release");
367+
if(preRelease!==-1){
368+
preRelease=process.argv[preRelease+1];
369+
console.log("pre-release");
370+
}else{
371+
preRelease=null;
372+
console.log("stable release");
373+
}
374+
332375
console.log("Determining directories...");
333376
baseDir=process.cwd()+"/__release";
334377
repoDir=baseDir+"/repo";

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp