[squeak-dev] The Trunk: SMLoader-cmm.69.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Feb 12 22:50:07 UTC 2011
Chris Muller uploaded a new version of SMLoader to project The Trunk:
http://source.squeak.org/trunk/SMLoader-cmm.69.mcz
==================== Summary ====================
Name: SMLoader-cmm.69
Author: cmm
Time: 8 February 2011, 7:09:23.624 pm
UUID: 4466a099-a3e2-4d04-aaf7-d26d60dcbdc3
Ancestors: SMLoader-cmm.68
- Must send the Community Supported category in the HTTP request when saving a new release.
- Save the package release before uploading the install file in case there is a validation error, the local model will remain consistent with SqueakMap.
- Set the downloadURL to the the account that is actually _posting_ the package, rather than the package-owner, to support Community Supported packages.
- Added a basic validation method.
=============== Diff against SMLoader-cmm.68 ===============
Item was changed:
----- Method: SMClient>>smUrl (in category 'private') -----
smUrl
+ ^ 'http://map.squeak.org' "'http://localhost:9091'"!
- ^ "'http://map.squeak.org'" 'http://localhost:8080'!
Item was changed:
----- Method: SMPackageRelease>>httpPostContent (in category '*smloader') -----
httpPostContent
"Answer the url-encoded parameters for this object."
| allCategories |
^ String streamContents:
[ : stream | self isNewObject
ifTrue:
[ "Make the parent release the selected."
self parentReleaseIndex > 0 ifTrue: [ stream nextPutAll: '1-1=' , self parentReleaseIndex , '&' ] ]
ifFalse:
[ "Make this release the selected."
self releaseIndex > 0 ifTrue: [ stream nextPutAll: '1-1=' , self releaseIndex , '&' ] ].
"The following category fields must remain in alphabetical order. Add 1 to category indexes because web-server expects the first item to always be nil."
stream
nextPutAll: '1-3=' , self version asString encodeForHTTP ;
nextPutAll: '&1-4=' , (self compatibilityIndex + 1) ;
nextPutAll: '&1-5=' , (self licenseIndex + 1) ;
nextPutAll: '&1-6=' , (self maturityIndex + 1) ;
nextPutAll: '&1-7=' , (self squeakVersionIndex + 1) ;
nextPutAll: '&1-8=' , self downloadUrl "already http encoded" ;
nextPutAll: '&1-9=1&1-10=&1-11=' "No file selection, 'cool' name or summary".
"Specify only the mandatory categories for 'additional categories', otherwise prior mandatory selections will be reflected in the objects categories, causing the highest-in-the-list to always win. Ugh.."
+ allCategories := SMSqueakMap default sortedCategories.
- allCategories := SMSqueakMap default categories asSortedCollection:
- [ : a : b | a name < b name ].
{allCategories indexOf: self compatibility.
allCategories indexOf: self license.
allCategories indexOf: self maturity.
allCategories indexOf: self squeakVersion} do:
[ : each | stream nextPutAll: '&1-12=' , each asString ].
+ self isCommunitySupported ifTrue: [ stream nextPutAll: '&1-12=', (allCategories indexOf: self communitySupportedCategory) asString ].
stream nextPutAll: '&1-13=' , self note asString encodeForHTTP.
self isNewObject
ifTrue: [ stream nextPutAll: '&1-18=Save+as+new+release' ]
ifFalse: [ stream nextPutAll: '&1-17=Save+changes' ].
self parentRelease ifNotNilDo:
[ : pr | stream nextPutAll: '&1-19=' , pr releaseIndex ] ]!
Item was changed:
----- Method: SMReleaseBrowser>>save (in category 'initialize-release') -----
save
"Save the release to SqueakMap."
+ self validateCanSave.
+ Cursor wait
+ showWhile: [self dependents
+ do: [:eachWidget | #(#username #password #note #version #content )
+ do: [:eachName | eachWidget knownName = eachName
+ ifTrue: [eachWidget hasUnacceptedEdits
+ ifTrue: [eachWidget accept]]]].
+ [self writeInstallFile; login.
+ self savePackageRelease.
+ self loadScript isEmptyOrNil
+ ifFalse: [self uploadInstallFile]]
+ ensure: [self logout]].
- Cursor wait showWhile:
- [ self dependents do:
- [ : eachWidget | #(#username #password #note #version #content ) do:
- [ : eachName | eachWidget knownName = eachName ifTrue:
- [ eachWidget hasUnacceptedEdits ifTrue: [ eachWidget accept ] ] ] ].
- [ self
- writeInstallFile ;
- login.
- self loadScript isEmptyOrNil ifFalse: [ self uploadInstallFile ].
- self savePackageRelease ] ensure: [ self logout ] ].
self closeWindow!
Item was changed:
----- Method: SMReleaseBrowser>>savePackageRelease (in category 'private') -----
savePackageRelease
+ "We actually save the package-release to the users who is posting it,
+ even if that is different than the owner."
| response |
+ release downloadUrl: self smAccount downloadsDirectory , '/' , release scriptName.
- release downloadUrl: release fullyQualifiedScriptName.
response := smClient save: release.
+ (response isSuccess not
+ or: [#('error' 'failed' )
+ anySatisfy: [:each | response content includesSubstring: each caseSensitive: false]])
+ ifTrue: [self error: 'failed']
+ ifFalse: [release package addRelease: release]!
- "Saved, now ensure part of my package's releases in the local copy of the model."
- release package addRelease: release.
- response isSuccess ifFalse: [ self halt: 'non-successful response' ]!
Item was added:
+ ----- Method: SMReleaseBrowser>>smAccount (in category 'private') -----
+ smAccount
+ ^ SMSqueakMap default accountForUsername: self username!
Item was added:
+ ----- Method: SMReleaseBrowser>>userError: (in category 'private') -----
+ userError: aString
+ UIManager default inform: aString!
Item was added:
+ ----- Method: SMReleaseBrowser>>validateCanSave (in category 'initialize-release') -----
+ validateCanSave
+ self username isEmptyOrNil
+ ifTrue: [self userError: 'username required'].
+ self note isEmptyOrNil
+ ifTrue: [self userError: 'note required'].
+ self version isEmptyOrNil
+ ifTrue: [self userError: 'version required']!
More information about the Squeak-dev
mailing list
|