Skip to content

Commit

Permalink
Merge pull request #469 from krono/squeak-platformattributes
Browse files Browse the repository at this point in the history
[Squeak] generalize defaultPlatformAttributes
  • Loading branch information
krono authored Nov 8, 2017
2 parents 67d4314 + 70f65aa commit 35ec6fb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
attributes
defaultPlatformAttributes
| attributes |
| attributes systemVersion major minor both |
attributes := OrderedCollection with: #squeakCommon with: #squeak.
Smalltalk
at: #SystemVersion
ifPresent: [:cl | |versionString|
versionString := cl current version asString.
" Major version "
#( 'Squeak3.10' (#'squeak3.10.x' ())
'Squeak4' (#'squeak4.x' (
'Squeak4.1' #'squeak4.1.x'
'Squeak4.2' #'squeak4.2.x'
'Squeak4.3' #'squeak4.3.x'
'Squeak4.4' #'squeak4.4.x'
'Squeak4.5' #'squeak4.5.x'
'Squeak4.6' #'squeak4.6.x'))
'Squeak5' (#'squeak5.x' (
'Squeak5.0' #'squeak5.0.x')))
pairsDo: [:major :allAttributes |
(versionString beginsWith: major) ifTrue: [
attributes add: allAttributes first.
allAttributes second ifNotEmpty: [:minorVersions |
minorVersions pairsDo: [:minor :attribute |
(versionString beginsWith: minor) ifTrue: [
attributes add: attribute.
^ attributes]]]]]].
systemVersion := (Smalltalk at: #SystemVersion ifPresent: [:cl | cl current])
ifNil: [^ attributes "get out early if we don't know about this verison"].
both := systemVersion majorMinorVersion readStream.
[both peek isDigit] whileFalse: [both next].

major := both upTo: $..
minor := both upToEnd.
attributes
add: ('squeak', major, '.x') asSymbol;
add: ('squeak', major, '.', minor, '.x') asSymbol.
(systemVersion version endsWith: 'alpha')
ifTrue: ["For alphas it is sensible to pretend to be the previous version,
so that things can be tested and then moved forward."
minor ~= '0'
ifTrue:
["easy" attributes add: ('squeak', major, '.', (minor asInteger - 1) asString, '.x') asSymbol]
ifFalse:
[" well we would have to guess the previous release for 'big jumps' here,
so for now use a list of known jumps or roll down to 10 "
| priorVersion priorMajor |
priorMajor := major asInteger - 1.
priorVersion := #(('1' '1.31') ('2' '2.8') ('3' '3.10') ('4' '4.5' "on purpose NOT 4.6") ('5' '5.1'))
at: priorMajor ifAbsent: [{priorMajor asString . priorMajor asString, '.10'}].
attributes
add: ('squeak', priorVersion first, '.x') asSymbol;
add: ('squeak', priorVersion second, '.x') asSymbol]].
^ attributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"collection:do:displaying:" : "dkh 6/12/2012 10:18:46.076",
"copyClass:as:inCategory:" : "dkh 6/12/2012 10:18:46.076",
"createRepository:" : "dkh 6/12/2012 10:18:46.076",
"defaultPlatformAttributes" : "pad 8/21/2015 09:57",
"defaultPlatformAttributes" : "topa 11/8/2017 01:17",
"directoryFromPath:relativeTo:" : "tfel 7/29/2014 14:39",
"do:displaying:" : "dkh 6/12/2012 10:18:46.076",
"downloadJSON:eTagsCache:eTagsKey:username:pass:" : "topa 9/21/2017 14:03",
Expand Down
Loading

0 comments on commit 35ec6fb

Please sign in to comment.