115
|
1 |
"{ Package: 'stx:goodies/monticello' }"
|
|
2 |
|
|
3 |
MCWriteOnlyRepository subclass:#MCSMReleaseRepository
|
|
4 |
instanceVariableNames:'packageName user password'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
677
|
7 |
category:'SCM-Monticello-Repositories'
|
115
|
8 |
!
|
|
9 |
|
|
10 |
|
899
|
11 |
!MCSMReleaseRepository class methodsFor:'instance creation'!
|
|
12 |
|
|
13 |
package: packageString user: userString password: passString
|
|
14 |
^ self basicNew initializeWithPackage: packageString user: userString password: passString
|
|
15 |
! !
|
|
16 |
|
|
17 |
!MCSMReleaseRepository class methodsFor:'queries'!
|
115
|
18 |
|
|
19 |
creationTemplate
|
|
20 |
^
|
|
21 |
'MCSMReleaseRepository
|
|
22 |
package: ''mypackage''
|
|
23 |
user: ''squeak''
|
|
24 |
password: ''squeak'''
|
|
25 |
|
|
26 |
!
|
|
27 |
|
|
28 |
description
|
|
29 |
^ 'SqueakMap Release'
|
899
|
30 |
! !
|
115
|
31 |
|
899
|
32 |
!MCSMReleaseRepository methodsFor:'accessing'!
|
|
33 |
|
|
34 |
description
|
|
35 |
^ 'sm://', packageName
|
115
|
36 |
! !
|
|
37 |
|
|
38 |
!MCSMReleaseRepository methodsFor:'as yet unclassified'!
|
|
39 |
|
|
40 |
checkResult: resultString
|
|
41 |
(#( 'HTTP/1.1 201 ' 'HTTP/1.1 200 ' 'HTTP/1.0 201 ' 'HTTP/1.0 200 ')
|
|
42 |
anySatisfy: [:code | resultString beginsWith: code ])
|
|
43 |
ifFalse: [self error: resultString].
|
227
|
44 |
|
115
|
45 |
!
|
|
46 |
|
|
47 |
releaseVersion: aVersion url: urlString
|
|
48 |
| result |
|
227
|
49 |
result := HTTPSocket
|
115
|
50 |
httpPost: self squeakMapUrl, '/packagebyname/', packageName, '/newrelease'
|
|
51 |
args: {'version' -> {(aVersion info name copyAfter: $.) extractNumber asString}.
|
|
52 |
'note' -> {aVersion info message}.
|
|
53 |
'downloadURL' -> {urlString}}
|
|
54 |
user: user
|
|
55 |
passwd: password.
|
|
56 |
result contents size > 4 ifTrue: [self error: result contents]
|
227
|
57 |
|
115
|
58 |
!
|
|
59 |
|
|
60 |
squeakMapUrl
|
|
61 |
^ 'http://localhost:9070/sm'
|
227
|
62 |
|
115
|
63 |
!
|
|
64 |
|
|
65 |
uploadVersion: aVersion
|
919
|
66 |
| result stream |
|
|
67 |
result := HTTPSocket
|
|
68 |
httpPut: (self stringForVersion: aVersion)
|
|
69 |
to: self squeakMapUrl, '/upload/', aVersion fileName
|
|
70 |
user: user
|
|
71 |
passwd: password.
|
|
72 |
self checkResult: result.
|
|
73 |
stream := result readStream.
|
|
74 |
stream skipThroughAll: 'http://'.
|
|
75 |
^ 'http://', stream upToEnd
|
115
|
76 |
! !
|
|
77 |
|
899
|
78 |
!MCSMReleaseRepository methodsFor:'initialization'!
|
|
79 |
|
|
80 |
initializeWithPackage: packageString user: userString password: passString
|
|
81 |
packageName := packageString.
|
|
82 |
user := userString.
|
|
83 |
password := passString.
|
|
84 |
|
|
85 |
! !
|
|
86 |
|
|
87 |
!MCSMReleaseRepository methodsFor:'printing & storing'!
|
|
88 |
|
|
89 |
basicStoreVersion: aVersion
|
|
90 |
| url |
|
|
91 |
url := self uploadVersion: aVersion.
|
|
92 |
self releaseVersion: aVersion url: url
|
|
93 |
! !
|
|
94 |
|
|
95 |
!MCSMReleaseRepository methodsFor:'queries'!
|
|
96 |
|
|
97 |
stringForVersion: aVersion
|
|
98 |
| stream |
|
|
99 |
stream := RWBinaryOrTextStream on: String new.
|
|
100 |
aVersion fileOutOn: stream.
|
|
101 |
^ stream contents
|
|
102 |
! !
|
|
103 |
|
115
|
104 |
!MCSMReleaseRepository class methodsFor:'documentation'!
|
|
105 |
|
|
106 |
version
|
919
|
107 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCSMReleaseRepository.st,v 1.6 2014-03-01 22:43:05 cg Exp $'
|
227
|
108 |
!
|
|
109 |
|
|
110 |
version_CVS
|
919
|
111 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCSMReleaseRepository.st,v 1.6 2014-03-01 22:43:05 cg Exp $'
|
227
|
112 |
!
|
|
113 |
|
|
114 |
version_SVN
|
919
|
115 |
^ '$Id: MCSMReleaseRepository.st,v 1.6 2014-03-01 22:43:05 cg Exp $'
|
115
|
116 |
! !
|
899
|
117 |
|