@@ -6,6 +6,8 @@ var cheerio = require( "cheerio" ),
6
6
shell = require ( "shelljs" ) ;
7
7
8
8
module . exports = function ( Release ) {
9
+ var clonedRepos = { } ;
10
+
9
11
Release . define ( {
10
12
issueTracker : "github" ,
11
13
changelogShell : function ( ) {
@@ -19,33 +21,19 @@ module.exports = function( Release ) {
19
21
done ( [ ] ) ;
20
22
} ,
21
23
22
- _uploadZipToWebsite : function ( done ) {
23
- var releaseDist = path . join ( Release . dir . repo , "dist" ) ,
24
- zipFilename = "jquery.mobile-" + Release . newVersion + ".zip" ;
25
-
26
- console . log ( "Uploading " + zipFilename + " to jquerymobile.com..." ) ;
27
- scp . send ( {
28
- user : "jqadmin" ,
29
- host : "jquerymobile.com" ,
30
- file : path . join ( releaseDist , zipFilename ) ,
31
- path : "/var/www/jquerymobile.com/htdocs/resources/download/"
32
- } , function ( err ) {
33
- if ( err ) {
34
- Release . abort ( "Error while uploading " + zipFilename + " to the website: " + err ) ;
35
- }
36
- done ( ) ;
37
- } ) ;
38
- } ,
39
-
40
24
_cloneDemosRepo : function ( ) {
41
25
var local = Release . dir . base + "/demos.jquerymobile.com" ,
42
26
remote = "[email protected] :jquery/demos.jquerymobile.com" ;
43
27
44
- console . log ( "Cloning " + remote . cyan + "..." ) ;
45
- Release . git ( "clone " + remote + " " + local , "Error cloning Demos repo." ) ;
46
- console . log ( ) ;
28
+ if ( ! clonedRepos [ remote ] ) {
29
+ console . log ( "Cloning " + remote . cyan + "..." ) ;
30
+ Release . git ( "clone " + remote + " " + local , "Error cloning Demos repo." ) ;
31
+ console . log ( ) ;
47
32
48
- return local ;
33
+ clonedRepos [ remote ] = local ;
34
+ }
35
+
36
+ return clonedRepos [ remote ] ;
49
37
} ,
50
38
51
39
_publishDemos : function ( ) {
@@ -66,7 +54,7 @@ module.exports = function( Release ) {
66
54
console . log ( "Adding files..." ) ;
67
55
process . chdir ( repo ) ;
68
56
Release . git ( "add ." , "Error adding files." ) ;
69
- Release . git ( "commit -m '" + commitMessage + "'" , "Error commiting files." ) ;
57
+ Release . git ( "commit -m '" + commitMessage + "'" , "Error commiting demos files." ) ;
70
58
console . log ( "Pushing to github..." ) ;
71
59
Release . git ( "push" , "Error pushing demos to github." ) ;
72
60
console . log ( ) ;
@@ -76,11 +64,15 @@ module.exports = function( Release ) {
76
64
var local = Release . dir . base + "/jquerymobile.com" ,
77
65
remote = "[email protected] :jquery/jquerymobile.com" ;
78
66
79
- console . log ( "Cloning " + remote . cyan + "..." ) ;
80
- Release . git ( "clone " + remote + " " + local , "Error cloning website repo." ) ;
81
- console . log ( ) ;
67
+ if ( ! clonedRepos [ remote ] ) {
68
+ console . log ( "Cloning " + remote . cyan + "..." ) ;
69
+ Release . git ( "clone " + remote + " " + local , "Error cloning website repo." ) ;
70
+ console . log ( ) ;
71
+
72
+ clonedRepos [ remote ] = local ;
73
+ }
82
74
83
- return local ;
75
+ return clonedRepos [ remote ] ;
84
76
} ,
85
77
86
78
_updateBuilder : function ( ) {
@@ -125,18 +117,38 @@ module.exports = function( Release ) {
125
117
console . log ( "Adding files..." ) ;
126
118
process . chdir ( repo ) ;
127
119
Release . git ( "add ." , "Error adding files." ) ;
128
- Release . git ( "commit -m '" + commitMessage + "'" , "Error commiting files." ) ;
120
+ Release . git ( "commit -m '" + commitMessage + "'" , "Error commiting builder files." ) ;
129
121
console . log ( "Pushing to github..." ) ;
130
- Release . git ( "push" , "Error pushing demos to github." ) ;
122
+ Release . git ( "push" , "Error pushing builder update to github." ) ;
123
+ console . log ( ) ;
124
+ } ,
125
+
126
+ _publishZipsToWebsite : function ( ) {
127
+ var repo = Release . _cloneWebsiteRepo ( ) ,
128
+ dest = repo + "/resources/download" ,
129
+ dist = Release . dir . repo + "/dist/jquery.mobile-" + Release . newVersion + ".zip" ,
130
+ images = Release . dir . repo + "/dist/jquery.mobile.images-" + Release . newVersion + ".zip" ,
131
+ commitMessage = "Release: Added zip for version " + Release . newVersion ;
132
+
133
+ shell . mkdir ( "-p" , dest ) ;
134
+ shell . cp ( dist , dest ) ;
135
+ shell . cp ( images , dest ) ;
136
+
137
+ console . log ( "Adding files..." ) ;
138
+ process . chdir ( repo ) ;
139
+ Release . git ( "add ." , "Error adding zip files." ) ;
140
+ Release . git ( "commit -m '" + commitMessage + "'" , "Error commiting zip files." ) ;
141
+ console . log ( "Pushing to github..." ) ;
142
+ Release . git ( "push" , "Error pushing zip files to github." ) ;
131
143
console . log ( ) ;
132
144
} ,
133
145
134
146
_complete : function ( done ) {
135
147
Release . _walk ( [
136
- Release . _section ( "publishing zip file" ) ,
137
- Release . _uploadZipToWebsite ,
138
148
Release . _section ( "publishing demos" ) ,
139
149
Release . _publishDemos ,
150
+ Release . _section ( "publishing zip files" ) ,
151
+ Release . _publishZipsToWebsite ,
140
152
Release . _section ( "updating builder" ) ,
141
153
Release . _updateBuilder
142
154
] , done ) ;
0 commit comments