tim Rowledge uploaded a new version of SMLoader to project The Trunk:
http://source.squeak.org/trunk/SMLoader-tpr.87.mcz ==================== Summary ==================== Name: SMLoader-tpr.87 Author: tpr Time: 21 June 2016, 1:29:19.632444 pm UUID: e1857350-474a-4c4d-a5af-f8d6226c3f79 Ancestors: SMLoader-mt.86 Improve (hopefully) the SM release browser so that a) when hitting the save button it automatically accepts changed text in the name/version/script etc views, thus avoiding the need to accept each one individually. b) instead of a blank script view we provide some examples to offer a clue to the user =============== Diff against SMLoader-mt.86 =============== Item was added: + ----- Method: SMReleaseBrowser>>exampleLoadScript (in category 'private') ----- + exampleLoadScript + "this is an example load script to offer the user rather than a blank view" + + ^'"This is where you need to provide an install script; you may need to handle prerequisites first and then load the actual package(s) Take a look at http://wiki.squeak.org/squeak/6182 for more info, especially about creating a ''load latest version'' script" + "Example to load a prerequisite package - " + SMSqueakMap default + installPackageNamed: ''myPackage'' + version: ''release name''. + "Example to load myPackage if a certain class is not already in the image -" + (Smalltalk hasClassNamed: #MyPackage) + ifFalse:[SMSqueakMap default + installPackageNamed: ''myPackage'' + version: ''release name'']. + "Or load several specifc mcz files -" + #( ''MyPackagePartA-abc.1.mcz'' ''MyPackagePartB-abc.42.mcz'' ) do: + [:each| (Installer repository: ''http://www.squeaksource.com/MyPackages'') install: each]'! Item was changed: ----- Method: SMReleaseBrowser>>loadScript (in category 'model access') ----- loadScript "The Smalltalk code needed to install this release of this package." + ^ loadScript + ifNil: [| scriptName | + scriptName := release downloadFileName. + loadScript := scriptName isEmptyOrNil + ifFalse: [(scriptName asLowercase endsWith: '.st') + ifTrue: [release contents]] + ifTrue: [self exampleLoadScript]]! - ^ loadScript ifNil: - [ | scriptName | - scriptName := release downloadFileName. - loadScript := scriptName isEmptyOrNil ifFalse: - [ (scriptName asLowercase endsWith: '.st') ifTrue: [ release contents ] ] ]! Item was changed: ----- Method: SMReleaseBrowser>>validateCanSave (in category 'private') ----- validateCanSave + "accept any changes in the text field morphs etc, then validate the input as best we can" + self changed: #acceptChanges. self username isEmptyOrNil ifTrue: [ self userError: 'username required' ]. self note isEmptyOrNil ifTrue: [ self userError: 'note required' ]. self version isEmptyOrNil ifTrue: [ self userError: 'version required' ] ifFalse: [ (self version includes: $+) ifTrue: [ self userError: 'Plus sign not allowed in version name because it is reserved by HTTP.' ] ]! |
Very nice. :)
On Tue, Jun 21, 2016 at 3:29 PM, <[hidden email]> wrote: > tim Rowledge uploaded a new version of SMLoader to project The Trunk: > http://source.squeak.org/trunk/SMLoader-tpr.87.mcz > > ==================== Summary ==================== > > Name: SMLoader-tpr.87 > Author: tpr > Time: 21 June 2016, 1:29:19.632444 pm > UUID: e1857350-474a-4c4d-a5af-f8d6226c3f79 > Ancestors: SMLoader-mt.86 > > Improve (hopefully) the SM release browser so that > a) when hitting the save button it automatically accepts changed text in the name/version/script etc views, thus avoiding the need to accept each one individually. > b) instead of a blank script view we provide some examples to offer a clue to the user > > =============== Diff against SMLoader-mt.86 =============== > > Item was added: > + ----- Method: SMReleaseBrowser>>exampleLoadScript (in category 'private') ----- > + exampleLoadScript > + "this is an example load script to offer the user rather than a blank view" > + > + ^'"This is where you need to provide an install script; you may need to handle prerequisites first and then load the actual package(s) Take a look at http://wiki.squeak.org/squeak/6182 for more info, especially about creating a ''load latest version'' script" > + "Example to load a prerequisite package - " > + SMSqueakMap default > + installPackageNamed: ''myPackage'' > + version: ''release name''. > + "Example to load myPackage if a certain class is not already in the image -" > + (Smalltalk hasClassNamed: #MyPackage) > + ifFalse:[SMSqueakMap default > + installPackageNamed: ''myPackage'' > + version: ''release name'']. > + "Or load several specifc mcz files -" > + #( ''MyPackagePartA-abc.1.mcz'' ''MyPackagePartB-abc.42.mcz'' ) do: > + [:each| (Installer repository: ''http://www.squeaksource.com/MyPackages'') install: each]'! > > Item was changed: > ----- Method: SMReleaseBrowser>>loadScript (in category 'model access') ----- > loadScript > "The Smalltalk code needed to install this release of this package." > + ^ loadScript > + ifNil: [| scriptName | > + scriptName := release downloadFileName. > + loadScript := scriptName isEmptyOrNil > + ifFalse: [(scriptName asLowercase endsWith: '.st') > + ifTrue: [release contents]] > + ifTrue: [self exampleLoadScript]]! > - ^ loadScript ifNil: > - [ | scriptName | > - scriptName := release downloadFileName. > - loadScript := scriptName isEmptyOrNil ifFalse: > - [ (scriptName asLowercase endsWith: '.st') ifTrue: [ release contents ] ] ]! > > Item was changed: > ----- Method: SMReleaseBrowser>>validateCanSave (in category 'private') ----- > validateCanSave > + "accept any changes in the text field morphs etc, then validate the input as best we can" > + self changed: #acceptChanges. > self username isEmptyOrNil ifTrue: [ self userError: 'username required' ]. > self note isEmptyOrNil ifTrue: [ self userError: 'note required' ]. > self version isEmptyOrNil > ifTrue: [ self userError: 'version required' ] > ifFalse: > [ (self version includes: $+) ifTrue: [ self userError: 'Plus sign not allowed in version name because it is reserved by HTTP.' ] ]! > > |
Free forum by Nabble | Edit this page |