Skip to content

Iceberg actions to export Trait based classes flattened into traitless classes

License

Notifications You must be signed in to change notification settings

eMaringolo/pharo-tonel-traitless

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

This package will add an Iceberg action to create a repository branch in which all the classes using Traits will be flattened.

This of course will introduce code duplication, but it is useful to export libraries to be used in Smalltalk dialects that doesn't have Trait support.

This will flatten the the methods of the traits into their users as well as the slots of stateful traits as instance variables of the classes that uses them.

Installation

Load the package

Metacello new
	repository: 'github://emaringolo/pharo-tonel-traitless:master/src';
	baseline:'TonelTraitless';
	load.

Adding the menu

I don't know of a dynamic way of registering the command into the repositories browser, so you have to modify the menu builder adding the command explicitly.

IceTipRepositoriesBrowser class>>#buildSelectionExtraCommandGroupWith: presenter for: aCommandGroup
    super buildSelectionExtraCommandGroupWith: presenter for: aCommandGroup.
    {       IceTipCalculateDirtyPackagesCommand.
            IceTipCopyCommitishCommand.
            IceTipOpenNativelyCommand.
            IceFlattenTraitsRepositoryCommand "<< ADD THIS"
    } do: [ :each | aCommandGroup register: each forSpec ]

How to use it

On a clean repository, open the alternate menu and in the Extra menu you'll find an option named Flatten source of traits...

Iceberg menu screenshot

This will create a new branch named traitless and commit the flattened version in that branch.

About

Iceberg actions to export Trait based classes flattened into traitless classes

Topics

Resources

License

Stars

Watchers

Forks