File tree Expand file tree Collapse file tree 5 files changed +46
-32
lines changed Expand file tree Collapse file tree 5 files changed +46
-32
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ Release.define({
48
48
}
49
49
50
50
console . log ( ) ;
51
- console . log ( "\tProject: " + Release . project ) ;
52
51
console . log ( "\tRelease type: " + ( Release . preRelease ? "pre-release" : "stable" ) ) ;
53
52
console . log ( "\tRemote: " + Release . remote ) ;
54
53
console . log ( "\tBranch: " + Release . branch ) ;
@@ -71,15 +70,8 @@ Release.define({
71
70
process . exit ( 1 ) ;
72
71
}
73
72
74
- // URL
75
- if ( / : \/ \/ / . test ( remote ) ) {
76
- Release . project = remote . replace ( / .+ \/ ( [ ^ \/ ] + ) \. g i t / , "$1" ) ;
77
-
78
- // filesystem or GitHub
79
- } else {
80
- Release . project = remote . split ( "/" ) . pop ( ) ;
81
-
82
- // If it's not a local path, it must be a GitHub repo
73
+ // If it's not a local path, it must be a GitHub repo
74
+ if ( ! / : \/ \/ / . test ( remote ) ) {
83
75
if ( ! fs . existsSync ( remote ) ) {
84
76
Release . isTest = ! / ^ j q u e r y \/ / . test ( remote ) ;
85
77
remote = "git@github.com:" + remote + ".git" ;
Original file line number Diff line number Diff line change @@ -6,18 +6,19 @@ module.exports = function( Release ) {
6
6
testRemote = "git@github.com:jquery/fake-cdn.git" ;
7
7
8
8
function projectCdn ( ) {
9
- var jqueryCdn = Release . _cloneCdnRepo ( ) + "/cdn" ;
10
- if ( Release . project === "jquery" ) {
9
+ var npmPackage = Release . readPackage ( ) . name ,
10
+ jqueryCdn = Release . _cloneCdnRepo ( ) + "/cdn" ;
11
+ if ( npmPackage === "jquery" ) {
11
12
return jqueryCdn ;
12
13
}
13
- if ( Release . project === "qunit " ) {
14
+ if ( npmPackage === "qunitjs " ) {
14
15
return jqueryCdn + "/qunit" ;
15
16
}
16
- if ( / ^ j q u e r y - / . test ( Release . project ) ) {
17
- return jqueryCdn + "/" + Release . project . substring ( 7 ) +
17
+ if ( / ^ j q u e r y - / . test ( npmPackage ) ) {
18
+ return jqueryCdn + "/" + npmPackage . substring ( 7 ) +
18
19
"/" + Release . newVersion ;
19
20
}
20
- return jqueryCdn + "/" + Release . project + "/" + Release . newVersion ;
21
+ return jqueryCdn + "/" + npmPackage + "/" + Release . newVersion ;
21
22
}
22
23
23
24
Release . define ( {
Original file line number Diff line number Diff line change @@ -23,11 +23,9 @@ Release.define({
23
23
24
24
_generateCommitChangelog : function ( ) {
25
25
var commits ,
26
- commitRef = "[%h](http://github.com/jquery/ " + Release . project + "/commit/%H)" ,
26
+ commitRef = "[%h](" + Release . _repositoryUrl ( ) + "/commit/%H)" ,
27
27
fullFormat = "* %s (TICKETREF, " + commitRef + ")" ,
28
- ticketUrl = Release . issueTracker === "trac" ?
29
- "http://bugs." + Release . project + ".com/ticket/" :
30
- "https://github.com/jquery/" + Release . project + "/issue/" ;
28
+ ticketUrl = Release . _ticketUrl ( ) ;
31
29
32
30
console . log ( "Adding commits..." ) ;
33
31
Release . chdir ( Release . dir . repo ) ;
Original file line number Diff line number Diff line change @@ -82,6 +82,40 @@ Release.define({
82
82
83
83
checkRepoState : function ( ) { } ,
84
84
85
+ // Unwrapped URL field from package.json, no trailing slash
86
+ _packageUrl : function ( field ) {
87
+ var result = Release . readPackage ( ) [ field ] ;
88
+
89
+ // Make sure it exists
90
+ if ( ! result ) {
91
+ Release . abort ( "Failed to read '" + field + "' URL field from package.json" ) ;
92
+ }
93
+
94
+ // Unwrap
95
+ if ( result . url ) {
96
+ result = result . url ;
97
+ }
98
+
99
+ // Strip trailing slash
100
+ return result . replace ( / \/ $ / , "" ) ;
101
+ } ,
102
+
103
+ _ticketUrl : function ( ) {
104
+ return Release . _packageUrl ( "bugs" ) + ( Release . issueTracker === "trac" ?
105
+
106
+ // Trac bugs URL is just the host
107
+ "/ticket/" :
108
+
109
+ // GitHub bugs URL is host/user/repo/issues
110
+ "/" ) ;
111
+ } ,
112
+
113
+ _repositoryUrl : function ( ) {
114
+ return Release . _packageUrl ( "repository" )
115
+ . replace ( / ^ g i t / , "https" )
116
+ . replace ( / \. g i t $ / , "" ) ;
117
+ } ,
118
+
85
119
_readJSON : function ( fileName ) {
86
120
var json = fs . readFileSync ( Release . dir . repo + "/" + fileName , "utf8" ) ;
87
121
Release . packageIndentation = json . match ( / \n ( [ \t \s ] + ) / ) [ 1 ] ;
Original file line number Diff line number Diff line change 1
1
module . exports = function ( Release ) {
2
2
3
3
Release . define ( {
4
- _tracUrl : function ( ) {
5
- var bugs = Release . readPackage ( ) . bugs ;
6
-
7
- // Unwrap
8
- if ( bugs . url ) {
9
- bugs = bugs . url ;
10
- }
11
-
12
- // Strip trailing slash
13
- return bugs . replace ( / \/ $ / , "" ) ;
14
- } ,
15
4
trac : function ( path ) {
16
- var tracUrl = Release . _tracUrl ( ) ;
5
+ var tracUrl = Release . _packageUrl ( "bugs" ) ;
17
6
return Release . exec ( {
18
7
command : "curl -s '" + tracUrl + path + "&format=tab'" ,
19
8
silent : true
You can’t perform that action at this time.
0 commit comments