Stef,

STON is like FUEL, it can write any object to a stream and read it back. 
Although you can customise how this is done, only one way of doing so is 
supported (i.e. you cannot change the format for each application).

People have used STON for various applications now, including for configuration 
stuff (because it is a textual format that is easy to read).

I would suggest you just try to see what your config looks like once you have 
the objects in Pharo.

  STON toStringPretty: myConfig.

Then we can see how to tune the representation.

Sven

> On 4 Jun 2017, at 22:58, Stephane Ducasse <stepharo.s...@gmail.com> wrote:
> 
> Hi sven
> 
> I'm working on a new configuration frameworks similar to the one use 
> pillar.conf.
> 
> So basically I have 
> 
> ston := '{
>            "newLine":#unix,
>               "separateOutputFiles":true
>               }'.
> and I want to recreate it. 
> 
> So I did 
> 
> Object >> toConfigurationString
> 
>       ^ STON toString: self 
> 
> SimpleConfiguration >> exportStream
> 
>       ^ String streamContents: [ :str |
>               str << '{' .
>               self propertiesKeysAndValuesDo: [ :key :value|
>                       str << key toConfigurationString.
>                       str << ':'.
>                       str << value toConfigurationString.
>                       str << ','.
>                       str lf.  
>                       ].
>               str << '}'.
>               str contents 
>               ]
> 
> The idea is that for special configuration values people should be able to 
> define 
> how to go from the object to configuration. 
> For example for some FileReference I want to have just the path up to the 
> baseDirectory. 
> 
> Now I wonder if I could not better reuse ston. 
> I saw the stonOn: 
> but I did not look further because I was wondering how the writer where 
> passed.
> 
> Any feedback is welcome. 
> 
> Stef (now bed time).
> 


Reply via email to