Skip to content

Commit

Permalink
Move GToolkit-PharoMigrations to releaser [feenkcom/gtoolkit#3736]
Browse files Browse the repository at this point in the history
  • Loading branch information
chisandrei committed May 15, 2024
1 parent d2cb0e8 commit cb6dd28
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ BaselineOfGToolkitReleaser >> baseline: spec [
baseline: 'Beacon' with: [
spec repository: 'github://feenkcom/pharo-beacon/repository' ].
spec
package: 'GToolkit-Releaser-BaselineModel';
package: 'GToolkit-PharoMigrations';
package: 'GToolkit-Releaser-BaselineModel' with: [
spec requires: #('GToolkit-PharoMigrations'). ];
package: 'GToolkit-Releaser' with: [
spec requires: #('GToolkit-Releaser-BaselineModel' ). ];
package: 'GToolkit-Releaser-IcebergExtensions' with: [
Expand Down
82 changes: 82 additions & 0 deletions src/GToolkit-PharoMigrations/Object.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Extension { #name : #Object }

{ #category : #'*GToolkit-PharoMigrations' }
Object >> forPharo11: pharo11Block forPharo10: pharo10Block [
"Evaluate one of the blocks based on the pharo's major version"
| unsupportedVersionBlock |

unsupportedVersionBlock := [
self error: 'Unsupported pharo version: ',SystemVersion current major asString ].

^ self
forPharo12: unsupportedVersionBlock
forPharo11: pharo11Block
forPharo10: pharo10Block
newer: unsupportedVersionBlock
older: unsupportedVersionBlock
]

{ #category : #'*GToolkit-PharoMigrations' }
Object >> forPharo11AndPharo12: pharo11AndPharo12Block forPharo10: pharo10Block [
"Evaluate one of the blocks based on the pharo's major version"
| unsupportedVersionBlock |

unsupportedVersionBlock := [
self error: 'Unsupported pharo version: ',SystemVersion current major asString ].

^ self
forPharo12: pharo11AndPharo12Block
forPharo11: pharo11AndPharo12Block
forPharo10: pharo10Block
newer: unsupportedVersionBlock
older: unsupportedVersionBlock
]

{ #category : #'*GToolkit-PharoMigrations' }
Object >> forPharo11OrNewer: pharo11OrNewerBlock forPharo10: pharo10Block [
"Evaluate one of the blocks based on the pharo's major version"
| unsupportedVersionBlock |

unsupportedVersionBlock := [
self error: 'Unsupported pharo version: ',SystemVersion current major asString ].

^ self
forPharo12: pharo11OrNewerBlock
forPharo11: pharo11OrNewerBlock
forPharo10: pharo10Block
newer: pharo11OrNewerBlock
older: unsupportedVersionBlock
]

{ #category : #'*GToolkit-PharoMigrations' }
Object >> forPharo12: pharo12Block forPharo11: pharo11Block forPharo10: pharo10Block [
"Evaluate one of the blocks based on the pharo's major version"
| unsupportedVersionBlock |

unsupportedVersionBlock := [
self error: 'Unsupported pharo version: ',SystemVersion current major asString ].

^ self
forPharo12: pharo12Block
forPharo11: pharo11Block
forPharo10: pharo10Block
newer: unsupportedVersionBlock
older: unsupportedVersionBlock
]

{ #category : #'*GToolkit-PharoMigrations' }
Object >> forPharo12: pharo12Block forPharo11: pharo11Block forPharo10: pharo10Block newer: newerBlock older: olderBlock [
"Evaluate one of the blocks based on the pharo's major version"

SystemVersion current major > 12
ifTrue: [ ^ newerBlock value ].

SystemVersion current major = 12
ifTrue: [ ^ pharo12Block value ].
SystemVersion current major = 11
ifTrue: [ ^ pharo11Block value ].
SystemVersion current major = 10
ifTrue: [ ^ pharo10Block value ].

^ olderBlock value
]
1 change: 1 addition & 0 deletions src/GToolkit-PharoMigrations/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'GToolkit-PharoMigrations' }
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ GtRlDependenciesModelBuilder >> updateProjectDependenciesFor: currentProject fro
forPharo11: [ aMetacelloProjectSpec version ]
forPharo10: [ aMetacelloProjectSpec version ].
shouldKeep := targetVersion notNil
and: [ targetVersion first name = 'baseline' ].
and: [ targetVersion name = 'baseline' ].

shouldKeep ifFalse: [ StringSignal
emit: ('Ignoring dependency ' , aMetacelloProjectSpec className , ' of ', currentProject name) ].
Expand Down

0 comments on commit cb6dd28

Please sign in to comment.