diff --git a/README.md b/README.md index ece0b9d..9675007 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ The Pharo 13 surface currently provides: - `RePullUpInstanceVariableRefactoring` mapped to the available pull-up refactoring class. - `FileStream` mapped to the available standard I/O class when needed. - `IceBranchAlreadyExists` mapped to `IceBranchAlreadyExistsError` when needed. +- `EpMonticelloVersionSave` and `EpMonticelloVersionsLoad` on Pharo 14. - `MetacelloProjectRegistry>>registrationForClassNamed:ifAbsent:` on Pharo 14. - A Pharo 13-compatible `ReClassRepackagingChange>>generateChanges` behavior on Pharo 14. diff --git a/src/PharoCompatibility-Pharo13Surface-Pharo14-Tests/PharoCompatibilityP13SurfacePharo14Test.class.st b/src/PharoCompatibility-Pharo13Surface-Pharo14-Tests/PharoCompatibilityP13SurfacePharo14Test.class.st index 3503c84..403a36f 100644 --- a/src/PharoCompatibility-Pharo13Surface-Pharo14-Tests/PharoCompatibilityP13SurfacePharo14Test.class.st +++ b/src/PharoCompatibility-Pharo13Surface-Pharo14-Tests/PharoCompatibilityP13SurfacePharo14Test.class.st @@ -41,6 +41,21 @@ PharoCompatibilityP13SurfacePharo14Test >> testInstallPharo13SurfaceProvidesLega equals: (Smalltalk at: #IceBranchAlreadyExistsError) ] +{ #category : 'tests' } +PharoCompatibilityP13SurfacePharo14Test >> testInstallPharo13SurfaceProvidesMonticelloEpiceaEvents [ + + | loadEvent saveEvent | + PharoCompatibility installPharo13Surface. + self assert: (Smalltalk includesKey: #EpMonticelloVersionSave). + self assert: (Smalltalk includesKey: #EpMonticelloVersionsLoad). + saveEvent := EpMonticelloVersionSave versionName: 'Example-Core.42' repositoryDescription: 'repository'. + loadEvent := EpMonticelloVersionsLoad versionNames: #( 'Example-Core.42' 'Example-Spec.7' ). + self assert: saveEvent isMonticelloVersionSave. + self assert: loadEvent isMonticelloVersionsLoad. + self assert: saveEvent affectedPackageName equals: 'Example'. + self assert: loadEvent affectedPackageName equals: 'Example' +] + { #category : 'tests' } PharoCompatibilityP13SurfacePharo14Test >> testMetacelloRegistryUnderstandsRegistrationForClassNamed [ diff --git a/src/PharoCompatibility-Pharo13Surface-Pharo14/EpMonticelloVersionSave.class.st b/src/PharoCompatibility-Pharo13Surface-Pharo14/EpMonticelloVersionSave.class.st new file mode 100644 index 0000000..dd51c65 --- /dev/null +++ b/src/PharoCompatibility-Pharo13Surface-Pharo14/EpMonticelloVersionSave.class.st @@ -0,0 +1,97 @@ +" +I represent a Monticello ""Save Version"" operation from the Pharo 13 Epicea surface. +" +Class { + #name : 'EpMonticelloVersionSave', + #superclass : 'EpEvent', + #instVars : [ + 'versionName', + 'repositoryDescription' + ], + #category : 'PharoCompatibility-Pharo13Surface-Pharo14-Epicea', + #package : 'PharoCompatibility-Pharo13Surface-Pharo14', + #tag : 'Epicea' +} + +{ #category : 'instance creation' } +EpMonticelloVersionSave class >> version: aMCVersion repository: aMCRepository [ + + ^ self versionName: aMCVersion info name repositoryDescription: aMCRepository description +] + +{ #category : 'instance creation' } +EpMonticelloVersionSave class >> versionName: aVersionName repositoryDescription: aRepositoryDescription [ + + ^ self basicNew + initializeWithVersionName: aVersionName repositoryDescription: aRepositoryDescription; + yourself +] + +{ #category : 'comparing' } +EpMonticelloVersionSave >> = another [ + + ^ self class = another class and: [ + self versionName = another versionName and: [ self repositoryDescription = another repositoryDescription ] ] +] + +{ #category : 'visitor' } +EpMonticelloVersionSave >> accept: aChangeVisitor [ + + ^ aChangeVisitor visitMonticelloVersionSave: self +] + +{ #category : 'accessing' } +EpMonticelloVersionSave >> affectedPackageName [ + + ^ self packageName +] + +{ #category : 'comparing' } +EpMonticelloVersionSave >> hash [ + + ^ (self class hash bitXor: self versionName hash) bitXor: self repositoryDescription hash +] + +{ #category : 'initialization' } +EpMonticelloVersionSave >> initializeWithVersionName: aVersionName repositoryDescription: aRepositoryDescription [ + + self initialize. + versionName := aVersionName. + repositoryDescription := aRepositoryDescription +] + +{ #category : 'testing' } +EpMonticelloVersionSave >> isMonticelloVersionSave [ + + ^ true +] + +{ #category : 'accessing' } +EpMonticelloVersionSave >> packageName [ + + ^ versionName copyUpToLast: $- +] + +{ #category : 'printing' } +EpMonticelloVersionSave >> printOn: aStream [ + + super printOn: aStream. + aStream + nextPut: $(; + nextPutAll: repositoryDescription; + nextPut: $/; + nextPutAll: versionName; + nextPut: $) +] + +{ #category : 'accessing' } +EpMonticelloVersionSave >> repositoryDescription [ + + ^ repositoryDescription +] + +{ #category : 'accessing' } +EpMonticelloVersionSave >> versionName [ + + ^ versionName +] diff --git a/src/PharoCompatibility-Pharo13Surface-Pharo14/EpMonticelloVersionsLoad.class.st b/src/PharoCompatibility-Pharo13Surface-Pharo14/EpMonticelloVersionsLoad.class.st new file mode 100644 index 0000000..9b917e9 --- /dev/null +++ b/src/PharoCompatibility-Pharo13Surface-Pharo14/EpMonticelloVersionsLoad.class.st @@ -0,0 +1,83 @@ +" +I represent a Monticello ""Load Versions"" operation from the Pharo 13 Epicea surface. +" +Class { + #name : 'EpMonticelloVersionsLoad', + #superclass : 'EpEvent', + #instVars : [ + 'versionNames' + ], + #category : 'PharoCompatibility-Pharo13Surface-Pharo14-Epicea', + #package : 'PharoCompatibility-Pharo13Surface-Pharo14', + #tag : 'Epicea' +} + +{ #category : 'instance creation' } +EpMonticelloVersionsLoad class >> versionNames: aCollectionOfVersionNames [ + + ^ self basicNew + initializeWith: aCollectionOfVersionNames; + yourself +] + +{ #category : 'instance creation' } +EpMonticelloVersionsLoad class >> versions: aCollectionOfVersions [ + + ^ self versionNames: (aCollectionOfVersions collect: [ :version | version info name ]) +] + +{ #category : 'comparing' } +EpMonticelloVersionsLoad >> = anObject [ + + ^ self class = anObject class and: [ self versionNames = anObject versionNames ] +] + +{ #category : 'visitor' } +EpMonticelloVersionsLoad >> accept: aChangeVisitor [ + + ^ aChangeVisitor visitMonticelloVersionsLoad: self +] + +{ #category : 'accessing' } +EpMonticelloVersionsLoad >> affectedPackageName [ + + ^ self packageNames first +] + +{ #category : 'comparing' } +EpMonticelloVersionsLoad >> hash [ + + ^ self class hash bitXor: self versionNames hash +] + +{ #category : 'initialization' } +EpMonticelloVersionsLoad >> initializeWith: aCollectionOfVersionNames [ + + self initialize. + versionNames := aCollectionOfVersionNames +] + +{ #category : 'testing' } +EpMonticelloVersionsLoad >> isMonticelloVersionsLoad [ + + ^ true +] + +{ #category : 'accessing' } +EpMonticelloVersionsLoad >> packageNames [ + + ^ versionNames collect: [ :each | each copyUpToLast: $- ] +] + +{ #category : 'printing' } +EpMonticelloVersionsLoad >> printOn: aStream [ + + super printOn: aStream. + versionNames printElementsOn: aStream +] + +{ #category : 'accessing' } +EpMonticelloVersionsLoad >> versionNames [ + + ^ versionNames +]