Gofer broke?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Gofer broke?

John McKeon
I'm sure it is probably not but I couldn't resist the pun...
I wrote a small Gofer script (attached) which does what I need except I was surprised that class initializations appear to occur in the reverse order in which the packages are loaded? The script loads PostgresV2, ROE, Magritte-Roe and, my favorite bit of contributed code, Moe.

The problem is that Magritte-Roe attempts to connect to PostgreSQL before meaningful connection arguments can be entered, so it bombs out. This causes all of the remaining initializations not to execute, which leaves PostgresV2 unable to connect at all until PGPacket is manually initialized.

So I added a bit of code to MAConnectionPool's initialization to prompt for the correct arguments to be entered before MAConnectionPool attempts to startup. It is a bit ugly, using a half a dozen FillInTheBlankMorphs to get the required info. Before doing it that way, I added Magritte descriptions to PGConnectionArgs so as to bring up a nice morphic dialog (see MAConnectionPool class>>initializeConnectionArgsMorphic), but two problems with that are: 
1) Magritte-Morphic is not loaded in the standard Pharo 1.0 image? (I guess I could add that to the Gofer script)
2) I can't get an answer from the resulting dialog

All of this is in the latest version of Magritte-Roe in the repository. If anyone cares to take a look at my morphic dialog code, I would welcome any advice.

Thanks in advance

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki

MoeInstall.st (614 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Gofer broke?

Lukas Renggli
> I wrote a small Gofer script (attached) which does what I need except I was
> surprised that class initializations appear to occur in the reverse order in
> which the packages are loaded?

Yeah, that's annoying, but it is not the fault of Gofer. Monticello
(and for that matter also change-sets or file-ins) always executed
initializers in an arbitrary (alphabetical) order (or not at all, if
the code didn't change).

I could probably hack that the initializers of the packages would be
evaluated in the right order, but inside the package that would be
still random. So I don't know if this is worth the trouble?

For know, the issue you report is a bug in your package. You have to
write the initializers so that they work in any order.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Gofer broke?

Mariano Martinez Peck
In reply to this post by John McKeon


On Sat, Jan 30, 2010 at 5:06 AM, John McKeon <[hidden email]> wrote:
I'm sure it is probably not but I couldn't resist the pun...
I wrote a small Gofer script (attached) which does what I need except I was surprised that class initializations appear to occur in the reverse order in which the packages are loaded? The script loads PostgresV2, ROE, Magritte-Roe and, my favorite bit of contributed code, Moe.

The problem is that Magritte-Roe attempts to connect to PostgreSQL before meaningful connection arguments can be entered, so it bombs out. This causes all of the remaining initializations not to execute, which leaves PostgresV2 unable to connect at all until PGPacket is manually initialized.

So I added a bit of code to MAConnectionPool's initialization to prompt for the correct arguments to be entered before MAConnectionPool attempts to startup. It is a bit ugly, using a half a dozen FillInTheBlankMorphs to get the required info. Before doing it that way, I added Magritte descriptions to PGConnectionArgs so as to bring up a nice morphic dialog (see MAConnectionPool class>>initializeConnectionArgsMorphic), but two problems with that are: 
1) Magritte-Morphic is not loaded in the standard Pharo 1.0 image? (I guess I could add that to the Gofer script)

No.
 
2) I can't get an answer from the resulting dialog


John: have you considered creating your own Metacello configuration for your project?  I will enable you to load very easily all your stuff in a core/dev image without problems, using stable versions, automatically resolving dependencies, etc.
I think that maybe, the Metacello pre and post doits may help you. You should not put your code in your class side initialize methods, but in those post do its. Then you can have pre and post do its at package and project level.
There is also a parameter in the Metacello called #loadType: which default is linear. But maybe the #atomic may help you. I am not sure.
Just in case you are interested in, I suggest you to read the metacello image based tutorial (no more than an hour) and if you have questions there is a mailing list where you can ask.

Link: http://code.google.com/p/metacello/wiki/Tutorial

Good luck.

Mariano

Cheers

 
All of this is in the latest version of Magritte-Roe in the repository. If anyone cares to take a look at my morphic dialog code, I would welcome any advice.

Thanks in advance

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Gofer broke?

John McKeon
Thank you both. The little tidbit about alphabetical order explains everything.
I will check out Metacello as well Mariano. Thanks for the link. For now I just split the Gofer script into two loads so that PostgresV2 initializes first.
I suppose it is not considered good form to run a GUI dialog during class initialization, but getting a debugger popping up because the database config is wrong is not pleasant either. The modifications I made will not add the connection pool to the Smalltalk start up list until a valid connection configuration is entered so as to avoid all of that.

And its database stuff, so its not really all that pretty to begin with.

John

On Sat, Jan 30, 2010 at 8:12 AM, Mariano Martinez Peck <[hidden email]> wrote:


On Sat, Jan 30, 2010 at 5:06 AM, John McKeon <[hidden email]> wrote:
I'm sure it is probably not but I couldn't resist the pun...
Just in case you are interested in, I suggest you to read the metacello image based tutorial (no more than an hour) and if you have questions there is a mailing list where you can ask.

Link: http://code.google.com/p/metacello/wiki/Tutorial

Good luck.

Mariano

Cheers

 
All of this is in the latest version of Magritte-Roe in the repository. If anyone cares to take a look at my morphic dialog code, I would welcome any advice.

Thanks in advance

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki



--
http://jmck.seasidehosting.st

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki