Hi offray Thanks but pillar ha a conf since several years and it is working well. Now I'm revisiting the implementation of cocoon because I want to have it simpler independent of magritte and better tested.
Now I just want to add a new functionality to output a configuration file from the objects and in Pillar the configuration objects hold more complex ***objects***. So just taking the object and turning it in ston does not work. Stef On Mon, Jun 5, 2017 at 6:23 PM, Offray Vladimir Luna Cárdenas < offray.l...@mutabit.com> wrote: > Hi, > > Maybe what I'm doing in Grafoscopio could help. > > I have a %metadata node which contains all configuration options for the > production of the document (as shown in the image below). Exporting a > document consist in looking for these nodes while traversing the notebook > tree and applying that options in the proper place. You can see the source > code of the current notebook STON file at [1], the exported markdown file > at [2] and the exported PDF at [3]. As you can see I have pretty good > control of the configuration of the document using this option (and a > single place to manage all, without endless small files and folders for a > document, but event that exporting options as split folders and docs, could > be added also). > [1] http://mutabit.com/repos.fossil/grafoscopio/artifact/fb25442038a0d4a1 > [2] http://mutabit.com/repos.fossil/grafoscopio/artifact? > name=59245142cf93590b&txt=1 > [3] http://mutabit.com/repos.fossil/grafoscopio/doc/tip/ > Docs/En/Books/Manual/manual.pdf > > > > Cheers, > > Offray > > > On 05/06/17 01:58, Stephane Ducasse wrote: > > Sven I know what Ston is :) > > Now Pillar dev used Ston as input and it works. Then with some hooks they > let the user convert the strings > into specific objects and this is ok. > Now I want to add export in Ston and for configurations I need to control > for the application and not as a ston object the value saved. > For example a file reference should not be just a file reference in Ston > but > a string relative the the baseDirectory of the configuration. > > So I thought that I can build a hook and control the call to Ston (convert > the object before to the correct values) and export. > It should be working now doing this I found myself redoing the output of > Ston. > So I will do it. Then I thought that may be I could reuse this logic. > > Stef > > > > On Sun, Jun 4, 2017 at 11:49 PM, Sven Van Caekenberghe <s...@stfx.eu> > wrote: > >> 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). >> > >> >> >> > >