On Thu, Sep 15, 2011 at 2:40 PM, Dimitry Golubovsky <[email protected]>wrote:

> Hi,
>
> Martin Dias wrote:
>
> > About Fuel ... Hopefully we might be capable of doing that in some
> months...
> > at the moment you can find some limitations, especially if you were using
> > DiskProxy (do you?).
>
> I am not sure if I use DiskProxy. Since I was constrained to use an
> oldish 3.9 image, I had to find what worked through some experiments.
>
> What I use now (maybe that looks ugly these days, but works the way I
> need):
>
> To save the current status of the application:
>
>
> "---------------------------------------------------------------------------------------------------------------------"
> Project current storeOnServerInnards.
>
> "---------------------------------------------------------------------------------------------------------------------"
>
> This bypasses the dialog that asks for saved project file name and
> location, and just saves a new version of project file in the
> directory of the image file, and in the Squeaklets directory
> underneath.
>
> Versioning is important for me because if something goes wrong during
> the saving of a project I can simply load a previous version manually.
>
> To load the last saved version of the project with given name:
>
>
> "---------------------------------------------------------------------------------------------------------------------"
> loadProject: aString
>        "load a project from a file whose name is like XXX.nnn.pr from the
> default
>         directory where XXX are letters, and nnn are numbers. A project
> with the
>         highest version will be loaded"
>        | files dir |
>        dir := FileDirectory default.
>        files := (dir fileNames select: [ :fn | | prts |
>                prts := fn findBetweenSubStrs: '.'.
>                ((prts size = 3) and: [(prts at: 1) = aString & (prts at: 3)
> = 'pr'] ).
>        ]) asOrderedCollection sort: [ :e1 :e2 | | en1 en2 |
>                en1 := (e1 findBetweenSubStrs: '.') at: 2.
>                en2 := (e2 findBetweenSubStrs: '.') at: 2.
>                (en1 asInteger) > (en2 asInteger).
>        ].
>        ^files ifNotEmpty: [
>                ProjectLoading openFromDirectory: dir andFileName: (files
> at: 1).
>                Smalltalk garbageCollect.
>        ] ifEmpty: [ nil ].
>
> "---------------------------------------------------------------------------------------------------------------------"
>
> so that's ProjectLoading openFromDirectory:andFileName:
>
>
So...all the above can be replaced by Fuel by using the methods provided by
it:

  aFileStream := (StandardFileStream fileNamed: ('whatever') ) binary.
  serializer := FLSerializer on: aFileStream.
  serializer serialize: aMethod.
  aFileStream close.

And to load:

        aFileStream := (StandardFileStream fileNamed: ('whatever')) binary.
        materializer := FLMaterializer on: aFileStream.
        materializer materialize.

What it is important is to know whether you are using specific hooks of IS
or not. If you do not use special hooks in Fuel, then all the transitive
closure from the Porject instance will be serialized.



> I am not saving any code, only data. But if Fuel provided a way to
> overlay application-specific code over the generic image, this way of
> binary deployment would be very convenient.
>

Yes, "Fuel" *would* provide a way to manage code. I won't be Fuel, but a
tool build on top of Fuel. Fuel is just a plain serializer. On top of that,
we have started to prototype a code exporter/loader.
So far, you can see what it is in the package FuelPackageLoader. We could
export Seaside and load it in a clean image. It took less than 15 seconds :)
But...be aware we are not taking into account/doing a lot of stuff that
Monticello does, like:
- System notifications
- Validations
- Recompilations
-Conflicts with classes already present in the image where we load
-others

We do not use the ClassBuilder but instead we create an instance of Class by
hand and we set and initialize all the required stuff. Once we can have a
clean and nice ClassBuilder we would like to add notifications, validations,
etc.



> Especially given the tablet's CPU is very slow, loading large mcz's
> from Monticello repos and compiling them may take terrible time.
>

Exactly!


>
> Thanks.
>
> PS Saving methods did not work in the old Squeak image anyway... Even on a
> PC.
>
> --
> Dimitry Golubovsky
>
> Anywhere on the Web
>



-- 
Mariano
http://marianopeck.wordpress.com

Reply via email to