Hi Stephan

2016-08-29 14:16 GMT-03:00 Stephan Eggermont <step...@stack.nl>:

> On 26/08/16 18:49, Hernán Morales Durand wrote:
>
>> Is not fully tested but here is how you install it:
>>
>> Gofer it
>>     smalltalkhubUser: 'hernan' project: 'CodeGenerator';
>>     configuration;
>>     loadDevelopment.
>>
>> CGSmalltalkExamples exampleNSISPharo4.
>> CGSmalltalkExamples exampleNSISPharo5.
>>
>> It will generate a .nsi file in image directory.
>>
>>
> Thanks Hernán.
> Could you tell us something more about the CodeGenerator
> that you created it with? For someone new to NSIS there
> are a lot of moving parts like this.
>

This will be properly documented in the future. But here I go with some
basic notes.
The idea is to have a very modular hierarchy of code generation
capabilities. There is a very basic generator for QC Magritte ;) but I
hadn't the time for testing or complete yet
A description of hierarchy classes is

-CGAbstract (Provides code stream)
--CGTemplate (Utility class for extracting template methods from classes -
in the sense of a Template framework, not design patterns)
---CGAuthoring (Provides identity management)
----CGBash (Bash code generator)
----CGNSISInstaller (Unicode NSIS Installer Script (.nsi) Generator,
requires Mustache Templates and ZipDLL.nsh plugin installed)
----CGSmalltalkAuthoring (Abstract Smalltalk code generator providing
author management - not the same as identity)

- CGStConvenienceMethods (Smalltalk Code Generator based in the pattern
Convenience Methods (1998) by Robert Hirschfeld)
- CGStAbstractClassPattern (Smalltalk Code Generator based in the Abstract
Class Pattern by Bobby Woolf.)
- CGStBuilderPattern (Builder Design Pattern - I don't remember the status
of this one, I should check)

- CGStHierarchyCreator (Smalltalk Code Generator to generate a class
hierarchy)
- CGStMagritte
- CGQCMagritte (Seaside QC Magritte Generator)
- CGQCBMagritte (Seaside QC Magritte + Bootstrap) Generator

- CGStImageImporter (Scans an input directory and uses ImageReadWriter to
read binary file streams)
- CGStTextImporter (Same for textual resources)

- CGStSingleton (Generates a Singleton in Smalltalk)
- CGSunit (SUnit Tests Generator)

- CGStSpec (To be implemented)

These are examples of how to generate code:

Simple class and variables:

    CGSmalltalk uniqueInstance
        setCleanTarget;
        targetClassCategory: 'MPIRunner-Core';
        targetClass: #MPIRunner;
        addInstanceVariables: #(#nproc #submitToQueue).

Convenience methods

    CGStConvenienceMethods uniqueInstance
        setCleanTarget;
        parameterCount: 1;
        targetSelector: #cgConvEx1;
        targetClassCategory: 'ConvenienceMethodsEx';
        targetClass: #ConvenienceMethodsEx;
        generateMethods.

Singleton

    CGStSingleton uniqueInstance
        setCleanTarget;
        targetClassCategory: 'SingletonEx1';
        targetClass: #SingletonEx1;
        generateMethods.

Builder

    CGStBuilderPattern uniqueInstance
        setCleanTarget;
        targetClassCategory: 'CGGeneratedCode-Core';
        " Abstract Builder class name (ex: UIBuilder) "
        targetClass: #CGExCarBuilder;
        productNames: #('CGExFordCar' 'CGExBMWCar' 'CGExHondaCar');
        builderNames: #('CGExFordBuilder' 'CGExBMWBuilder'
'CGExHondaBuilder');
        familyNames: #('CGExCarEngine' 'CGExCarBody');
        " How many product parts per family ? "
        productPartsPerFamilyCount: 3;
        directorClassName: #CGExCarAssembler;
        generateClasses.




> It would be great to have an example that is complete
> and compiles out of the box. Good target for a screencast
> also (for me they work very well for improved community
> communication).
>
>
I would love to have more time :)

Hernán



> Stephan
>
>
>
>

Reply via email to