--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MCSMReleaseRepository.st Wed Nov 22 14:22:48 2006 +0100
@@ -0,0 +1,103 @@
+"{ 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'
+!
+
+fillInTheBlankRequest
+ ^ 'SqueakMap Release Repository:'
+
+!
+
+morphicConfigure
+ ^ self fillInTheBlankConfigure
+!
+
+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.1 2006-11-22 13:22:48 cg Exp $'
+! !