Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emaringolo/pharo-tonel-traitless
Iceberg actions to export Trait based classes flattened into traitless classes
https://github.com/emaringolo/pharo-tonel-traitless
pharo portability smalltalk tonel
Last synced: 16 days ago
JSON representation
Iceberg actions to export Trait based classes flattened into traitless classes
- Host: GitHub
- URL: https://github.com/emaringolo/pharo-tonel-traitless
- Owner: eMaringolo
- License: mit
- Created: 2022-07-01T14:09:09.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-01T14:54:40.000Z (over 2 years ago)
- Last Synced: 2024-10-09T13:25:09.456Z (about 1 month ago)
- Topics: pharo, portability, smalltalk, tonel
- Language: Smalltalk
- Homepage:
- Size: 99.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 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
```Smalltalk
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.
```Smalltalk
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](img/iceberg_screenshot.png)
This will create a new branch named `traitless` and commit the flattened version in that branch.