Pharo 8 - Programmatic Refactoring

Refactorings describes how to refactor code using the GUI. But if you want to programmatically refactor the API is either not intuitive (to me) or a little inconsistent.

So here’s a few notes that did the job for me. There are probably better ways to go about this…

Move a method to another package

(SycMoveMethodsToPackageCommand
	for: aCollectionOfMethods
	to: aDestinationPackage) 
		execute

Move a class to another package

aClass category: aPackageNameString

The destination package name can include tags, e.g. 'Collections-Atomic-Base'.

Rename a class or trait

(SycRenameClassCommand new 
	targetClass: aClass;
	newName: aNewNameSymbol)
		execute
Categories: Pharo   Iceberg   Pharo8
Written on February 11, 2020