Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
bddd1003
Commit
bddd1003
authored
Dec 16, 2012
by
Dave Methvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the build script so it runs on Windows.
parent
24db7346
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
30 deletions
+45
-30
release.js
build/release.js
+45
-30
No files found.
build/release.js
View file @
bddd1003
...
@@ -9,19 +9,19 @@ var debug = false,
...
@@ -9,19 +9,19 @@ var debug = false,
var
fs
=
require
(
"fs"
),
var
fs
=
require
(
"fs"
),
child
=
require
(
"child_process"
),
child
=
require
(
"child_process"
),
path
=
require
(
"path"
),
path
=
require
(
"path"
);
which
=
require
(
'which'
).
sync
;
var
releaseVersion
,
var
releaseVersion
,
nextVersion
,
nextVersion
,
finalFiles
,
finalFiles
,
isBeta
,
isBeta
,
pkg
,
pkg
,
branch
,
scpURL
=
"jqadmin@code.origin.jquery.com:/var/www/html/code.jquery.com/"
,
scpURL
=
"jqadmin@code.origin.jquery.com:/var/www/html/code.jquery.com/"
,
cdnURL
=
"http://code.origin.jquery.com/"
,
cdnURL
=
"http://code.origin.jquery.com/"
,
repoURL
=
"git://github.com/
jquery
/jquery.git"
,
repoURL
=
"git://github.com/
dmethvin
/jquery.git"
,
branch
=
"master
"
,
//repoURL = "git://github.com/jquery/jquery.git
",
// Windows needs the .cmd version but will find the non-.cmd
// Windows needs the .cmd version but will find the non-.cmd
// On Windows, ensure the HOME environment variable is set
// On Windows, ensure the HOME environment variable is set
...
@@ -62,18 +62,18 @@ function initialize( next ) {
...
@@ -62,18 +62,18 @@ function initialize( next ) {
// First arg should be the version number being released
// First arg should be the version number being released
var
newver
,
oldver
,
var
newver
,
oldver
,
rversion
=
/^
(\d)\.(\d
+
)\.(\d)((?:
a|b|rc
)\d
|pre
)?
$/
,
rversion
=
/^
(\d)\.(\d
+
)\.(\d)((?:
a|b|rc
)\d
|pre
)?
$/
,
version
=
(
process
.
argv
[
2
]
||
""
).
toLowerCase
().
match
(
rversion
)
||
{},
version
=
(
process
.
argv
[
3
]
||
""
).
toLowerCase
().
match
(
rversion
)
||
{},
major
=
version
[
1
],
major
=
version
[
1
],
minor
=
version
[
2
],
minor
=
version
[
2
],
patch
=
version
[
3
],
patch
=
version
[
3
],
xbeta
=
version
[
4
];
xbeta
=
version
[
4
];
branch
=
process
.
argv
[
2
];
releaseVersion
=
process
.
argv
[
2
];
releaseVersion
=
process
.
argv
[
3
];
isBeta
=
!!
xbeta
;
isBeta
=
!!
xbeta
;
if
(
!
major
||
!
minor
||
!
patch
)
{
if
(
!
branch
||
!
major
||
!
minor
||
!
patch
)
{
die
(
"Usage: "
+
process
.
argv
[
1
]
+
" releaseVersion"
);
die
(
"Usage: "
+
process
.
argv
[
1
]
+
"
branch
releaseVersion"
);
}
}
if
(
xbeta
===
"pre"
)
{
if
(
xbeta
===
"pre"
)
{
die
(
"Cannot release a 'pre' version!"
);
die
(
"Cannot release a 'pre' version!"
);
...
@@ -95,7 +95,11 @@ function initialize( next ) {
...
@@ -95,7 +95,11 @@ function initialize( next ) {
next
();
next
();
}
}
function
checkGitStatus
(
next
)
{
function
checkGitStatus
(
next
)
{
exec
(
"git status"
,
function
(
error
,
stdout
,
stderr
)
{
git
(
[
"status"
],
function
(
error
,
stdout
,
stderr
)
{
var
onBranch
=
((
stdout
||
""
).
match
(
/On branch
(\S
+
)
/
)
||
[])[
1
];
if
(
onBranch
!==
branch
)
{
die
(
"Branches don't match: Wanted "
+
branch
+
", got "
+
onBranch
);
}
if
(
/Changes to be committed/i
.
test
(
stdout
)
)
{
if
(
/Changes to be committed/i
.
test
(
stdout
)
)
{
die
(
"Please commit changed files before attemping to push a release."
);
die
(
"Please commit changed files before attemping to push a release."
);
}
}
...
@@ -107,12 +111,18 @@ function checkGitStatus( next ) {
...
@@ -107,12 +111,18 @@ function checkGitStatus( next ) {
}
}
function
tagReleaseVersion
(
next
)
{
function
tagReleaseVersion
(
next
)
{
updatePackageVersion
(
releaseVersion
);
updatePackageVersion
(
releaseVersion
);
exec
(
'git commit -a -m "Tagging the '
+
releaseVersion
+
' release."'
,
function
(){
git
(
[
"commit"
,
"-a"
,
"-m"
,
"Tagging the "
+
releaseVersion
+
" release."
]
,
function
(){
exec
(
"git tag "
+
releaseVersion
,
next
);
git
(
[
"tag"
,
releaseVersion
],
next
,
debug
);
});
}
,
debug
);
}
}
function
gruntBuild
(
next
)
{
function
gruntBuild
(
next
)
{
exec
(
gruntCmd
,
next
);
exec
(
gruntCmd
,
[],
function
(
error
,
stdout
)
{
if
(
error
)
{
die
(
error
+
stderr
);
}
console
.
log
(
stdout
);
next
();
},
debug
);
}
}
function
makeReleaseCopies
(
next
)
{
function
makeReleaseCopies
(
next
)
{
finalFiles
=
{};
finalFiles
=
{};
...
@@ -130,17 +140,17 @@ function makeReleaseCopies( next ) {
...
@@ -130,17 +140,17 @@ function makeReleaseCopies( next ) {
}
}
function
setNextVersion
(
next
)
{
function
setNextVersion
(
next
)
{
updatePackageVersion
(
nextVersion
);
updatePackageVersion
(
nextVersion
);
exec
(
'git commit -a -m "Updating the source version to '
+
nextVersion
+
'"'
,
next
);
git
(
[
"commit"
,
"-a"
,
"-m"
,
"Updating the source version to "
+
nextVersion
],
next
,
debug
);
}
}
function
uploadToCDN
(
next
)
{
function
uploadToCDN
(
next
)
{
var
cmds
=
[];
var
cmds
=
[];
Object
.
keys
(
finalFiles
).
forEach
(
function
(
name
)
{
Object
.
keys
(
finalFiles
).
forEach
(
function
(
name
)
{
cmds
.
push
(
function
(
x
){
cmds
.
push
(
function
(
nxt
){
exec
(
"scp
"
+
name
+
" "
+
scpURL
,
x
,
skipRemote
);
exec
(
"scp
"
,
[
name
,
scpURL
],
nxt
,
debug
||
skipRemote
);
});
});
cmds
.
push
(
function
(
x
){
cmds
.
push
(
function
(
nxt
){
exec
(
"curl
'"
+
cdnURL
+
name
+
"?reload'"
,
x
,
skipRemote
);
exec
(
"curl
"
,
[
cdnURL
+
name
+
"?reload"
],
nxt
,
debug
||
skipRemote
);
});
});
});
});
cmds
.
push
(
next
);
cmds
.
push
(
next
);
...
@@ -148,7 +158,7 @@ function uploadToCDN( next ) {
...
@@ -148,7 +158,7 @@ function uploadToCDN( next ) {
steps
.
apply
(
this
,
cmds
);
steps
.
apply
(
this
,
cmds
);
}
}
function
pushToGithub
(
next
)
{
function
pushToGithub
(
next
)
{
exec
(
"git push --tags "
+
repoURL
+
" "
+
branch
,
next
,
skipRemote
);
git
(
[
"push"
,
"--tags"
,
repoURL
,
branch
],
next
,
debug
||
skipRemote
);
}
}
//==============================
//==============================
...
@@ -174,18 +184,23 @@ function copy( oldFile, newFile ) {
...
@@ -174,18 +184,23 @@ function copy( oldFile, newFile ) {
fs
.
writeFileSync
(
newFile
,
fs
.
readFileSync
(
oldFile
,
"utf8"
)
);
fs
.
writeFileSync
(
newFile
,
fs
.
readFileSync
(
oldFile
,
"utf8"
)
);
}
}
}
}
function
exec
(
cmd
,
fn
,
skip
)
{
function
git
(
args
,
fn
,
skip
)
{
if
(
debug
||
skip
)
{
exec
(
"git"
,
args
,
fn
,
skip
);
console
.
log
(
"# "
+
cmd
);
}
fn
();
function
exec
(
cmd
,
args
,
fn
,
skip
)
{
if
(
skip
)
{
console
.
log
(
"# "
+
cmd
+
" "
+
args
.
join
(
" "
)
);
fn
(
""
,
""
,
""
);
}
else
{
}
else
{
console
.
log
(
cmd
);
console
.
log
(
cmd
+
" "
+
args
.
join
(
" "
)
);
child
.
exec
(
cmd
,
{
env
:
process
.
env
},
function
(
err
,
stdout
,
stderr
)
{
child
.
execFile
(
cmd
,
args
,
{
env
:
process
.
env
},
function
(
err
,
stdout
,
stderr
)
{
if
(
err
)
{
if
(
err
)
{
die
(
stderr
||
stdout
||
err
);
die
(
stderr
||
stdout
||
err
);
}
}
fn
();
fn
.
apply
(
this
,
arguments
);
});
}
);
}
}
}
}
function
die
(
msg
)
{
function
die
(
msg
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment