"{ Package: 'stx:goodies/monticello' }"
MCWriteOnlyRepository subclass:#MCSMReleaseRepository
instanceVariableNames:'packageName user password'
classVariableNames:''
poolDictionaries:''
category:'Monticello-Repositories'
!
!MCSMReleaseRepository class methodsFor:'as yet unclassified'!
creationTemplate
^
'MCSMReleaseRepository
package: ''mypackage''
user: ''squeak''
password: ''squeak'''
!
description
^ 'SqueakMap Release'
!
package: packageString user: userString password: passString
^ self basicNew initializeWithPackage: packageString user: userString password: passString
! !
!MCSMReleaseRepository methodsFor:'as yet unclassified'!
basicStoreVersion: aVersion
| url |
url := self uploadVersion: aVersion.
self releaseVersion: aVersion url: url
!
checkResult: resultString
(#( 'HTTP/1.1 201 ' 'HTTP/1.1 200 ' 'HTTP/1.0 201 ' 'HTTP/1.0 200 ')
anySatisfy: [:code | resultString beginsWith: code ])
ifFalse: [self error: resultString].
!
description
^ 'sm://', packageName
!
initializeWithPackage: packageString user: userString password: passString
packageName := packageString.
user := userString.
password := passString.
!
releaseVersion: aVersion url: urlString
| result |
result := HTTPSocket
httpPost: self squeakMapUrl, '/packagebyname/', packageName, '/newrelease'
args: {'version' -> {(aVersion info name copyAfter: $.) extractNumber asString}.
'note' -> {aVersion info message}.
'downloadURL' -> {urlString}}
user: user
passwd: password.
result contents size > 4 ifTrue: [self error: result contents]
!
squeakMapUrl
^ 'http://localhost:9070/sm'
!
stringForVersion: aVersion
| stream |
stream := RWBinaryOrTextStream on: String new.
aVersion fileOutOn: stream.
^ stream contents
!
uploadVersion: aVersion
| result stream |
result := HTTPSocket
httpPut: (self stringForVersion: aVersion)
to: self squeakMapUrl, '/upload/', aVersion fileName
user: user
passwd: password.
self checkResult: result.
stream := result readStream.
stream upToAll: 'http://'.
^ 'http://', stream upToEnd
! !
!MCSMReleaseRepository class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/goodies/monticello/MCSMReleaseRepository.st,v 1.3 2011-08-20 12:28:09 cg Exp $'
!
version_CVS
^ '$Header: /cvs/stx/stx/goodies/monticello/MCSMReleaseRepository.st,v 1.3 2011-08-20 12:28:09 cg Exp $'
!
version_SVN
^ '§Id: MCSMReleaseRepository.st 5 2010-08-29 07:30:29Z vranyj1 §'
! !