On 13 Aug 2011, at 09:06, Lukas Renggli wrote:
On 12 August 2011 23:32, Damien Pollet <damien.pollet@gmail.com> wrote:
On 12 August 2011 22:21, Lukas Renggli <renggli@gmail.com> wrote:
The only solution is to stick with consistent and well though package name scheme. Not the only possible naming strategy, but the one we developed for Seaside works pretty well: http://code.google.com/p/seaside/wiki/PackageNaming
I know about these conventions, but how do I proceed towards them? :)
Closing the eyes and restarting from scratch. We did that too with the Seaside packages at some point.
We did the same for Moose. We kind of followed this process: 1. create new sub-package XYZ-Sub* 2. move classes from XYZ to XYZ-Sub* 3. repeat until all classes and extensions from XYZ are moved away to subpackages 4. add the Monticello repository to XYZ-Sub* 5. commit all XYZ-Sub* packages. Make sure that there are no categories without packages left behind (in other words to not lose code) 6. save the image 7. load in a fresh image 8. if problems appear, and they always appear because it is manual work, go to the previous image and recommit A useful script for renaming a package that ensures also that extensions get renamed: renamePackage: oldPackageName to: newPackageName "self renamePackage: 'Seaside-Squeak-Development-Core' to: 'Seaside-Pharo-Development-Core'" | oldPackage newPackage oldWorkingCopy newWorkingCopy | oldPackage := PackageInfo named: oldPackageName. newPackage := PackageInfo named: newPackageName. " rename system categories " oldPackage systemCategories do: [ :oldCategory | | newCategory | newCategory := oldCategory allButFirst: oldPackage systemCategoryPrefix size. Smalltalk organization renameCategory: oldCategory toBe: newPackage systemCategoryPrefix , newCategory ]. " rename method categories " oldPackage extensionClasses do: [ :extensionClass | (oldPackage extensionCategoriesForClass: extensionClass) do: [ :oldProtocol | | newProtocol | newProtocol := oldProtocol allButFirst: oldPackage methodCategoryPrefix size. extensionClass organization renameCategory: oldProtocol toBe: newPackage methodCategoryPrefix , newProtocol ] ]. " update monticello packages " oldWorkingCopy := MCWorkingCopy forPackage: (MCPackage named: oldPackageName). newWorkingCopy := MCWorkingCopy forPackage: (MCPackage named: newPackageName). newWorkingCopy repositoryGroup: oldWorkingCopy repositoryGroup; modified: true. " test is all methos have been caught " oldPackage methods isEmpty ifTrue: [ oldWorkingCopy unload. PackageOrganizer default unregisterPackage: oldPackage ] ifFalse: [ self error: 'Some code entities remain in the old package, please migrate manually.' ] Cheers, Doru
Lukas
-- Lukas Renggli www.lukas-renggli.ch
-- www.tudorgirba.com "Problem solving should be focused on describing the problem in a way that makes the solution obvious."